コード例 #1
0
        private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
        {
            if (e.button == 2)
            {
                //Logic to determine which popup menu to show based on the current task and current tool

                IEngineEditTask currentTask = m_engineEditor.CurrentTask;

                switch (currentTask.UniqueName)
                {
                case "ControlToolsEditing_CreateNewFeatureTask":
                {
                    if (((ICommand)axToolbarControl1.CurrentTool).Name == "ControlToolsEditing_Sketch")
                    {
                        m_toolbarMenuSketch.PopupMenu(e.x, e.y, axMapControl1.hWnd);
                    }
                    else if (((ICommand)axToolbarControl1.CurrentTool).Name == "ControlToolsEditing_Edit")
                    {
                        //SetEditLocation method must be called to enable commands
                        ((IEngineEditSketch)m_engineEditor).SetEditLocation(e.x, e.y);
                        m_toolbarMenuVertex.PopupMenu(e.x, e.y, axMapControl1.hWnd);
                    }
                    break;
                }

                case "ControlToolsEditing_ModifyFeatureTask":
                {
                    //SetEditLocation method must be called to enable commands
                    ((IEngineEditSketch)m_engineEditor).SetEditLocation(e.x, e.y);
                    m_toolbarMenuVertex.PopupMenu(e.x, e.y, axMapControl1.hWnd);
                    break;
                }
                }
            }
        }
コード例 #2
0
ファイル: MainPage.cs プロジェクト: wushaungluanwu/MYGIS
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl);
            //把 MapControl 和 PageLayoutControl 绑定起来(两个都指向同一个 Map),然后设置 MapControl 为活动的 Control
            m_controlsSynchronizer.BindControls(true);
            //为了在切换 MapControl 和 PageLayoutControl 视图同步,要添加 Framework Control
            m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
            m_controlsSynchronizer.AddFrameworkControl(axTOCControl1.Object);


            axToolbarControl1.AddItem(new DotDensitySymbolsCmd(), -1, -1, false, -1, esriCommandStyles.esriCommandStyleIconAndText);//点密度
            axTOCControl1.SetBuddyControl(axMapControl1);

            axToolbarControl1.SetBuddyControl(axMapControl1);
            //定制菜单
            chkCustomize.Checked      = false;
            chkCustomize.CheckOnClick = true;
            //调用非模态定制对话框
            this.presenter.CreateCustomizeDialog();
            //初始化自定义命令
            axToolbarControl1.AddItem(new ClearCurrentActiveToolCmd(), -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconAndText);
            axToolbarControl1.AddItem(new AddDateTool(axToolbarControl1, axPageLayoutControl1), -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconAndText);
            //设置编辑菜单的状态
            saveEdit.Enabled    = false;
            endEdit.Enabled     = false;
            selectLayer.Enabled = false;
            addLayer.Enabled    = false;
            //编辑
            pEngineEditor           = new EngineEditorClass();
            MapManager.EngineEditor = pEngineEditor;
            pEngineEditTask         = pEngineEditor as IEngineEditTask;
            pEngineEditLayers       = pEngineEditor as IEngineEditLayers;
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            pCurrentLyr = this.mapControl4.get_Layer(0) as IFeatureLayer;

            pDataSet = pCurrentLyr.FeatureClass as IDataset;
            pWs      = pDataSet.Workspace;
            //设置编辑模式,如果是ArcSDE采用版本模式
            if (pWs.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
            {
                IVersionedObject3 versionedObject = pDataSet as IVersionedObject3;
                //注册版本
                if (versionedObject != null && !versionedObject.IsRegisteredAsVersioned)
                {
                    versionedObject.RegisterAsVersioned(true);
                }
                MapManager.EngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
            }
            else
            {
                MapManager.EngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeNonVersioned;
            }
            //设置编辑任务
            ((IEngineEditLayers)MapManager.EngineEditor).SetTargetLayer(pCurrentLyr, 0);
            MapManager.EngineEditor.StartEditing(pWs, this.mapControl4.ActiveView.FocusMap);
            MapManager.EngineEditor.EnableUndoRedo(true);

            pEngineEditTask = MapManager.EngineEditor as IEngineEditTask;
            pEngineEditTask = MapManager.EngineEditor.GetTaskByUniqueName("ControlToolsEditing_CreateNewFeatureTask");
            MapManager.EngineEditor.CurrentTask = pEngineEditTask;// 设置编辑任务
        }
