I created a new class that inherits from TrackInteractiveOverlay. I am using this class to implement snapping already, but I am looking to expand it to enforce some rules for the feature shape. Basically, as the feature draws, I am running the vertices through a function that will check to see if the line or polygon will self-intersect.
My goal is to handle the VertexAdding event of the overlay so that I can reject new vertices that will create a bad feature. The VertexAddingTrackInteractiveOverlayEventArgs contains a .Cancel boolean. Your documentation isn’t really clear if this operates as a ‘cancel adding’ operation. I tried using it like…
If
CheckForBadGeometry()
Then
e.Cancel =
True
End
If
Thinking that it would cancel the vertex adding. However, it saves the one vertex I add, and then on the 2nd time it is triggered, it stops drawing completely. The map click handler still directs to adding a new vertex, but the track shape is gone.
So, my main question is if this is a bug, or is there a better way to stop a vertex from being added. I don’t want to do it after the fact with the created shape. I would much rather stop the vertex being added than try to correct something down the line.
Thanks for any info.