zoukankan      html  css  js  c++  java
  • Arcgis Engine9.2 Undo 和 Redo 功能实现

     


    /// <summary>
            /// 撒消编辑
            /// </summary>
            /// <param name="m_pMap">IMap 地图对象</param>
            public void MapUndoEdit(IMap m_pMap)
            {
                IEngineEditProperties ep = new EngineEditorClass();
                ILayer m_pCurrentLayer = ep.TargetLayer;
                if (m_pCurrentLayer == null) return;
                IFeatureLayer pFeatureLayer = (IFeatureLayer)m_pCurrentLayer;
                IDataset pDataset = (IDataset)pFeatureLayer.FeatureClass;
                if (pDataset == null) return;
               
                IWorkspaceEdit pWorkspaceEdit = (IWorkspaceEdit)pDataset.Workspace;
                bool bHasUndos = false;
                pWorkspaceEdit.HasUndos(ref bHasUndos);
                if (bHasUndos)
                    pWorkspaceEdit.UndoEditOperation();
                IActiveView pActiveView = (IActiveView)m_pMap;
                pActiveView.Refresh();
            }

            /// <summary>
            /// 重做
            /// </summary>
            /// <param name="m_pMap">IMap 地图对象</param>
            public void MapRedoEdit(IMap m_pMap)
            {
                IEngineEditProperties ep = new EngineEditorClass();
                ILayer m_pCurrentLayer = ep.TargetLayer;
                if (m_pCurrentLayer == null) return;
                IFeatureLayer pFeatureLayer = (IFeatureLayer)m_pCurrentLayer;
                IDataset pDataset = (IDataset)pFeatureLayer.FeatureClass;
                if (pDataset == null) return;
                IWorkspaceEdit pWorkspaceEdit = (IWorkspaceEdit)pDataset.Workspace;
                bool bHasUndos = false;
                pWorkspaceEdit.HasUndos(ref bHasUndos);
                if (bHasUndos)
                    pWorkspaceEdit.RedoEditOperation();
                IActiveView pActiveView = (IActiveView)m_pMap;
                pActiveView.Refresh();
            }

    一起学习GIS及其二次开发,一起进步!
  • 相关阅读:
    codeforces 701 D. As Fast As Possible(数学题)
    codeforces 807 E. Prairie Partition(贪心+思维)
    codeforces 807 D. Dynamic Problem Scoring(贪心+思维)
    codeforces 807 C. Success Rate(二分)
    Atcoder C
    Atcoder D
    hdu 3308 LCIS(线段树区间合并)
    SpringMVC学习笔记---
    Composer Yii2 不设置全局变量 归档安装 Win7
    电脑硬件扫盲--CPU 显卡
  • 原文地址:https://www.cnblogs.com/tuncaysanli/p/1330074.html
Copyright © 2011-2022 走看看