コード例 #4
0
        public override void OnClick()
        {
            //Find the Modify Feature task and set it as the current task
            IEngineEditTask editTask = m_engineEditor.GetTaskByUniqueName("ControlToolsEditing_ModifyFeatureTask");

            m_engineEditor.CurrentTask = editTask;
        }
コード例 #5
0
 /// <summary>
 /// 编辑工具初始化
 /// </summary>
 private void EditorInit()
 {
     pEngineEditor           = new EngineEditorClass();
     MapManager.EngineEditor = pEngineEditor;
     pEngineEditTask         = pEngineEditor as IEngineEditTask;
     pEngineEditLayers       = pEngineEditor as IEngineEditLayers;
     pActiveView             = pMap as IActiveView;
 }
コード例 #6
0
ファイル: FormVertexList.cs プロジェクト: 605258778/GISData
        private void MovePoint(string sColumn, double pValue)
        {
            try
            {
                int num;
                int selectedIndex;
                IGeometryCollection geometry;
                IPointCollection    points;
                IPoint point;
                IEngineSketchOperation operation;
                DataRow focusedDataRow = this.gridView1.GetFocusedDataRow();
                if (focusedDataRow != null)
                {
                    num           = Convert.ToInt32(focusedDataRow[0]);
                    selectedIndex = this.listPart.SelectedIndex;
                    if (selectedIndex >= 0)
                    {
                        geometry = this.m_Geometry as IGeometryCollection;
                        points   = geometry.get_Geometry(selectedIndex) as IPointCollection;
                        point    = points.get_Point(num);
                        if (point != null)
                        {
                            if (sColumn == "gcX")
                            {
                                point.X = pValue;
                                goto Label_0096;
                            }
                            if (sColumn == "gcY")
                            {
                                point.Y = pValue;
                                goto Label_0096;
                            }
                        }
                    }
                }
                return;

Label_0096:
                operation = new EngineSketchOperationClass();
                operation.Start(Editor.UniqueInstance.EngineEditor);
                points.UpdatePoint(num, point);
                operation.SetMenuString("Move Vertex");
                esriEngineSketchOperationType esriEngineSketchOperationVertexMoved = esriEngineSketchOperationType.esriEngineSketchOperationVertexMoved;
                object missing = System.Type.Missing;
                object before  = new object();
                before = selectedIndex;
                geometry.RemoveGeometries(selectedIndex, 1);
                geometry.AddGeometry(points as IGeometry, ref before, ref missing);
                operation.Finish(null, esriEngineSketchOperationVertexMoved, point);
                Editor.UniqueInstance.FinishSketch();
                IEngineEditTask taskByUniqueName = Editor.UniqueInstance.EngineEditor.GetTaskByUniqueName("ControlToolsEditing_ModifyFeatureTask");
                Editor.UniqueInstance.EngineEditor.CurrentTask = taskByUniqueName;
            }
            catch
            {
            }
        }
