DirectPosition2D p = ev.getWorldPos();
        Rectangle screenRect = new Rectangle((int)p.x-25,(int)p.y-25, 50, 50);
        ReferencedEnvelope bbox = new ReferencedEnvelope(
                screenRect,
                mapFrame.getMapContent().getCoordinateReferenceSystem());


I tried what you said but now when i clik on a feature, the application return 
me it found nothing.

> Date: Thu, 7 Jun 2012 20:14:37 +1000
> Subject: Re: Problem with features selected
> From: michael.bedw...@gmail.com
> To: ptit...@hotmail.com
> CC: geotools-gt2-users@lists.sourceforge.net
> 
> There is no need to use the screen position at all. You just seem to
> be stuck on that point.  Instead, you can just get the world position
> directly with MapMouseEvent.getWorldPos()
> 
> http://docs.geotools.org/latest/javadocs/org/geotools/swing/event/MapMouseEvent.html#getWorldPos()
> 
> From there it should be very simple to do what you want.
> 
> Michael
> 
> 
> 
> On 7 June 2012 19:18, jérémy lacombe <ptit...@hotmail.com> wrote:
> > Rectangle screenRect = new Rectangle(screenPos.x-25,y-25,50,50);
> > Rectangle2D worldrect =
> > screenToWorld.createTransformedShape(screenRect).getBounds2D();
> > ReferencedEnvelope bbox = new ReferencedEnvelope(worldRect,
> > mapFrame.getMapContent().getCoordinateReferencesSystem());
> >
> >
> > Filter filter = ff.bbox(ff.proprety(geometryAttribteName),bbox);
> >
> > try{
> > selectedFeatures = featureSource.getFeatures(filter);
> > ...
> >
> > That's what i do.
> > That's what i want : select all features that fall within 50km of the
> > current mouse cursor position clik.
> > That's i think i must modifie : the rectangle get the mouse position click
> > and have PIXEL size and not km size
> >
> >
> >> Date: Thu, 7 Jun 2012 19:04:06 +1000
> >
> >> Subject: Re: Problem with features selected
> >> From: michael.bedw...@gmail.com
> >> To: ptit...@hotmail.com
> >> CC: geotools-gt2-users@lists.sourceforge.net
> >>
> >> On 7 June 2012 18:34, jérémy lacombe <ptit...@hotmail.com> wrote:
> >> > I tried a lot of things to solved the problem, else i didn't ask the
> >> > question to help me ^_^
> >>
> >> Sure, but I'm afraid that you haven't supplied much information about
> >> what you have tried and why the results have not been useful to you.
> >> That is probably why you are not getting many replies other than mine
> >> (which haven't helped you much so far :)
> >>
> >> It would also help if you specified precisely what you are trying to
> >> achieve. For example: select all features that fall within 5km of the
> >> current mouse cursor position.
> >>
> >> > I use a bbox so i don't really anderstand why it don't take the WORLD
> >> > SIZE
> >> > and take PIXEL SIZE.
> >>
> >> Do you mean a bbox filter ? If so, what do you mean when you say it
> >> doesn't take the world size ? This is actually what a bbox filter is
> >> for - finding features that fall within a given rectangle expressed in
> >> world units.
> >>
> >> Michael
                                          
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to