Exemplo n.º 1
0
        /// <summary>
        /// Reverts all changes recorded as part of this editing context.
        /// </summary>
        internal void RevertChanges()
        {
            if (m_IsReverting)
            {
                throw new InvalidOperationException("Changes are already being undone");
            }

            try
            {
                m_IsReverting = true;

                foreach (Operation op in m_RecalculatedEdits)
                {
                    op.RemoveFromIndex();
                }

                foreach (KeyValuePair <PointFeature, PointGeometry> kvp in m_Changes)
                {
                    kvp.Key.ApplyPointGeometry(this, kvp.Value);
                }

                foreach (Operation op in m_RecalculatedEdits)
                {
                    op.AddToIndex();
                }

                // Clear the stuff just used to undo things
                m_RecalculatedEdits.Clear();
                m_Changes.Clear();

                // Push back the original data
                m_Update.RevertChanges();
            }

            finally
            {
                m_IsReverting = false;
            }
        }