ExternalGraphic_GetBoundingBox

7 messages Options
Embed this post
Permalink
iceDice

ExternalGraphic_GetBoundingBox

Reply Threaded More More options
Print post
Permalink
Hello,

I have following situation:
I read Points (geometry type) from Postgis, style them with SLD and
render on JMapFrame. I use min and max scale denominator to draw points
with external graphic with different size.
What i need to know in every moment are SCREEN coordinates of external
graphic (which is used in SLD), depending on current map scale. I need to
get bounding box around external graphic in screen coordinates depending on
map scale. This is because external graphic object is of different size for different
map scales.
What i have are world coordinates of center for every point. I am curious is it
possible to get screen coordinates from world coordinates and current map scale?
Also when we specify size of external graphic in SLD with <sld:Size></sld:Size> is
it possible to get graphic height and width in pixels from it?

I would appreciate if someone can help me about this issues.

Best regards!
mbedward

Re: ExternalGraphic_GetBoundingBox

Reply Threaded More More options
Print post
Permalink
> What i have are world coordinates of center for every point. I am curious is
> it
> possible to get screen coordinates from world coordinates and current map
> scale?

mapFrame.getMapPane().getWorldToScreenTransform() is your friend

Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
iceDice

Re: ExternalGraphic_GetBoundingBox

Reply Threaded More More options
Print post
Permalink
Thanks Michael,

What about SLD and his way of styling data. Is it somehow possible
to get width and height of graphic symbol in pixels on map?
Say that we have .png image and that we define <sld:Size>100</sld:Size>
to that image. Is it possible to know graphic height and width in pixels from
that information?
I need that because i want to catch mouse events when user enters and exits
that graphic symbol and show some pop-up window with informations on mouse entered.

Best regards.



That helps me much.
What i need to know in every moment are SCREEN coordinates of external
graphic (which is used in SLD), depending on current map scale. I need to
get bounding box around external graphic in screen coordinates depending on
map scale. This is because external graphic object is of different size for
different
map scales.
What i have are world coordinates of center for every point. I am curious is
it
possible to get screen coordinates from world coordinates and current map
scale?
Also when we specify size of external graphic in SLD with
<sld:Size></sld:Size> is
it possible to get graphic height and width in pixels from it?
mbedward wrote:
> What i have are world coordinates of center for every point. I am curious is
> it
> possible to get screen coordinates from world coordinates and current map
> scale?

mapFrame.getMapPane().getWorldToScreenTransform() is your friend

Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Ian Turton

Re: ExternalGraphic_GetBoundingBox

Reply Threaded More More options
Print post
Permalink
On Wed, Sep 23, 2009 at 2:47 PM, iceDice <[hidden email]> wrote:
>
> Thanks Michael,
>
> What about SLD and his way of styling data. Is it somehow possible
> to get width and height of graphic symbol in pixels on map?
> Say that we have .png image and that we define <sld:Size>100</sld:Size>
> to that image. Is it possible to know graphic height and width in pixels
> from
> that information?

The width or height of the graphic will be 100px - if you are using a
non square icon you'll need to check the code to see if the width or
the height will be 100px as I forget which one is chosen.

Ian
--
Ian Turton

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Jody Garnett-2

Re: ExternalGraphic_GetBoundingBox

Reply Threaded More More options
Print post
Permalink
In reply to this post by iceDice
I know what you mean - it is a problem I have not solved yet for uDig.  
We need to kind of consider what rules were used to render the image;  
in order to get the resulting hit area. My own approach that I think  
would be needed is to handle it in a similar manner to the label  
cache; run all graphics through a data structure (in order to prevent  
collisions) and use the same data structure to do the click lookup.

If your graphics are all the same size (this is usual) create your  
query using the correct size when looking for the feature that was  
clicked on.

Example - rendering points with 16x16 graphics. When the user clicks  
use screen2world on a pixel at (x-7,y-7) to (x+7,y+7). This would give  
you the bounds used to query your data set ... taking into account the  
size of the graphics.

