您的位置:首页 > 编程语言 > C#

合并一个图层选择对象C# arcengine

2012-03-28 10:51 176 查看
ArcEngine实现Merge功能

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();
IPolygon sPoly = new PolygonClass();
ITopologicalOperator pTopo = sPoly as ITopologicalOperator;
pTopo.ConstructUnion(pGeos);
pTopo.Simplify();
sPoly = pTopo as IPolygon;
pflyrSelection.Clear();
return sPoly;
}

执行上面的代码段可以把图层上的所有实体合并。注意红色部分的那行代码,不写此行代码,pGeos 里的图形个数为0,最后得到的spoly是空。

来自:http://program.ntwtsp.com/aspnet/18234.htm
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