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 ...
随机推荐
- android-pulltorefresh 下拉载入中使用gif动图
效果预览: xml布局 <com.handmark.pulltorefresh.library.PullToRefreshListView xmlns:android="http:// ...
- POJ 1101 The Game(BFS+判方向)
The Game Description One morning, you wake up and think: "I am such a good programmer. Why ...
- 重建一些被PHP7废弃的函数,
<?php if(!function_exists('ereg')) { function ereg($pattern, $subject, &$matches = []) { retu ...
- JavaFx lineChart real-time Monitor
JavaFx lineChart real-time Monitor about memory public class EffectTest extends Application { Stac ...
- 通俗理解vuex原理---通过vue例子类比
本文主要通过简单的理解来解释下vuex的基本流程,而这也是vuex难点之一. 首先我们先了解下vuex的作用 vuex其实是集中的数据管理仓库,相当于数据库mongoDB,MySQL等,任何组件都可以 ...
- JS match方法的返回数据的探究
match方法是JS的字符串方法,详细说明可以看MDN的说明. 如果正则表达式匹配成功的话,match方法会返回一个数组,而数组里的数据有两种形式,对应着匹配方式:全局匹配与非全局匹配. 1. 全局匹 ...
- BZOJ1009: [HNOI2008]GT考试(KMP+矩阵乘法)
Description 阿申准备报名参加GT考试,准考证号为N位数X1X2....Xn(0<=Xi<=9),他不希望准考证号上出现不吉利的数字.他的不吉利数学A1A2...Am(0< ...
- PYTHON学习第五天课后总结:
今日重点: 数字类型 字符串类型 列表类型 元组类型 1,数字类型 数字类型为不可变类型 也只能将纯数字类型的字符串转换成int包括: 整型: int() int() 为内置函数,可 ...
- 【Educational Codeforces Round 35 A】 Nearest Minimums
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 找出最小的数字的位置. 最近的肯定是相邻的某对. [代码] #include <bits/stdc++.h> using ...
- [Python] Different ways to test multiple flags at once in Python
x, y, z = 0, 1, 0 if x == 1 or y == 1 or z == 1: print('passed') if 1 in (x, y, z): print('passed') ...