Jody

On 24/09/2009, at 4:47 AM, iceDice wrote:

>
> Thanks Michael,
>
> What about SLD and his way of styling data. Is it somehow possible
> to get width and height of graphic symbol in pixels on map?
> Say that we have .png image and that we define <sld:Size>100</
> sld:Size>
> to that image. Is it possible to know graphic height and width in  
> pixels
> from
> that information?
> I need that because i want to catch mouse events when user enters  
> and exits
> that graphic symbol and show some pop-up window with informations on  
> mouse
> entered.
>
> Best regards.
>
>
>
> That helps me much.
> What i need to know in every moment are SCREEN coordinates of external
> graphic (which is used in SLD), depending on current map scale. I  
> need to
> get bounding box around external graphic in screen coordinates  
> depending on
> map scale. This is because external graphic object is of different  
> size for
> different
> map scales.
> What i have are world coordinates of center for every point. I am  
> curious is
> it
> possible to get screen coordinates from world coordinates and  
> current map
> scale?
> Also when we specify size of external graphic in SLD with
> <sld:Size></sld:Size> is
> it possible to get graphic height and width in pixels from it?
>
> mbedward wrote:
>>
>>> What i have are world coordinates of center for every point. I am  
>>> curious
>>> is
>>> it
>>> possible to get screen coordinates from world coordinates and  
>>> current map
>>> scale?
>>
>> mapFrame.getMapPane().getWorldToScreenTransform() is your friend
>>
>> Michael
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry® Developer Conference in SF,  
>> CA
>> is the only developer event you need to attend this year. Jumpstart  
>> your
>> developing skills, take BlackBerry mobile applications to market  
>> and stay
>> ahead of the curve. Join us from November 9-12, 2009. Register
>> now!
>> http://p.sf.net/sfu/devconf
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/ExternalGraphic-GetBoundingBox-tp3698425p3701620.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9-12, 2009. Register  
> now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Geotools-gt2-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
iceDice

Re: ExternalGraphic_GetBoundingBox

Reply Threaded More More options
Print post
Permalink
Hi Jody,

Moreover i have even worse situation.
I need to show balloon tips over that graphic symbols.
Problem is that balloon tip components that we have can
be placed only over JComponent objects or something that
is extended from it. I don't know how to access to those
graphic symbols as objects, don't know if that is possible at all.
Because of that i considering to dynamically create invisible JComponent
objects over hitting area of every symbol and show balloon tips over it.
To do that i will need to calculate hitting area considering screen coordinates
of graphic center (which i can get from world coordinates that i have always
in database) and size of graphic symbol in pixels (i can calculate width and
height of symbol from current map scale because size of symbol is specified in
SLD depending on scale denominators). However i am worried how this
will work on performance and speed.
Another approach will be to draw symbols on top of the map,
independently from geotools renderer and SLD but that can also produce
big problems as i consider that i should have all layers rendered by map.
I would like to know what are you think about this and if you have some
other ideas how to solve that problem.

Best regards.


Jody Garnett-2 wrote:
I know what you mean - it is a problem I have not solved yet for uDig.  
We need to kind of consider what rules were used to render the image;  
in order to get the resulting hit area. My own approach that I think  
would be needed is to handle it in a similar manner to the label  
cache; run all graphics through a data structure (in order to prevent  
collisions) and use the same data structure to do the click lookup.

If your graphics are all the same size (this is usual) create your  
query using the correct size when looking for the feature that was  
clicked on.

Example - rendering points with 16x16 graphics. When the user clicks  
use screen2world on a pixel at (x-7,y-7) to (x+7,y+7). This would give  
you the bounds used to query your data set ... taking into account the  
size of the graphics.

Jody

On 24/09/2009, at 4:47 AM, iceDice wrote:

