其他分享
首页 > 其他分享> > ArcEngine开启编辑功能的三种方法

ArcEngine开启编辑功能的三种方法

作者:互联网

使用IWorkSpaceEdit

 1 //获取要素图层
 2 IFeatureLayer pFeatureLayer=ArcMap.Document.FocusMap.get_Layer(0) as IFeatureLayer;
 3 IDataset pDataset = pFeatureLayer.FeatureClass as IDataset;
 4 IWorkspace pWs = pDataset.Workspace;
 5 IWorkspaceEdit pWorkspaceEdit = pWs as IWorkspaceEdit;
 6 
 7 //开始编辑
 8 pWorkspaceEdit.StartEditing(true);
 9 pWorkspaceEdit.StartEditOperation();
10 
11 //其他操作....
12 
13 //结束编辑
14 pWorkspaceEdit.StopEditOperation();
15 pWorkspaceEdit.StopEditing(true);

使用IEngineEditor

 1 IEngineEditor pEngineEditor = new EngineEditorClass();
 2 IDataset pDataset = pFeatureLayer.FeatureClass as IDataset;
 3 IWorkspace pWs = pDataset.Workspace;
 4 
 5 pEngineEditor.StartEditing(pWs, pMap);
 6 IEngineEditLayers pEngineEditorLayers =pEngineEditor as IEngineEditLayers;
 7 pEngineEditorLayers.SetTargetLayer(pFeatureLayer, 0);
 8 IEngineEditTask pEngineEditTask = pEngineEditor.GetTaskByUniqueName("ControlToolsEditing_ModifyFeatureTask");
 9 pEngineEditor.CurrentTask = pEngineEditTask;
10 
11 pEngineEditor.StopEditing(true);

使用editor编辑器工具

1 ICommand startCommand = new ControlsEditingStartCommand();
2 startCommand.OnCreate(this.Hook);
3 startCommand.OnClick();

 

标签:IDataset,pWs,pFeatureLayer,pWorkspaceEdit,开启,pDataset,三种,pEngineEditor,ArcEngine
来源: https://www.cnblogs.com/King2019Blog/p/10476000.html