Loading

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

使用IWorkSpaceEdit

//获取要素图层
IFeatureLayer pFeatureLayer=ArcMap.Document.FocusMap.get_Layer(0) as IFeatureLayer;
IDataset pDataset = pFeatureLayer.FeatureClass as IDataset;
IWorkspace pWs = pDataset.Workspace;
IWorkspaceEdit pWorkspaceEdit = pWs as IWorkspaceEdit;

//开始编辑
pWorkspaceEdit.StartEditing(true);
pWorkspaceEdit.StartEditOperation();

//其他操作....
 
//结束编辑
pWorkspaceEdit.StopEditOperation();
pWorkspaceEdit.StopEditing(true);

使用IEngineEditor

IEngineEditor pEngineEditor = new EngineEditorClass();
IDataset pDataset = pFeatureLayer.FeatureClass as IDataset;
IWorkspace pWs = pDataset.Workspace;

pEngineEditor.StartEditing(pWs, pMap);
IEngineEditLayers pEngineEditorLayers =pEngineEditor as IEngineEditLayers;
pEngineEditorLayers.SetTargetLayer(pFeatureLayer, 0);
IEngineEditTask pEngineEditTask = pEngineEditor.GetTaskByUniqueName("ControlToolsEditing_ModifyFeatureTask");
pEngineEditor.CurrentTask = pEngineEditTask;
11 pEngineEditor.StopEditing(true);

使用editor编辑器工具

ICommand startCommand = new ControlsEditingStartCommand();
startCommand.OnCreate(this.Hook);
startCommand.OnClick();
posted @ 2019-08-02 11:17  F(x)_King  阅读(934)  评论(0编辑  收藏  举报