>
> Thanks Michael,
>
> What about SLD and his way of styling data. Is it somehow possible
> to get width and height of graphic symbol in pixels on map?
> Say that we have .png image and that we define <sld:Size>100</
> sld:Size>
> to that image. Is it possible to know graphic height and width in  
> pixels
> from
> that information?
> I need that because i want to catch mouse events when user enters  
> and exits
> that graphic symbol and show some pop-up window with informations on  
> mouse
> entered.
>
> Best regards.
>
>
>
> That helps me much.
> What i need to know in every moment are SCREEN coordinates of external
> graphic (which is used in SLD), depending on current map scale. I  
> need to
> get bounding box around external graphic in screen coordinates  
> depending on
> map scale. This is because external graphic object is of different  
> size for
> different
> map scales.
> What i have are world coordinates of center for every point. I am  
> curious is
> it
> possible to get screen coordinates from world coordinates and  
> current map
> scale?
> Also when we specify size of external graphic in SLD with
> <sld:Size></sld:Size> is
> it possible to get graphic height and width in pixels from it?
>
> mbedward wrote:
>>
>>> What i have are world coordinates of center for every point. I am  
>>> curious
>>> is
>>> it
>>> possible to get screen coordinates from world coordinates and  
>>> current map
>>> scale?
>>
>> mapFrame.getMapPane().getWorldToScreenTransform() is your friend
>>
>> Michael
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry® Developer Conference in SF,  
>> CA
>> is the only developer event you need to attend this year. Jumpstart  
>> your
>> developing skills, take BlackBerry mobile applications to market  
>> and stay
>> ahead of the curve. Join us from November 9-12, 2009. Register
>> now!
>> http://p.sf.net/sfu/devconf
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> Geotools-gt2-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/ExternalGraphic-GetBoundingBox-tp3698425p3701620.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9-12, 2009. Register  
> now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Jody Garnett-2

Re: ExternalGraphic_GetBoundingBox

Reply Threaded More More options
Print post
Permalink
Hi again.

The JMapPane is a JComponent ....

You are thinking about this the wrong way around :-(

The graphical symbols are part of the draw instructions; they define  
what is going to be rendered for you.  It is like the letter "e" - you  
can that letter used in the "File" menu - but the same letter "e" will  
be used elsewhere around the screen.  It is just a shape :-)

With respect to balloon help you have a JComponent to start from;  
(indeed you can use the GeoTools renderer to produce an image for any  
kind of component you are working with).

The problem will come down to what the user is hovering over; making a  
request to see what feature is at that location; and producing a  
balloon help based on that feature.

