From: Noredine B. <nbe...@ya...> - 2006-04-25 15:33:31
|
Hi everyone. I want to choose the function of the rigth clic selected area, the default is the Zoom In. How to implement the "get feature" ? I tried to use the example : http://docs.codehaus.org/display/GEOTOOLS/Adding+Tools+to+a+Map?showComments=true#comments but when I select an area, the style of the feature selected change, but the zoom change too. There's lot of class managing tools, (ToolFactory etc..), how can we use it? Here is the sample of my code, thanx for any help ! : ps : thanks Jody for the answer (reader.close) -in my application there's two jbutton, the first launch the "zoom in" mode, the other the "get feature" mode. -I add a listener to my StyledMapPane (it's the right solution?) : styled_map_pane.addMouseListener(new MouseListener() { //the coordinate of the clicked point //the released point is not stored public java.awt.geom.Point2D pntFirst; public void mouseClicked(MouseEvent e) { Rectangle2D l_rect_2d = styled_map_pane.getVisibleArea(); java.awt.geom.Point2D pnt = null; GeoMouseEvent ge = (GeoMouseEvent) e; pntFirst=ge.getMapCoordinate(pnt); int theToolNum = getToolInEffect(); if(theToolNum==GETFEATURE) { //the style of the selected feature will change getFeature(pntFirst,null); } } public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mousePressed(MouseEvent e) { GeoMouseEvent ge = (GeoMouseEvent) e; pntFirst=ge.getMapCoordinate(null); } public void mouseReleased(MouseEvent e) { if(getToolInEffect()==GETFEATURE) { GeoMouseEvent ge = (GeoMouseEvent) e; java.awt.geom.Point2D pntLast=ge.getMapCoordinate(null); //the style of the selected feature will change getFeature(pntFirst,pntLast); } } }); ___________________________________________________________________________ Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement vos services préférés : vérifiez vos nouveaux mails, lancez vos recherches et suivez l'actualité en temps réel. Rendez-vous sur http://fr.yahoo.com/set |