ArcEngine组合选中相邻图形

1、获取选中图形:ISelectionSet pSelSet = (pFeaLyr as IFeatureSelection).SelectionSet;

        pSelSet.Search(null, false, out pCursor);
                              IFeatureCursor pFeaCursor = pCursor as IFeatureCursor;

2、利用Union工具组合所有图形

            IGeometryBag pGeoBag = new GeometryBagClass();
            IGeometryCollection pGeoCol = pGeoBag as IGeometryCollection;

3、判断是否为外环图形:

                    IPolygon pGeoPolygon = pGeometry as IPolygon;
                    int iExRingsCnt = pGeoPolygon.ExteriorRingCount;
                    if (iExRingsCnt > 0)

4、将组合图形转换为:IGeometryBag pExRings = (pGeometry as IPolygon4).ConnectedComponentBag;

IGeometryBag 继承与IGeometry

5、IGeometry pGeoNew = (pExRings as IGeometryCollection).get_Geometry(i);获取就可以了。两个相邻的就成一个了。

posted @ 2014-12-04 15:25  静以养身 俭以养德  阅读(434)  评论(0编辑  收藏  举报