Hi, I’d like to draw a polygon by clicking on the map and dragging my mouse in the outline of the polygon rather than clicking each vertex as is required using TrackMode = TrackMode.Polygon. Is this possible?
Thanks,
Trevor
Draw Polygon by dragging mouse
Hi Tredvor,
If you want to draw a polygon like freehand you should want to choose TrackMode.Freehand.
The TrackMode.Polygon mode only support click vertex to draw polygon.
Regards,
Don
Thanks Don,
That works great for drawing a line so I guess I’d need to connect the start and end point in order to create a polygon. Is there a simple way to accomplish this? What if the string intersects itself? At that point if I connected the start and end points I’d end up with a multipolygon, which may or may not be what the user was trying to draw. I could also throw away the ends and use the intersection point as the start and end of the polygon, which would create a simple polygon. In either case I would assume I need to do some spatial analysis on the drawn vector and manually edit the vertices collection. I assume this is possible? Or is there a nicer way to accomplish this? So far every time I’ve thought I’d need to get fancy this tool has instead provided a very simple means of doing what I wanted :)
Thanks,
Trevor
Hi Trevor,
If you want to implement that, for simple, I think you can choose set Map1.TrackOverlay.TrackMode = TrackMode.Line and then write some code in TrackEnded event, you can get the line there, then connect the end point and start point, build a polygon and put it to other layer.
If you worry about multipolygon, you can get the simple polygon from it and save it to other layer.
If you want to edit the vertices collection, you also need move the shape from track overlay to edit overlay.
So please just choose any mode you want, then you just need convert the result shape to what you want. Because track overlay only save the shape when you track it, you need move it to other layer after track end.
Regards,
Don