Hello,
I have implemented the second method. When the user clicks on the map,
I launch a new rendering of the map and with a listener that checks
if the corresponding pixel has been modified each time a Feature has
been rendered. The last Feature to modify this pixel is the selected object.
It works well when the features do not move on the map during time.
But in the other case, the first rendering for visualisation does not match
with the second rendering for selection.
So I think that the only solution is to generate, at every rendering, a buffer
the size of the image that stores for each pixel the feature id of the last
rendered feature on it.
Does it involve to check every pixel of the image after every rendering of a
feature or is there an other way? I think that would be very very long.
Thank you,
Yako Bak.
> Date: Wed, 29 Apr 2009 16:36:44 +1000
> Subject: Re: [Geotools-gt2-users] Selecting a feature represented by a symbol
> From: [email protected]
> To: [email protected]
>
> Any of the solutions we are describing here is going to require a lot
> of work. Try using an selection size based on the symbols you have and
> try it out. If you really do not like the result it will then be worth
> considering alternatives.
>
> Another alternative would be to make a small raster the size of the
> selection area and draw the features one at a time into it; when the
> raster is modified you know you have hit a feature that should be
> selected.
>
> Jody
>
> On Mon, Apr 27, 2009 at 6:22 PM, yako yako <[email protected]> wrote:
> > I didn't really understand this hack.
> >
> > By checking the clicked pixel on each individuals layers in the reverse
> > order of the drawing order,
> > I can retrieve the Feature Type of the drawn Feature at this position but I
> > can't tell
> > exactly which Feature it is, can I?
> >
> > Does the ZBuffer technique need a lot of work and skills in rendering
> > (implementing drawing algorithms, ...) or can it just be done by a few
> > changes?
> >
> >
> >> Date: Mon, 27 Apr 2009 08:28:19 +1000
> >> Subject: Re: [Geotools-gt2-users] Selecting a feature represented by a
> >> symbol
> >> From: [email protected]
> >> To: [email protected]
> >> CC: [email protected]
> >>
> >> You are correct this technique would only show the maximum size; and
> >> use it to query. The style data structure is available so you can
> >> perform the calculations yourself (to see if which rules have been
> >> used).
> >>
> >> There are a couple different approaches to selection in an interactive
> >> map; I mentioned one hack with respect to checking the pixels; a more
> >> involved technique involves rendering as a zbuffer; you would need to
> >> rewrite the renderer (or supply a hint) asking it to write down an
> >> integer for each feature drawn; and then check the raster at the end
> >> of the day to see what feature was "on top" in order to be clicked on.
> >> Not very much fun which is why I have not done it yet.
> >>
> >> Jody
> >>
> >> On Sun, Apr 26, 2009 at 11:01 PM, yako yako <[email protected]> wrote:
> >> >
> >> > Thank you Jody,
> >> >
> >> > But each Feature on a Layer can be drawn in various ways depending on
> >> > the
> >> > applied styling rules.
> >> > Is it possible to determine which rules has been applied by the renderer
> >> > for
> >> > a given Feature?
> >> >
> >> > Yako Bak
> >> >
> >> >> Date: Sat, 25 Apr 2009 18:24:09 +1000
> >> >> Subject: Re: [Geotools-gt2-users] Selecting a feature represented by a
> >> >> symbol
> >> >> From: [email protected]
> >> >> To: [email protected]
> >> >> CC: [email protected]
> >> >>
> >> >> Have a look at the StyleVisitor interface; you can use that to visit
> >> >> all the symbolizer elements used to rendering your features (and
> >> >> figure out what the target size is; and then use that size rather than
> >> >> 3x3 to determine your selection bounds).
> >> >>
> >> >> Note: In uDig we render each layer individual; allowing me to
> >> >> experimented in the past with just checking the pixels to see if
> >> >> anything is hit before trying to do a feature based query; this is
> >> >> only useful if you are rendering content onto individual rasters and
> >> >> then merging them.
> >> >>
> >> >> Jody
> >> >>
> >> >> On Sat, Apr 25, 2009 at 1:56 AM, yako yako <[email protected]> wrote:
> >> >> > Hello,
> >> >> >
> >> >> > I am making an application where the user can retrieve information
> >> >> > from
> >> >> > a
> >> >> > feature by clicking on it.
> >> >> >
> >> >> > To do this, I make a filter to get all features located on the area
> >> >> > defined
> >> >> > by the projection on the map
> >> >> > of a 3x3 pixels square centered on the position of the click.
> >> >> >
> >> >> > I encouter a problem with Feature represented by a symbol because
> >> >> > this
> >> >> > symbol can be bigger than
> >> >> > the real geometry of the feature. So we can not click anywhere on it
> >> >> > to
> >> >> > retrieve its information.
> >> >> >
> >> >> > Is it possible to get the bounds of the symbol used to represent a
> >> >> > feature
> >> >> > in order to compute its projection
> >> >> > on the map and check if it intersects the 'click area'?
> >> >> >
> >> >> > Is there an other way to assign a feature to a pixel on the map
> >> >> > whatever
> >> >> > its
> >> >> > type of representation is ?
> >> >> >
> >> >> > I hope I've been clear enough.
> >> >> >
> >> >> > Thank you,
> >> >> >
> >> >> > Yako Bak.
> >> >> >
> >> >> > ________________________________
> >> >> > Découvrez toutes les possibilités de communication avec vos proches
> >> >> >
> >> >> >
> >> >> > ------------------------------------------------------------------------------
> >> >> > Crystal Reports - New Free Runtime and 30 Day Trial
> >> >> > Check out the new simplified licensign option that enables unlimited
> >> >> > royalty-free distribution of the report engine for externally
> >> >> > facing
> >> >> > server and web deployment.
> >> >> > http://p.sf.net/sfu/businessobjects
> >> >> > _______________________________________________
> >> >> > Geotools-gt2-users mailing list
> >> >> > [email protected]
> >> >> > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> >> >> >
> >> >> >
> >> >
> >> > ________________________________
> >> > Votre correspondant a choisi Hotmail et profite d'un stockage quasiment
> >> > illimité. Créez un compte Hotmail gratuitement !
> >
> > ________________________________
> > Vous voulez savoir ce que vous pouvez faire avec le nouveau Windows Live ?
> > Lancez-vous !
_________________________________________________________________
Découvrez toutes les possibilités de communication avec vos proches
http://www.microsoft.com/windows/windowslive/default.aspx
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users