Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] A question about the tool framework

Hi All,

I need to create a tool for my RCP app that allows me to do the following:

  1. Click on a point on a state highway. The system runs off and finds
     the closest exact point on the SH network to the click and returns
     the coords of that point (we have a whole subsystem doing
     linear<->spatial conversions for our linear network). A dot is
     rendered on the map at that point.
  2. Click on a second point on the same stretch of highway. The same
     thing happens as 1.
  3. After the second click, the system returns the geometry of that
     stretch of highway between the clicks.
  4. At this point I want to render a line on the map that represents
     that stretch of highway, effectively highlighting it.
  5. It does not have to do anything as fancy as the editing tools,
     it's really just a visual representation of what the user is
     selecting.

I have achieved this in testing using DrawShapeCommand's and it works well. However, I now need to deal with pan and zoom to reposition the rendered shapes.

At this point I figure that I should probably start using the editing tool framework as it already does this sort of thing with the PolygonTool.

So... my question is, how do I make a start with this. I have looked at the Polygon tool as an example, but it is pretty complex with all it's Behaviours and Activators. Is there an example tool that I can look at that has the capability to render points and lines on the map and move them in relation to pan/zoom actions?

Actually, I just found the examples for tool.coordinate and mapgraphic.coordinate. They seem to use a similar approach to what I have been doing with DrawShapeCommands, but they don't deal with pan/zoom either. How does this work? If the tool renders an Ellipse2D on the ViewPortGraphics and then you do a pan the Ellipse2D stays at the same point in image space. And then the CoordinateMapGraphic just renders some more shapes taken from the map blackboard. Am I missing something here? I had to actually reposition my dots manually with the use of a map listener. What does MapGraphic actually do?

Thanks. I hope my confusion hasn't rubbed off on my email!
Mark

--
This message has been scanned for viruses and dangerous
content by MailScanner, and is believed to be clean.

begin:vcard
fn:Mark Presling
n:Presling;Mark
email;internet:mark@xxxxxxxxxxxx
tel;home:+6442322774
tel;cell:+6421549540
version:2.1
end:vcard


Back to the top