[geotk] mouse click event on shape

sorel johann johann.sorel at geomatys.fr
Mon Feb 7 03:17:33 EST 2011


Hello

If you are using the JMap2D that's fast.

//make a search area based on your mouse position
Shape searchArea = new 
Rectangle(mouse.getPoint().x-2,mouse.getPoint().y-2,4,4);
//each time something hit the search area it will be passed to the visitor
GraphicVisitor visitor = new ...(your own visitor);
//make the search
map.getCanvas().getGraphicsIn(searchArea, visitor, VisitFilter.INTERSECTS);


If you are using a mapcontext object, don't forget that maplayers should 
be set selectable
otherwise the visite method won't return results for the layer.

johann sorel


Le 05/02/2011 08:34, Gopinath Asutosh a écrit :
> Hi,
>
> how to implement mouse clicking on a shape to open a dialog?
>
> please help.
>
> thanks
> asutosh
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geotoolkit/attachments/20110207/4234aacf/attachment.html


More information about the Geotoolkit mailing list