ArcGIS Engine实现图层地物合并的简单方法

0
分享 2015-06-17
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是空。

文章来源:http://blog.csdn.net/sydbc/article/details/17202323

0 个评论

要回复文章请先登录注册