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 ...
随机推荐
- 相对路径 System.Web HttpServerUtilityBase Server.MapPath("~/")
相对路径 System.Web HttpServerUtilityBase Server.MapPath("~/")
- JavaScript 进度条重复加载
<!DOCTYPE HTML> <html> <head> <meta charset ="utf-8"> <title> ...
- CODEVS——T1519 过路费
http://codevs.cn/problem/1519/ 时间限制: 1 s 空间限制: 256000 KB 题目等级 : 大师 Master 题解 查看运行结果 题目描述 Desc ...
- 洛谷 P1893 山峰暸望
P1893 山峰暸望 题目描述 一天,Bessie在眺望美丽的威斯康星的群山的时候,她突然产生了疑问:那座山是最宽的? 她决定在地平线上,利用她的新式大量程山峰高度测量仪依次做N (1 <= N ...
- socket UDP简单通讯
// // SocketUDPServerClient.m // socket_server_client // // Created by lujunjie on 2016/11/26. // Co ...
- HTTP请求报文、响应报文
HTTP请求报文 HTTP请求报文由3部分组成(请求行+请求头+请求体): 请求行:①是请求方法,GET和POST是最常见的HTTP方法,除此以外还包括DELETE.HEAD.OPTIONS.PUT. ...
- (JavaScript基础向)sort()方法里的排序函数的理解
比较常见的解释可以看这里:js的sort()方法,这篇博客写得挺好的,一般的应用的理解已经足够了. 但是如果要活用sort()方法里面的参数——也就是排序函数的话,可能就比较难理解了. 然后我就总结出 ...
- [selenium]选取下拉框内容的方法
说明:本文章主要是对select元素操作的讲解,非select元素的下拉框需要另外分析 1.select元素示例: 2.select下拉框选取的3种方法 WebElement selector = d ...
- amazeui学习笔记--css(HTML元素2)--代码Code
amazeui学习笔记--css(HTML元素2)--代码Code 一.总结 1.行内代码:code标签<code> 2.代码片段:pre标签<pre> 3.限制代码块高度:添 ...
- ACdream 1127 Base Station (离线查询+树状数组)
题目链接: http://acdream.info/problem?pid=1127 题目: 移动通信系统中,通信网的建立主要通过基站来完成. 基站可以分为主基站和子基站.子基站和各个移动用户进行连接 ...