Exemple #1
0
        public bool IsValid(object caller, ICSharpCode.Core.Condition condition)
        {
            bool            hasUndos = false;
            DF2DApplication app      = DF2DApplication.Application;

            if (app == null || app.Current2DMapControl == null)
            {
                return(false);
            }

            IWorkspaceEdit pWorkspaceEdit = Class.Common.CurWspEdit;

            if (pWorkspaceEdit == null)
            {
                return(false);
            }

            if (pWorkspaceEdit.IsBeingEdited())
            {
                pWorkspaceEdit.HasUndos(ref hasUndos);
                if (hasUndos)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        //撤销
        public static void UndoEdit(AxMapControl axmap, ILayer player)
        {
            // Check that editing is possible
            m_CurrentLayer = player;
            m_MapControl   = axmap;
            if (m_CurrentLayer == null)
            {
                return;
            }
            IFeatureLayer pFeatureLayer = (IFeatureLayer)m_CurrentLayer;
            IDataset      pDataset      = (IDataset)pFeatureLayer.FeatureClass;

            if (pDataset == null)
            {
                return;
            }

            /// If edits have taken place then roll-back the last one
            IWorkspaceEdit pWorkspaceEdit = (IWorkspaceEdit)pDataset.Workspace;
            bool           bHasUndos      = false;

            pWorkspaceEdit.HasUndos(ref bHasUndos);
            if (bHasUndos)
            {
                pWorkspaceEdit.UndoEditOperation();
            }

            IActiveView pActiveView = (IActiveView)m_MapControl.Map;

            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, pActiveView.Extent);
            pActiveView.Refresh();
        }
Exemple #3
0
        /// <summary>
        /// 撤消以前所做的编辑
        /// </summary>
        public void UndoEdit()
        {
            bool bHasUndos = false;

            try
            {
                if (m_pCurrentLayer == null)
                {
                    return;
                }

                IFeatureLayer pFeatureLayer = (IFeatureLayer)m_pCurrentLayer;
                IDataset      pDataset      = (IDataset)pFeatureLayer.FeatureClass;
                if (pDataset == null)
                {
                    return;
                }

                IWorkspaceEdit pWorkspaceEdit = (IWorkspaceEdit)pDataset.Workspace;
                pWorkspaceEdit.HasUndos(ref bHasUndos);
                if (bHasUndos)
                {
                    pWorkspaceEdit.UndoEditOperation();
                }

                IActiveView pActiveView = (IActiveView)m_pMap;
                pActiveView.Refresh();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message.ToString());
            }
        }
Exemple #4
0
        /// <summary>
        /// 撤销操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_undotool_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (pEngineEditor != null && pEngineEditor.EditState == esriEngineEditState.esriEngineStateEditing)
            {
                m_redotool.Enabled = true;
                IWorkspaceEdit workspaceedit = (IWorkspaceEdit)pEngineEditor.EditWorkspace;

                bool bHasUndo = true;
                workspaceedit.HasUndos(ref bHasUndo);

                if (bHasUndo)
                {
                    workspaceedit.UndoEditOperation();
                    ((IActiveView)m_mapControl.Map).Refresh();
                }
            }
        }
        public void OnClick()
        {
            try
            {
                m_Map          = m_hookHelper.FocusMap;
                m_activeView   = m_Map as IActiveView;
                m_EngineEditor = MapManager.EngineEditor;
                EditVertexClass.ClearResource();
                if (m_EngineEditor == null)
                {
                    return;
                }
                if (m_EngineEditor.EditState != esriEngineEditState.esriEngineStateEditing)
                {
                    return;
                }
                //此处应为IWorkspaceEdit,若为IWorkspaceEdit2无法强制转换
                IWorkspaceEdit pWSEdit    = m_EngineEditor.EditWorkspace as IWorkspaceEdit;
                IWorkspace     pWorkspace = m_EngineEditor.EditWorkspace;
                if (pWSEdit == null)
                {
                    return;
                }
                Boolean bHasUndo = true;

                if (pWorkspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
                {
                    m_EngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeNonVersioned;
                }

                //m_EngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
                pWSEdit.HasUndos(ref bHasUndo);
                if (bHasUndo)
                {
                    pWSEdit.UndoEditOperation();
                }
                m_activeView.Refresh();
            }
            catch (Exception ex)
            {
                //SysLogHelper.WriteOperationLog("编辑恢复错误", ex.Source, "数据编辑");
            }
        }
        public void UndoEdit()
        {
            if (MyselectedLayer == null)
            {
                return;
            }

            IFeatureLayer  featLayer     = MyselectedLayer as IFeatureLayer;
            IDataset       dataset       = featLayer.FeatureClass as IDataset;
            IWorkspaceEdit workspaceEdit = dataset.Workspace as IWorkspaceEdit;
            bool           bHasUndos     = false;

            workspaceEdit.HasUndos(ref bHasUndos);
            if (bHasUndos)
            {
                workspaceEdit.UndoEditOperation();
            }
            ClearSelection();
        }
Exemple #7
0
        public override void OnClick()
        {
            if (m_Hook == null)
            {
                return;
            }
            //LogFile log = new LogFile(m_Hook.tipRichBox, m_Hook.strLogFilePath);

            //if (log != null)
            //{
            //    log.Writelog("鹰眼图设置");
            //}
            if (m_Hook.ArcGisMapControl.Map.LayerCount == 0)
            {
                MessageBox.Show("当前没有调阅数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            try
            {
                IWorkspaceEdit iWE = ((getEditLayer.isExistLayer(m_Hook.ArcGisMapControl.Map) as IFeatureLayer).FeatureClass as IDataset).Workspace as IWorkspaceEdit;
                if (iWE.IsBeingEdited())
                {
                    bool hasEdits = false;
                    iWE.HasUndos(ref hasEdits);
                    if (hasEdits && MessageBox.Show("是否撤销编辑?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        iWE.UndoEditOperation();
                    }
                }
                m_Hook.ArcGisMapControl.ActiveView.Refresh();
                iWE = null;
            }
            catch
            {
            }
        }