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及其二次开发,一起进步!
  • 相关阅读:
    [转载]应用系统架构设计
    带隐藏功能的菜单导航
    3 CSS 高级语法
    FarPoint Spread 基础知识
    端口映射工具
    2008年上半年信息系统项目管理师考试试题分析
    DateTime.Now
    华为战略部门研究山寨机决定出售手机部门
    网管必须掌握的八个DOS命令(转)
    智能机常见问题(新手必读)
  • 原文地址:https://www.cnblogs.com/tuncaysanli/p/1330074.html
Copyright © 2011-2022 走看看