1、如何开启编辑

IMap myMap = this._Aplication.ActiveView.FocusMap;
IWorkspace myWorkspace = (myMap25Sheet.PointFeatureLayer as IDataset).Workspace;
this._Aplication.EngineEditor.EnableUndoRedo(true);
this._Aplication.EngineEditor.StartEditing(myWorkspace, myMap);
this._Aplication.EngineEditor.StartOperation();

2、如何设置要编辑的目标图层
IEngineEditLayers myEngineEditLayers = this._Aplication.EngineEditor as IEngineEditLayers;
myEngineEditLayers.SetTargetLayer(myMap25Sheet.PointFeatureLayer, 0);

3、编辑的不符合规则,如何回退

IWorkspaceEdit myWorkspaceEdit = this._Application.EngineEditor.EditWorkspace as IWorkspaceEdit;
bool myHasUndo = false;
myWorkspaceEdit.HasUndos(ref myHasUndo);
if (myHasUndo == true)
{
IMap myMap = this._Application.ActiveView.FocusMap;
((IActiveView)myMap).PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
myMap.ClearSelection();
((IActiveView)myMap).PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
myWorkspaceEdit.UndoEditOperation();
this._Application.ActiveView.Refresh();
}

注意,一定要调用清空选择那块的代码,不然回退后,刷新下地图,又会重新回来,发现这个问题花了好长时间。

4、如何控制只能选择和编辑一个要素

private void EngineEditor_OnSelectionChanged()
{
Map25Sheet myMap25Sheet = this._Application.WorkZone.ActiveMap25Sheet;
if (myMap25Sheet == null)
{
this._Application.SamplePointInfoUI.SetPointFeature(null);
return;
}
IFeatureLayer myFeatureLayer = myMap25Sheet.PointFeatureLayer;
IFeatureSelection myFeatureSelection = myMap25Sheet.PointFeatureLayer as IFeatureSelection;
if (myFeatureSelection.SelectionSet.Count == 0)
{
this._Application.SamplePointInfoUI.SetPointFeature(null);
return;
}
int myID = myFeatureSelection.SelectionSet.IDs.Next();
if (myFeatureSelection.SelectionSet.Count > 1)
{
myFeatureSelection.Clear();
myFeatureSelection.SelectionSet.Add(myID);
}
this._Application.SamplePointInfoUI.SetPointFeature(myFeatureLayer.FeatureClass.GetFeature(myID));
this._Application.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
}
EngineEditor的OnSelectionChanged事件,在这控制下即可。

5、如何只编辑一个图层

控制其他图层不能不能被选择即可。

myFeatureLayer.Selectable = false;

6、ArcEngine中没有保存函数,如何保存编辑

先停止编辑,调用停止的时候,把是否保存参数设置为true,然后再重新开启即可。

最新文章

  1. ubuntu15:10 163源
  2. python base64的加密与解密
  3. docker基本操作
  4. 如何收缩超大的SharePoint_Config数据库
  5. ggplot2.multiplot:将多个图形使用GGPLOT2在同一页上
  6. BI
  7. python27+django1.9创建app的视图及实现动态页面
  8. 底部菜单栏(一) TabHost实现
  9. 关于ButterKnife 8.1.0使用遇到的问题
  10. GDKOI2016
  11. eclipse和myeclipse设置默认编码格式为UTF-8
  12. Redis Windows下查看版本号
  13. ubuntu使用抓包工具,charles
  14. window7 修改docker安装的machine 位置
  15. 关于json_encode转数组为json对象时里有数组格式数据的问题
  16. Java中加密算法介绍及其实现
  17. SQL8数据库定期自动备份
  18. sysbench的安装与简单使用
  19. scrapy-redis的使用与解析
  20. ConfigParser 读写配置文件

热门文章

  1. Windows 10 20H1 2004新功能
  2. setw()
  3. Git将本地仓库上传到github
  4. Kubernetes 配置管理
  5. MySQL8 二进制日志
  6. redhat替换yum源时redhat.repo无法删除或禁用的问题
  7. Docker安装集群rabbitMQ
  8. MySQL数据库-数据表(上)
  9. EasyExcel实现文件导入
  10. PAT (Basic Level) Practice 1007 素数对猜想 分数 20