From: Martin D. <mar...@te...> - 2004-05-25 10:28:59
|
Anusorn Swasdee a =E9crit : > 1. Could you please tell me where to look for > selecting feature by using mouse.I've looked in "map" > and "map.event" but only found about layer change. If you are using J2D renderer, you can process as below: - Register a java.awt.event.MouseListener into MapPane. - Overrides the following method in MouseEvent: public void mouseClicked(MouseEvent event) { GeoMouseEvent e =3D (GeoMouseEvent) event; // do the rest of the processing here } where GeoMouseEvent is defined in org.geotools.renderer.j2d. - Call the 'getMapCoordinate' method in order to get the coordinate in the map coordinate system. - If you are looking for a geometry, you can call the 'getGeometries(coordinatePoint)' method in the org.geotools.renderer.geom.GeometryCollection class. If you are looking for a mark, I'm less familiar with this part if the mark was not rendered with RenderedMarks... Martin. |