Hi,
In my application, user can draw/Edit a polygon on the map.
I want to get the polygon extent after user draw/edit the polygon.
What is the event that I have to add the event handler?
Any code sample will be helpful.
Thanks,
Katherine
Hi,
In my application, user can draw/Edit a polygon on the map.
I want to get the polygon extent after user draw/edit the polygon.
What is the event that I have to add the event handler?
Any code sample will be helpful.
Thanks,
Katherine
Hi katherine,
When you have drawn a polygon, you could get the polygon extent in the TrackEnded event of TrackOverlay. For editing a polygon, you should use different events for different operation. For example, if you want to drag a polygon, you should hook the FeatureDragged event of EditOverlay and process the feature in that event. The code could be like this:
winformsMap1.TrackOverlay.TrackEnded += new EventHandler<TrackEndedTrackInteractiveOverlayEventArgs>(TrackOverlay_TrackEnded);
winformsMap1.EditOverlay.FeatureDragged += new EventHandler<FeatureDraggedEditInteractiveOverlayEventArgs>(EditOverlay_FeatureDragged);
void EditOverlay_FeatureDragged(object sender, FeatureDraggedEditInteractiveOverlayEventArgs e)
{
RectangleShape extent = e.DraggedFeature.GetBoundingBox();
}
void TrackOverlay_TrackEnded(object sender, TrackEndedTrackInteractiveOverlayEventArgs e)
{
RectangleShape extent = e.TrackShape.GetBoundingBox();
}
Hope this helps and any more questions please let us know.
Thanks,
Sun