If you really want objects you can go through your point data and read  
it into a series of objects like you describe; but there would be no  
need to render them (they would only be a data structure so you can  
ask what is at point x,y on the screen.

Jody

On 25/09/2009, at 4:52 AM, iceDice wrote:

>
> Hi Jody,
>
> Moreover i have even worse situation.
> I need to show balloon tips over that graphic symbols.
> Problem is that balloon tip components that we have can
> be placed only over JComponent objects or something that
> is extended from it. I don't know how to access to those
> graphic symbols as objects, don't know if that is possible at all.
> Because of that i considering to dynamically create invisible  
> JComponent
> objects over hitting area of every symbol and show balloon tips over  
> it.
> To do that i will need to calculate hitting area considering screen
> coordinates
> of graphic center (which i can get from world coordinates that i  
> have always
> in database) and size of graphic symbol in pixels (i can calculate  
> width and
> height of symbol from current map scale because size of symbol is  
> specified
> in
> SLD depending on scale denominators). However i am worried how this
> will work on performance and speed.
> Another approach will be to draw symbols on top of the map,
> independently from geotools renderer and SLD but that can also produce
> big problems as i consider that i should have all layers rendered by  
> map.
> I would like to know what are you think about this and if you have  
> some
> other ideas how to solve that problem.
>
> Best regards.
>
>
>
> Jody Garnett-2 wrote:
>>
>> I know what you mean - it is a problem I have not solved yet for  
>> uDig.
>> We need to kind of consider what rules were used to render the image;
>> in order to get the resulting hit area. My own approach that I think
>> would be needed is to handle it in a similar manner to the label
>> cache; run all graphics through a data structure (in order to prevent
>> collisions) and use the same data structure to do the click lookup.
>>
>> If your graphics are all the same size (this is usual) create your
>> query using the correct size when looking for the feature that was
>> clicked on.
>>
>> Example - rendering points with 16x16 graphics. When the user clicks
>> use screen2world on a pixel at (x-7,y-7) to (x+7,y+7). This would  
>> give
>> you the bounds used to query your data set ... taking into account  
>> the
>> size of the graphics.
>>
>> Jody
>>
>> On 24/09/2009, at 4:47 AM, iceDice wrote:
>>
>>>
>>> Thanks Michael,
>>>
>>> What about SLD and his way of styling data. Is it somehow possible
>>> to get width and height of graphic symbol in pixels on map?
>>> Say that we have .png image and that we define <sld:Size>100</
>>> sld:Size>
>>> to that image. Is it possible to know graphic height and width in
>>> pixels
>>> from
>>> that information?
>>> I need that because i want to catch mouse events when user enters
>>> and exits
>>> that graphic symbol and show some pop-up window with informations on
>>> mouse
>>> entered.
>>>
>>> Best regards.
>>>
>>>
>>>
>>> That helps me much.
>>> What i need to know in every moment are SCREEN coordinates of  
>>> external
>>> graphic (which is used in SLD), depending on current map scale. I
>>> need to
>>> get bounding box around external graphic in screen coordinates
>>> depending on
>>> map scale. This is because external graphic object is of different
>>> size for
>>> different
>>> map scales.
>>> What i have are world coordinates of center for every point. I am
>>> curious is
>>> it
>>> possible to get screen coordinates from world coordinates and
>>> current map
>>> scale?
>>> Also when we specify size of external graphic in SLD with
>>> <sld:Size></sld:Size> is
>>> it possible to get graphic height and width in pixels from it?
>>>
>>> mbedward wrote:
>>>>
>>>>> What i have are world coordinates of center for every point. I am
>>>>> curious
>>>>> is
>>>>> it
>>>>> possible to get screen coordinates from world coordinates and
>>>>> current map
>>>>> scale?
>>>>
>>>> mapFrame.getMapPane().getWorldToScreenTransform() is your friend
>>>>
>>>> Michael
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Come build with us! The BlackBerry® Developer Conference in SF,
>>>> CA
>>>> is the only developer event you need to attend this year. Jumpstart
>>>> your
>>>> developing skills, take BlackBerry mobile applications to market
>>>> and stay
>>>> ahead of the curve. Join us from November 9-12, 2009. Register
>>>> now!
>>>> http://p.sf.net/sfu/devconf
>>>> _______________________________________________
>>>> Geotools-gt2-users mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/ExternalGraphic-GetBoundingBox-tp3698425p3701620.html
>>> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry® Developer Conference in  
>>> SF, CA
>>> is the only developer event you need to attend this year. Jumpstart
>>> your
>>> developing skills, take BlackBerry mobile applications to market and
>>> stay
>>> ahead of the curve. Join us from November 9-12, 2009. Register
>>> now!
>>> http://p.sf.net/sfu/devconf
>>> _______________________________________________
>>> Geotools-gt2-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry® Developer Conference in SF,  
>> CA
>> is the only developer event you need to attend this year. Jumpstart  
>> your
>> developing skills, take BlackBerry mobile applications to market  
>> and stay
>> ahead of the curve. Join us from November 9-12, 2009. Register
>> now!
>> http://p.sf.net/sfu/devconf
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/ExternalGraphic-GetBoundingBox-tp3698425p3708037.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9-12, 2009. Register  
> now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Geotools-gt2-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users