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及其二次开发,一起进步!
  • 相关阅读:
    xfs(dm-3):please umount the filesystem and rectify the problem(s)
    解决 pcre-8.35 make[2]: *** [aclocal.m4] Error 127
    redis-4.0.6 编译安装
    nginx出错:rewrite or internal redirection cycle
    17个技巧
    go-fastdfs/go-fastdfs-web
    Win X86 时间同步
    关闭或启动linux防火墙后,docker启动容器报错问题解决方式
    Nginx 重定向 443
    Docker 容器和宿主机相互拷贝文件
  • 原文地址:https://www.cnblogs.com/tuncaysanli/p/1330074.html
Copyright © 2011-2022 走看看