ArcEngine实现图层地物合并的简单方法
2013-12-08 17:36
537 查看
private IGeometry GetGeo(IFeatureLayer pFlyr)
{
IEnumGeometry pGeos = new EnumFeatureGeometryClass();
IEnumGeometryBind pGeosBind = pGeos as IEnumGeometryBind;
IFeatureSelection pflyrSelection = pFlyr as IFeatureSelection;
pflyrSelection.SelectFeatures(null,esriSelectionResultEnum.esriSelectionResultNew, false); pGeosBind.BindGeometrySource(null, pflyrSelection.SelectionSet);
pGeos.Reset();
IPolygonsPoly = new PolygonClass();
ITopologicalOperator pTopo = sPoly as ITopologicalOperator;
pTopo.ConstructUnion(pGeos);
pTopo.Simplify();
sPoly =pTopo as IPolygon;
pflyrSelection.Clear();
returnsPoly;
}
执行上面的代码段可以把图层上的所有实体合并。注意红色部分的那行代码,不写此行代码,pGeos
里的图形个数为0,最后得到的spoly是空。
{
IEnumGeometry pGeos = new EnumFeatureGeometryClass();
IEnumGeometryBind pGeosBind = pGeos as IEnumGeometryBind;
IFeatureSelection pflyrSelection = pFlyr as IFeatureSelection;
pflyrSelection.SelectFeatures(null,esriSelectionResultEnum.esriSelectionResultNew, false); pGeosBind.BindGeometrySource(null, pflyrSelection.SelectionSet);
pGeos.Reset();
IPolygonsPoly = new PolygonClass();
ITopologicalOperator pTopo = sPoly as ITopologicalOperator;
pTopo.ConstructUnion(pGeos);
pTopo.Simplify();
sPoly =pTopo as IPolygon;
pflyrSelection.Clear();
returnsPoly;
}
执行上面的代码段可以把图层上的所有实体合并。注意红色部分的那行代码,不写此行代码,pGeos
里的图形个数为0,最后得到的spoly是空。
相关文章推荐
- 实现两有序数组的合并仍为新有序数组,且不对新数组排序的最简单方法
- 在ArcEngine下实现图层属性过滤的两种方法 转载http://www.gisall.com/html/72/124272-2990.html
- C#实现简单合并word文档的方法
- JavaScript简单实现合并两个Json对象的方法示例
- 在ArcEngine下实现图层属性过滤的两种方法
- PHP简单实现合并2个数字键数组值的方法
- 在ArcEngine下实现图层属性过滤的两种方法
- 在ArcEngine下实现图层属性过滤的两种方法
- 在ArcEngine下实现图层属性过滤的两种方法
- Django实现简单分页功能的方法详解
- 【10】coco2d-x CCTextFieldTTF最简单的方法实现密码登陆“*”
- VC中实现文字竖排的简单方法
- 用C++实现七种排序算法,可选择排序方法,简单易懂。
- PHP合并数组的简单方法与array_merge()
- php单例模式的简单实现方法
- MYSQL数据库主从复制的简单原理及实现方法
- 移动端左右滑动的导航的简单实现方法
- LAMP的一个简单实现方法
- Android 有道词典的简单实现方法介绍
- 安卓动画的简单实现方法(Animation和AnimationDrawable)