[Lazarus] SVG Object

Mehmet Erol Sanliturk m.e.sanliturk at gmail.com
Tue Jan 18 09:47:41 CET 2022


On Tue, Jan 18, 2022 at 7:22 AM Steve Gatenby via lazarus <
lazarus at lists.lazarus-ide.org> wrote:

> Thank you Mehmet -
>
> Tried to follow the math within the svg (inkscape) on my first attempt(s)
>
> got completely lost (which leads to questioning ones intelligence) on the
> transforms, scales and differing units :)
>
> So now fully fudging it by dividing the Svg source Height and Width by a
> grid format and call each one a quadrant location (x,y).
>
> Then do the same with the OnClick position of the viewer (so relative
> quadrants / sizes), and find closest matching (for me) object. All depends
> on granularity of grid for accuracy.
>
> Works, but is very dependent on complexity of the svg (not a problem for
> my use case so far)
>
>
>
My primary profession was "Elementary School Teacher" . In our profession ,
determiner factor is not intelligence ( because everyone virtually has
sufficient amount of it )
but  "work with respect to scientific principles ,  continuous efforts ,
knowledge of the subject" .  Please do not blame yourself with respect to
intelligence .

Later on I went to the Middle East Technical University ( Ankara , Turkey )
to be a
( Mathematician , Computer Expert , a Good Manager of Money ( I have never
been able
to earn sufficient money to manage other than my monthly salaries )) , and
then an
instructor in another University ( Hacettepe ) . Always my emphasized point
to my
students and nearly every other one around me was the principle :
"Not intelligence , but sufficient study and work" .


My opinion is that you also need sufficient study and work , not
intelligence because
it is easily understandable that you have plenty of it .

You may see the following page and its associated subpages leading you to
"Computer Graphics" books if you think you need to review or learn subjects
about
it .


https://en.wikipedia.org/wiki/Category:Computer_graphics
Category:Computer graphics

And also useful  ( more ) pages ...

https://en.wikipedia.org/wiki/Category:Communication_design
Category:Communication design


https://en.wikipedia.org/wiki/Category:Information_visualization
Category:Information visualization


https://en.wikipedia.org/wiki/Category:Visualization_(graphic)
Category:Visualization (graphic)

      .
      .
      .

This means that your problem is not so easy to handle as seen from a
distant point .



With my best wishes for all ,


Mehmet Erol Sanliturk










> On 18/1/22 9:53 am, Mehmet Erol Sanliturk wrote:
>
>
>
> On Tue, Jan 18, 2022 at 2:37 AM Steve Gatenby via lazarus <
> lazarus at lists.lazarus-ide.org> wrote:
>
>> Thanks Marc - seems I will need to stick with what I have then.
>>
>> Currently I am pulling all object info from the SVG into an array and
>> assigning quadrant positions.
>>
>> Then do best guess by relative quadrant of mouse click position - works
>> fine, but feels sloppy :)
>>
>>
>
> If it is feasible for you , you may do the following :
>
>
> In an array of a record , define approximate "bounding boxes" of your
> SVG graphic ( You may generate  a "bounding box" array conforming to the
> given SVG ) .
>
> In  the "bounding box" array record , you may define a pointer showing the
> SVG object .
> When a mouse click is obtained , you may search  "bounding box" array and
> if it is related with an element of the SVG , from it you reach to the SVG
> element and
> do whatever you want to do with it .
>
>
> https://en.wikipedia.org/wiki/Minimum_bounding_box
> Minimum bounding box
>
> ( Please see attached pages . )
>
>
> This idea may be considered as an alternative view which I can not say that
> it is very suitable for you . Only you may decide its usefulness .
>
>
>
> Mehmet Erol Sanliturk
>
>
>
>
>
>
>>
>> On 17/1/22 8:55 pm, Marc Weustink via lazarus wrote:
>> > I'm afraid there is no easy solution for that. SVGs are rendered from
>> > the first element to the last, where ever element (atleast in theory)
>> > can be a part of a given pixel. SVG elements do have a
>> > x,y,width,height but they may also be part of one or more
>> > transformations.
>> > To give you an idea, the (browser)app I'm currently working on
>> > displays several object, where every object has an origin(x,y) of 0,0
>> > and they are finally placed by translations.
>> > The easiest way (if you are in a browser context) is to add an onclick
>> > handler to your elements of interest.
>> >
>> > Marc
>> >
>> >
>> >
>> > On 16-1-2022 23:34, Steve Gatenby via lazarus wrote:
>> >> Not sure if this is the right place to ask about this one -
>> >>
>> >> I am using the BCSVGViewer from bgra controls - for SVG viewing
>> >> obviously :)
>> >>
>> >> Would anybody know if there is a method to retrieve the object
>> >> (within the svg) at specified x,y ?
>> >>
>> >> or is it possible to use embedded links within the svg ?
>> >>
>> >> I am looking to find which object has been clicked on within the svg
>> >> to create a 'clickable' map
>> >>
>> >> Any suggestions on a better place to post this also appreciated
>> >>
>> >> Regards SteveG
>> >>
>> --
>> _______________________________________________
>> lazarus mailing list
>> lazarus at lists.lazarus-ide.org
>> https://lists.lazarus-ide.org/listinfo/lazarus
>>
> --
> _______________________________________________
> lazarus mailing list
> lazarus at lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20220118/37e31c33/attachment-0002.htm>


More information about the lazarus mailing list