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);获取就可以了。两个相邻的就成一个了。