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 ...
随机推荐
- 洛谷 P3371 【模板】单源最短路径
P3371 [模板]单源最短路径 题目描述 如题,给出一个有向图,请输出从某一点出发到所有点的最短路径长度. 输入输出格式 输入格式: 第一行包含三个整数N.M.S,分别表示点的个数.有向边的个数.出 ...
- TimePickerDialog -下划线颜色修改
首先就是去framework下去找与之相关的theme属性 最开始的时候,直接找的是<item name="datePickerStyle">@style/Widget ...
- C#发送邮件DEMO
虽然网上有很多类似的DEMO,但是还是整个封装好的例子,以便以后用: 发送邮箱是直接在web.config配置的. protected void Button1_Click(object sender ...
- Codefroces 812 B. Sagheer, the Hausmeister
http://codeforces.com/problemset/problem/812/B B. Sagheer, the Hausmeister time limit per test 1 sec ...
- element-UI 表单校验失效处理
1.el-form-item 的 prop属性绑定的要是字符串: eg: :prop="'answer[' + 0 + ']' " //而不是 :prop=&qu ...
- ArcGIS小技巧——提取面要素的质心点
如下图,现在要做这样一件事,提取面图层中每一个图斑的质心点,然后使用质心点提取图层中的一个属性值,并在此基础上进行克里金插值,生成该属性的空间插值图.当然,今天这段文字主要简单说一下怎样提取面图层的质 ...
- Elasticsearch入门系列~通过Java一系列操作Elasticsearch
Elasticsearch索引的创建.数据的增删该查操作 上一章节已经在Linux系统上安装Elasticsearch并且可以外网访问,这节主要通过Java代码操作Elasticsearch 1.创建 ...
- 含有打印、统计DataGridView(1)
using System;using System.Collections.Generic;using System.Text;using System.Drawing.Printing;using ...
- JQuery map()函数
DOM.map(callback(index,domElement)); 对匹配元素执行函数对象. 返回值是 jQuery 封装的数组,使用 get() 来处理返回的对象以得到基础的数组. 返回数据类 ...
- Mongodb总结5-通过装饰模式,用Mongodb解决Hbase的不稳定问题
最近继续学习Mongodb的根本原因,是为了解决今天的问题.项目中用到了Hbase,生产环境服务器用了3台,但是不够稳定,每2天左右,就连不上了.重启就好了,当然,这是一个历史遗留问题.我在想,是不是 ...