コード例 #7
0
        //开始编辑
        private void btnStartEdit_Click(object sender, EventArgs e)
        {
            label1.Visible      = true;
            cmbSelLayer.Visible = true;
            button1.Visible     = true;
            ChangeButtonState(true);
            plstLayers = MapManager.GetLayers(axMap.Map);
            for (int i = 0; i < plstLayers.Count; i++)
            {
                cmbSelLayer.Items.Add(plstLayers[i].Name);
            }

            try
            {
                if (plstLayers == null || plstLayers.Count == 0)
                {
                    MessageBox.Show("请加载编辑图层!", "提示",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                pMap.ClearSelection();
                pActiveView.Refresh();
                InitComboBox(plstLayers);
                ChangeButtonState(true);
                //如果编辑已经开始,则直接退出
                if (pEngineEditor.EditState != esriEngineEditState.esriEngineStateNotEditing)
                {
                    return;
                }
                if (pCurrentLyr == null)
                {
                    return;
                }
                //获取当前编辑图层工作空间
                IDataset   pDataSet = pCurrentLyr.FeatureClass as IDataset;
                IWorkspace pWs      = pDataSet.Workspace;
                //设置编辑模式,如果是ArcSDE采用版本模式
                if (pWs.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
                {
                    pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
                }
                else
                {
                    pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeNonVersioned;
                }
                //设置编辑任务
                pEngineEditTask           = pEngineEditor.GetTaskByUniqueName("ControlToolsEditing_CreateNewFeatureTask");
                pEngineEditor.CurrentTask = pEngineEditTask; // 设置编辑任务
                pEngineEditor.EnableUndoRedo(true);          //是否可以进行撤销、恢复操作
                pEngineEditor.StartEditing(pWs, pMap);       //开始编辑操作
            }
            catch (Exception ex)
            {
            }
        }
コード例 #8
0
        /// <summary>
        /// 开始编辑按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStartEdit_Click(object sender, EventArgs e)
        {
            try
            {
                mEngineEditor     = new EngineEditorClass();
                mEngineEditTask   = mEngineEditor as IEngineEditTask;
                mEngineEditLayers = mEngineEditor as IEngineEditLayers;
                mMap        = MainMapControl.Map;
                mActiveView = mMap as IActiveView;
                mlistLayers = MapOperation.GetLayers(mMap);

                if (mlistLayers == null || mlistLayers.Count == 0)
                {
                    MessageBox.Show("请加载编辑图层!", "提示",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                mMap.ClearSelection();
                mActiveView.Refresh();
                InitComboBox(mlistLayers);
                ChangeButtonState(true);

                // 如果编辑已经开始,则直接退出
                if (mEngineEditor.EditState != esriEngineEditState.esriEngineStateNotEditing)
                {
                    return;
                }
                if (mCurrentLyr == null)
                {
                    return;
                }
                // 获取当前编辑图层工作空间
                IDataset   dataset   = mCurrentLyr.FeatureClass as IDataset;
                IWorkspace workspace = dataset.Workspace;
                // 设置编辑模式,如果是ArcSDE采用版本模式
                if (workspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
                {
                    mEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
                }
                else
                {
                    mEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeNonVersioned;
                }
                // 设置编辑任务
                mEngineEditTask           = mEngineEditor.GetTaskByUniqueName("ControlToolsEditing_CreateNewFeatureTask");
                mEngineEditor.CurrentTask = mEngineEditTask;
                //是否可以进行撤销、恢复操作
                mEngineEditor.EnableUndoRedo(true);
                //开始编辑操作
                mEngineEditor.StartEditing(workspace, mMap);
            }
            catch (Exception ex)
            {
            }
        }
コード例 #9
0
        //开始编辑
        private void btnStart_Click(object sender, EventArgs e)
        {
            try
            {
                if (pCurrentLyr == null)
                {
                    MessageBox.Show("请选择编辑图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                setEditToolEnable(true);
                //如果编辑已经开始,则直接退出
                if (pEngineEditor.EditState != esriEngineEditState.esriEngineStateNotEditing)
                {
                    return;
                }
                if (pCurrentLyr == null)
                {
                    return;
                }
                //获取当前编辑图层工作空间
                pDataSet                  = pCurrentLyr.FeatureClass as IDataset;
                pWs                       = pDataSet.Workspace;
                pEngineEditTask           = pEngineEditor.GetTaskByUniqueName("ControlToolsEditing_CreateNewFeatureTask");
                pEngineEditor.CurrentTask = pEngineEditTask; // 设置编辑任务
                pEngineEditor.EnableUndoRedo(true);          //是否可以进行撤销、恢复操作
                //设置编辑模式,如果是ArcSDE采用版本模式
                if (pWs.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
                {
                    IVersionedObject3 versionedObject = pDataSet as IVersionedObject3;
                    //注册版本
                    if (versionedObject != null && !versionedObject.IsRegisteredAsVersioned)
                    {
                        versionedObject.RegisterAsVersioned(true);
                    }
                    pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
                }
                //else
                //{
                //    pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeNonVersioned;
                //}
                //设置编辑任务
                pEngineEditor.StartEditing(pWs, pMap);
                isEditing = true;
                //SysLogHelper.WriteOperationLog("数据编辑", "开始编辑", "数据管理");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                PS.Plot.Common.LogHelper.WriteLog(typeof(Form_Editor), ex, "开始编辑");
            }
        }
コード例 #10
0
 private void frmMain_Load(object sender, EventArgs e)
 {
     //地图标注
     m_mapControl = (IMapControl3)axMapControl1.Object;
     //设置伙伴控件关系
     axTOCControl1.SetBuddyControl(axMapControl1);
     axToolbarControl1.SetBuddyControl(axMapControl1);
     //调用操作函数,设置“编辑”菜单的状态
     ChangeButtonState(true);
     //“编辑”菜单变量实例化
     engineEditor            = new EngineEditorClass();
     MapManager.EngineEditor = engineEditor;
     engineEditTask          = engineEditor as IEngineEditTask;
     engineEditLayers        = engineEditor as IEngineEditLayers;
     //定制工具条
     CreateCustomizeDialog();
 }
コード例 #11
0
        private void cmdReshape_Click(object sender, EventArgs e)
        {
            IEngineEditTask edittask = m_engineEditor.GetTaskByUniqueName("ReshapePolylineEditTask_Reshape Polyline_CSharp");

            if (edittask != null)
            {
                m_engineEditor.CurrentTask   = edittask;
                axReshapeToolbar.CurrentTool = axReshapeToolbar.GetItem(0).Command as ITool;

                SetButtonColors(sender as Button);
                txtInfo.Text = "";
                label1.Text  = "";
                this.flowLayoutPanel1.Controls.Clear();
                this.flowLayoutPanel1.Controls.Add(axReshapeToolbar);
                this.flowLayoutPanel2.Controls.Clear();
                this.flowLayoutPanel2.Controls.Add(axUndoRedoToolbar);
            }
        }
コード例 #12
0
        private void cmdModify_Click(object sender, EventArgs e)
        {
            IEngineEditTask edittask = m_engineEditor.GetTaskByUniqueName("ControlToolsEditing_ModifyFeatureTask");

            if (edittask != null)
            {
                m_engineEditor.CurrentTask  = edittask;
                axModifyToolbar.CurrentTool = axModifyToolbar.GetItem(0).Command as ITool;

                SetButtonColors(sender as Button);
                txtInfo.Text = "";
                label1.Text  = "";
                this.flowLayoutPanel1.Controls.Clear();
                this.flowLayoutPanel1.Controls.Add(axModifyToolbar);
                this.flowLayoutPanel2.Controls.Clear();
                this.flowLayoutPanel2.Controls.Add(axUndoRedoToolbar);
            }
        }
コード例 #13
0
        private void menuStartEdit_Click(object sender, EventArgs e)
        {
            map        = axMapControl1.Map;
            activeView = map as IActiveView;
            if (axMapControl1.Map.LayerCount == 0)
            {
                MessageBox.Show("请加载编辑图层", "提示", MessageBoxButtons.OK);
                return;
            }
            map.ClearSelection();
            activeView.Refresh();
            //调用操作函数,将“开始编辑”设置为非激活状态,其他子菜单项设置为激活状态
            ChangeButtonState(false);
            //初始化“图层选择”
            menuSelectLayer.Items.Clear();
            for (int i = 0; i < axMapControl1.LayerCount; i++)
            {
                menuSelectLayer.Items.Add(axMapControl1.Map.get_Layer(i).Name);
            }
            //默认选择顶层图层
            if (menuSelectLayer.Items.Count != 0)
            {
                menuSelectLayer.SelectedIndex = 0;
            }
            //获取当前编辑图层工作空间
            IDataset   dataSet   = currentLayer.FeatureClass as IDataset;
            IWorkspace workspace = dataSet.Workspace;

            //设置编辑模式,如果是ArcSDE采用版本模式
            if (workspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
            {
                engineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
            }
            else
            {
                engineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeNonVersioned;
            }
            //设置编辑任务
            engineEditTask           = engineEditor.GetTaskByUniqueName("ControlToolsEditing_CreateNewFeatureTask");
            engineEditor.CurrentTask = engineEditTask;
            engineEditor.EnableUndoRedo(true);         //是否可以进行撤销、恢复操作
            engineEditor.StartEditing(workspace, map); //开始编辑操作
        }
コード例 #14
0
        public void Activate(IEngineEditor editor, IEngineEditTask oldTask)
        {
            //throw new NotImplementedException();

            if (editor == null)
            {
                return;
            }
            pEngineEditor            = editor;
            pEditSketch              = editor as IEngineEditSketch;
            pEditSketch.GeometryType = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline;

            pEditLayer = pEditSketch as IEngineEditLayers;
            //

            ((IEngineEditEvents_Event)pEditSketch).OnTargetLayerChanged += new IEngineEditEvents_OnTargetLayerChangedEventHandler(OnTargetLayerChanged);

            ((IEngineEditEvents_Event)pEditSketch).OnCurrentTaskChanged += new IEngineEditEvents_OnCurrentTaskChangedEventHandler(OnCurrentTaskChanged);
        }
コード例 #15
0
        private void InitObject()
        {
            try
            {
                ChangeButtonState(false);
                pEngineEditor           = new EngineEditorClass();
                MapManager.EngineEditor = pEngineEditor;
                pEngineEditTask         = pEngineEditor as IEngineEditTask;
                pEngineEditLayers       = pEngineEditor as IEngineEditLayers;

                mMap = axMap.Map;

                //Server server = new Server();
                //server.handler += handleMessage;
                //server.start();
            }
            catch (Exception ex)
            {
            }
        }
コード例 #16
0
ファイル: FormVertexList.cs プロジェクト: 605258778/GISData
 private void DeletePoint()
 {
     try
     {
         DataRow focusedDataRow = this.gridView1.GetFocusedDataRow();
         if (focusedDataRow != null)
         {
             int i             = Convert.ToInt32(focusedDataRow[0]);
             int selectedIndex = this.listPart.SelectedIndex;
             if (selectedIndex >= 0)
             {
                 IGeometryCollection geometry = this.m_Geometry as IGeometryCollection;
                 IPointCollection    points   = geometry.get_Geometry(selectedIndex) as IPointCollection;
                 IPoint data = points.get_Point(i);
                 points.RemovePoints(i, 1);
                 IEngineSketchOperation operation = new EngineSketchOperationClass();
                 operation.Start(Editor.UniqueInstance.EngineEditor);
                 operation.SetMenuString("Delete Vertex");
                 esriEngineSketchOperationType esriEngineSketchOperationVertexDeleted = esriEngineSketchOperationType.esriEngineSketchOperationVertexDeleted;
                 object missing = System.Type.Missing;
                 object before  = new object();
                 before = selectedIndex;
                 geometry.RemoveGeometries(selectedIndex, 1);
                 geometry.AddGeometry(points as IGeometry, ref before, ref missing);
                 operation.Finish(null, esriEngineSketchOperationVertexDeleted, data);
                 Editor.UniqueInstance.FinishSketch();
                 IEngineEditTask taskByUniqueName = Editor.UniqueInstance.EngineEditor.GetTaskByUniqueName("ControlToolsEditing_ModifyFeatureTask");
                 Editor.UniqueInstance.EngineEditor.CurrentTask = taskByUniqueName;
                 int index = this.listPart.SelectedIndex;
                 if (index >= 0)
                 {
                     this.ShowPointList(index);
                 }
             }
         }
     }
     catch
     {
     }
 }
コード例 #17
0
ファイル: ToolSplitLine.cs プロジェクト: eglrp/TESTPROJECT-1
        /// <summary>
        /// Occurs when this tool is clicked
        /// </summary>
        public override void OnClick()
        {
            // TODO: Add ToolSplitLine.OnClick implementation
            //Find the Modify Feature task and set it as the current task
            IEngineEditTask editTask = m_engineEditor.GetTaskByUniqueName("ControlToolsEditing_ModifyFeatureTask");

            m_engineEditor.CurrentTask = editTask;

            IEngineEditLayers editLayers = m_editLayer;

            snapEnvironment = m_engineEditor as IEngineSnapEnvironment;
            pt = new PointClass();
            //Check the user is editing; otherwise, there will be no snap agent loaded.
            if (editLayers.TargetLayer == null)
            {
                System.Windows.Forms.MessageBox.Show("Please start an edit session");
                return;
            }

            ////Create a feature snap agent.
            IEngineFeatureSnapAgent featureSnapAgent  = new EngineFeatureSnap();
            IFeatureClass           layerFeatureClass = editLayers.TargetLayer.FeatureClass;

            featureSnapAgent.FeatureClass = layerFeatureClass;
            featureSnapAgent.HitType      = esriGeometryHitPartType.esriGeometryPartBoundary;

            //Activate only the snap agent for the target layer.
            snapEnvironment.AddSnapAgent(featureSnapAgent);
            pMPfeedback         = new MovePointFeedbackClass();
            pMPfeedback.Display = m_hookHelper.ActiveView.ScreenDisplay;
            pMPfeedback.Start(pt, pt);

            IToolbarBuddy toolbarbuddy = (IToolbarBuddy)((IToolbarControl)m_hookHelper.Hook).Buddy;

            oldtool = toolbarbuddy.CurrentTool;
        }
        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            pEngineEditor = new EngineEditorClass();
            MapManagement.EngineEditor = pEngineEditor;
            pEngineEditTask            = pEngineEditor as IEngineEditTask;
            pEngineEditLayers          = pEngineEditor as IEngineEditLayers;

            pMap        = Variable.pMapFrm.mainMapControl.Map;
            pActiveView = pMap as IActiveView;
            pLayerlist  = MapManagement.GetMapLayers(pMap);
            try
            {
                if (pLayerlist == null || pLayerlist.Count == 0)
                {
                    MessageBox.Show("请在主视图中加载编辑图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                for (int i = 0; i < pLayerlist.Count; i++)
                {
                    ((DevExpress.XtraEditors.Repository.RepositoryItemComboBox) this.barEditItem1.Edit).Items.Add(pLayerlist[i].Name);
                }
                this.barEditItem1.EditValue = ((DevExpress.XtraEditors.Repository.RepositoryItemComboBox) this.barEditItem1.Edit).Items[0];

                pMap.ClearSelection();
                pActiveView.Refresh();
                //设置数据管理中要素管理未开始编辑状态,图层选择、添加要素、选择编辑要素、要素属性编辑、结束编辑等功能变成正常状态,使得可以操作。
                barEditItem1.Enabled    = true;
                barButtonItem12.Enabled = true;
                barButtonItem14.Enabled = true;
                barButtonItem13.Enabled = true;
                barButtonItem15.Enabled = true;
                barButtonItem4.Enabled  = true;
                barButtonItem20.Enabled = true;
                barButtonItem22.Enabled = true;
                barButtonItem21.Enabled = true;
                barButtonItem23.Enabled = true;
                if (pEngineEditor.EditState != esriEngineEditState.esriEngineStateNotEditing)
                {
                    return;
                }
                if (pCurrentLayer == null)
                {
                    return;
                }

                IDataset   pDataSet   = pCurrentLayer.FeatureClass as IDataset;
                IWorkspace pWorkspace = pDataSet.Workspace;
                if (pWorkspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
                {
                    pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
                }
                else
                {
                    pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
                }
                pEngineEditTask           = pEngineEditor.GetTaskByUniqueName("ControlToolsEditing_CreateNewFeatureTask");
                pEngineEditor.CurrentTask = pEngineEditTask;
                pEngineEditor.EnableUndoRedo(true);
                pEngineEditor.StartEditing(pWorkspace, pMap);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n" + ex.ToString(), "异常");
            }
        }
コード例 #19
0
ファイル: DeleteVertex.cs プロジェクト: 605258778/GISData
        public override void OnClick()
        {
            IEngineEditTask taskByUniqueName = Editor.UniqueInstance.EngineEditor.GetTaskByUniqueName("ControlToolsEditing_ModifyFeatureTask");

            Editor.UniqueInstance.EngineEditor.CurrentTask = taskByUniqueName;
        }