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

1 使用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);

2使用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;

pEngineEditor.StopEditing(true);

3使用editor编辑器工具

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


转载自:https://blog.csdn.net/csu2015/article/details/77776519

You may also like...