Hi Dan, The best way to draw the line would be to XOR it onto the map pane. If you look at the JMapPane source you'll see a nested class near the top of the file called DragBox (terrible name) which does the XOR box drawing of a rectangle, e.g. when you are defining an area to zoom in to. You'll see that this class extends MouseInputAdapter which is a listener for mouse events that know both screen and real world coords.
With a bit of copying and hacking of that code you should be able to knock up your measuring tool easily, but if you get stuck let me know. Michael PS. You might want to set up your measure function as a cursor tool. The Selection Lab example shows one simple way of doing this for a custom tool... http://geotools.org/examples/selectionlab.html http://svn.osgeo.org/geotools/tags/2.6.0/demo/example/src/main/java/org/geotools/demo/SelectionLab.java If you want to go the whole hog you can look at existing cursor tools (e.g. PanTool, ZoomInTool) all of which derive from the CursorTool class. The source for these is here... http://svn.osgeo.org/geotools/tags/2.6.0/modules/unsupported/swing/src/main/java/org/geotools/swing/tool/ And their corresponding Action classes that provide tool Icons etc are here http://svn.osgeo.org/geotools/tags/2.6.0/modules/unsupported/swing/src/main/java/org/geotools/swing/action Hope this makes sense. Let me know if you have any probs. Michael PS. A measuring tool is one of things on the list of bits to add to the swing module - hopefully in the next month or two. ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
