在ArcGIS10中AO编辑操作
分享
在ArcGIS10中AO进行编辑出现了颠覆性的改变,一改以前版本的编辑工具、编辑任务,而是通过模版和图层关联进行编辑操作。其中涉及到IEditTemplate,正是由这个IEditTemplate的接口来实现地图的编辑操作,那么如何进行编辑操作呢?首先需要取到IEditor3接口的实例和IEditTemplate接口的实例。下面代码将展示如何获得这两个接口的实例
privateIApplication m_application; private IEditor3 m_editor;
m_application =ArcMap.Application;
UID editorUid =new UID(); editorUid.Value = “esriEditor.Editor”; m_editor = m_application.FindExtensionByCLSID(editorUid) as IEditor3; m_editTemplate = m_editor.CurrentTemplate;
if(m_editTemplate == null) { //Create a single template forthe selected layer. ILayer editLayer =m_document.SelectedLayer; IEditTemplateFactoryeditTemplateFact = new EditTemplateFactoryClass(); IEditTemplatenewEditTemplate = editTemplateFact.Create(“Building”, m_featurelayer); m_editTemplate =newEditTemplate; //Add thetemplate. IArraytemplateArray = new ArrayClass(); templateArray.Add(m_editTemplate); m_editor.AddTemplates(templateArray); m_editor.CurrentTemplate= m_editTemplate; }
此时编辑模版将被获得并且与FeatureLayer相关联就可以进行编辑操作了,添加点要素,然后对新添加的点要素进行高亮显示
IPoint pt = new PointClass(); pt.X = 123.3456; pt.Y = 41.3456; IFeature m_feature = m_featureclass.CreateFeature(); m_feature.Shape = pt; m_editTemplate.SetDefaultValues(m_feature); m_feature.Store(); m_document.FocusMap.SelectFeature(m_featurelayer, m_feature); m_document.ActiveView.Refresh();
从以上代码中我们可以看出,这种操作与ArcGIS9中的AO操作截然不同,是两种模式。
文章来源:http://blog.csdn.net/sydbc/article/details/17791117
privateIApplication m_application; private IEditor3 m_editor;
m_application =ArcMap.Application;
UID editorUid =new UID(); editorUid.Value = “esriEditor.Editor”; m_editor = m_application.FindExtensionByCLSID(editorUid) as IEditor3; m_editTemplate = m_editor.CurrentTemplate;
if(m_editTemplate == null) { //Create a single template forthe selected layer. ILayer editLayer =m_document.SelectedLayer; IEditTemplateFactoryeditTemplateFact = new EditTemplateFactoryClass(); IEditTemplatenewEditTemplate = editTemplateFact.Create(“Building”, m_featurelayer); m_editTemplate =newEditTemplate; //Add thetemplate. IArraytemplateArray = new ArrayClass(); templateArray.Add(m_editTemplate); m_editor.AddTemplates(templateArray); m_editor.CurrentTemplate= m_editTemplate; }
此时编辑模版将被获得并且与FeatureLayer相关联就可以进行编辑操作了,添加点要素,然后对新添加的点要素进行高亮显示
IPoint pt = new PointClass(); pt.X = 123.3456; pt.Y = 41.3456; IFeature m_feature = m_featureclass.CreateFeature(); m_feature.Shape = pt; m_editTemplate.SetDefaultValues(m_feature); m_feature.Store(); m_document.FocusMap.SelectFeature(m_featurelayer, m_feature); m_document.ActiveView.Refresh();
从以上代码中我们可以看出,这种操作与ArcGIS9中的AO操作截然不同,是两种模式。
文章来源:http://blog.csdn.net/sydbc/article/details/17791117
0 个评论
相关问题
- 安装完arcgis10.3后,为何没有Envi tools这个工具箱?
- arcgis10.2有时候无法复制粘贴要素
- ArcGIS10.2线图层分割面图层
- 微信页面 arcgis api 地图无法操作
- arcgis10.4 离线部署js api 4.3 版本 无法显示
- 市区择房分析时,需要添加字段并将其赋值1或者-1,怎么做? 在开始编辑的时候,总是出现空间参考与数据框不匹配提示,原因是什么?会影响下面的赋值吗?
- ArcGIS10.5配置data store时报错Unable to configure the ArcGIS Data Store with the GIS Server.
- Arcgis10.4 创建企业级地理数据库 “用户不具有创建数据库对象的必要权限 ”
- arcgis10.2打开arcgis10.6的mxd文档
- 如何用arcgis 编辑DEM 空洞?
- 属性表没开开始编辑用计算字段器不小心改动了全部数据,无法返回上一步了,有恢复改动之前的办法吗?