ArcEngine判断要素(feature)是否为multipart feature及分解(炸开)代码
转自原文 ArcEngine判断要素(feature)是否为multipart feature及分解(炸开)代码
#region 校验合法性
ArrayList pFeatureArray = null;
pFeatureArray = Application.Editor.FeatureSelection();
int count=pFeatureArray.Count;
if (count<)
{
MessageBox.Show("最少必须选择1个要素才能进行要素分解!", "提示");
return;
}
#endregion
try
{
//启动编辑操作
Application.Editor.StartOperation();
#region 对选中的要素进行多部件测试及分解
int multipartcount = ;
for (int i = ; i < count; i++)
{
IFeature pFeature = pFeatureArray as IFeature;
if (pFeature.ShapeCopy.IsEmpty) continue;
IGeometry pGeometry = pFeature.ShapeCopy;
IGeometryCollection pGeocoll = pGeometry as IGeometryCollection;
int geomcount = pGeocoll.GeometryCount;
if (geomcount > )
{
multipartcount++;
for (int k = ; k < geomcount; k++)
{
IFeature newFeaturte = (pFeature.Class as IFeatureClass).CreateFeature();
IFeatureEdit pFeatureEdit = pFeature as IFeatureEdit;
pFeatureEdit.SplitAttributes(newFeaturte);
IGeometry newGeom = pGeocoll.get_Geometry(k);
if (pFeature.ShapeCopy.GeometryType == esriGeometryType.esriGeometryPolygon)
newGeom=GeometryHelper.ConstructPolygon(newGeom);
else
newGeom = GeometryHelper.ConstructPolyline(newGeom);
newGeom.SpatialReference = pFeature.ShapeCopy.SpatialReference;
newFeaturte.Shape = newGeom;
newFeaturte.Store();
} IGeometry newGeom2 = pGeocoll.get_Geometry();
if (pFeature.ShapeCopy.GeometryType == esriGeometryType.esriGeometryPolygon)
newGeom2 = GeometryHelper.ConstructPolygon(newGeom2);
else
newGeom2 = GeometryHelper.ConstructPolyline(newGeom2);
newGeom2.SpatialReference = pFeature.ShapeCopy.SpatialReference;
pFeature.Shape = newGeom2;
pFeature.Store();
Application.Editor.StopOperation("分解多部件要素");
}
else
{
continue;
}
}
if (multipartcount == )
{
MessageBox.Show("未选择多部件要素!", "分解要素");
return;
} #endregion
}
catch (Exception ex)
{
Application.Editor.AbortOperation();
MessageHelper.WriteLog("分解多部件要素", ex);
}
finally
{
Application.ActiveView.Refresh();
FlashFeatures();
}
ArcEngine判断要素(feature)是否为multipart feature及分解(炸开)代码的更多相关文章
- arcengine新建要素类
ArcGIS里面新建数据集,看起来简单,平时都是默认创建,实际上好多细节问题我们都没注意到 一.在数据集上新建要素类: How to create a feature class within a f ...
- Arcengine 实现要素选取的方法(转载)
转自原文Arcengine 实现要素选取的方法(转载) 选择一个要素或者一个要素集(FeatureSelection)的方法很多,如IMap::SelectByShape.ILayer::search ...
- ArcEngine 创建要素,删除要素,生成网格,渲染图层(VB)
示例代码:https://github.com/yu969890202/ArcEngine/tree/master/WinFrom_ArcEngine_PointDistribution博客后面有两张 ...
- ArcEngine创建要素类_线类型
public ESRI.ArcGIS.Geodatabase.IFeatureClass CreateFeatureClassForLine(ESRI.ArcGIS.Geodatabase.IWork ...
- 【225】ArcEngine 实现要素添加 & 删除
参考:ArcGIS Engine效率探究——要素的添加和删除.属性的读取和更新 删除要素 //添加图层,显示在最上面 axMapControl1.AddShapeFile(@"D:\01-业 ...
- ArcEngine获取要素数据集的容差和分辨率
/// <summary> /// 根据数据集获取容差 /// </summary> /// <param name="dataset">< ...
- Java判断一个字符是否是数字的几种方法的代码
在工作期间,将写内容过程经常用到的一些内容段做个记录,下面内容是关于Java判断一个字符是否是数字的几种方法的内容,希望能对码农们有好处. public class Test{ public stat ...
- 使用定时器判断确保某个标签有值才执行方法, 控制js代码执行先后顺序
使用定时器判断确保某个标签有值才执行方法: var wait = setInterval(function(){ var diqu = $("#diqu").val(); //确保 ...
- php中判断字符串是否全是中文或含有中文的实现代码
<?php header('Content-type:text/html; charset=utf-8'); $str = '你好'; if(preg_match('/^[\x{4e00}-\x ...
随机推荐
- PLSQL乱码&TNS-12557: protocol adapter not loadable解决
PLSQL乱码&TNS-12557: protocol adapter not loadable解决 PLSQL乱码&TNS-12557: protocol adapter not l ...
- Java遍历目录下全部文件并替换指定字符串
应用场景:比方有一个深层次的文件目录结构,如:javaAPI 每一个文件中面都有同样的内容,而我们要统一改动为其它内容.上千个文件假设一个个改动显得太不明智. import java.io.Buffe ...
- UITouch 的使用
直接上代码: touch 的四大状态.: // // TouchView.m // UI_practice_04 // // Created by lanouhn on 15/4/22. // Cop ...
- POJ 2828 线段树单点更新 离线搞
Description Railway tickets were difficult to buy around the Lunar New Year in China, so we must get ...
- ListView- 最后一行添加控件
今天在做一个功能的时候,要求必须是在一个listview下,有一段提示行的文字,自己的那个listview的adapter用的是cursoradapter,这样的话,处理布局的灵活性就大打折扣了.最开 ...
- HTTP协议建立连接、通讯与关闭连接全过程
为解决服务器TimeWait多的问题,了解了一下TCP/IP协议的连接过程.以访问一静态页面为例,从建立连接到访问拿到数据,然后关闭的整个过程.使用EtherPeek截图如下: 图首为一次交互过程 ...
- 2.技巧: 用 JAXM 发送和接收 SOAP 消息—Java API 使许多手工生成和发送消息方面必需的步骤自动化
转自:https://www.cnblogs.com/chenying99/archive/2013/05/23/3094128.html 技巧: 用 JAXM 发送和接收 SOAP 消息—Java ...
- mahout的特性(三)
mahout的特性 虽然在开源领域中相对较为年轻,但 Mahout 已经提供了大量功能,特别是在集群和CF 方面. Mahout 的主要特性包括: Taste CF.Taste 是 Sean Owen ...
- Android中Alarm的机制
本次给大家分析的是Android中Alarm的机制所用源码为最新的Android4.4.4.首先简单介绍如何使用Alarm并给出其工作原理,接着分析Alarm和Timer以及Handler在完成定时任 ...
- Flask项目之手机端租房网站的实战开发(四)
说明:该篇博客是博主一字一码编写的,实属不易,请尊重原创,谢谢大家! 接着上一篇博客继续往下写 :https://blog.csdn.net/qq_41782425/article/details/8 ...