ThinkGeo.com    |     Documentation    |     Premium Support

Vertex move completed event?

Good morning.


I'm finally getting to play with the interactive editors, etc.  One of the features of our software is to let the user move the vertices of some of the polygons.    And, we have an undo feature as well.   I'm running into a little problem with this, and need guidance.


WHen the user clicks on a vertex and drags it, I want to update the undo stack with the polygon at the time the vertex is dropped at the new location.    I don't care about what happens while he is dragging it.    I have registered for the VertexMoved event, and I see that is fired as frequently as MouseMoved.  


My questions:


1) Are there events that only fire when moving a vertex is completed?   And same question for dragging the entire polygon?    They don't jump out at me if they exist.


2) If not, do I need to set a "hasMoved" flag in mode code upon the detection of of a VertexMoved event, and then check for "hasMoved" in a MouseUp event, and fire my own ShapeChanged event?


Thanks!



Ted,


Thanks for your post and questions!
 
I think what you are thinking is absolutely right. Following is the code implementation of your thoughts:)

public enum EditMode
        {
            None = 0,
            VertexMoved = 1,
            VertexDraged = 2
        }

        private EditMode editMode = EditMode.None;
        void EditOverlay_MapMouseUp(object sender, MapMouseUpInteractiveOverlayEventArgs e)
        {
            if(editMode == EditMode.VertexMoved)
            {
                System.Diagnostics.Debug.WriteLine("VertexMoved");
                editMode = EditMode.None;
            }

            if (editMode == EditMode.VertexDraged)
            {
                System.Diagnostics.Debug.WriteLine("Vertex Draged");
                editMode = EditMode.None;
            }
        }

        void EditOverlay_VertexMoved(object sender, VertexMovedEditInteractiveOverlayEventArgs e)
        {
            editMode = EditMode.VertexMoved;
        }

        void EditOverlay_FeatureDragged(object sender, FeatureDraggedEditInteractiveOverlayEventArgs e)
        {
            editMode = EditMode.VertexDraged;
        }

 

Any more questions please feel free to let me know.
 
Thanks.
 
Yale