首页 > 代码库 > Polyline转Polygon

Polyline转Polygon

IGeometry geo = feature.ShapeCopy;
IGeometryCollection pPolyline = geo as IGeometryCollection;

ISegmentCollection pRing;
IGeometryCollection pPolygon = new PolygonClass();
object ob = Type.Missing;
for (int i = 0; i < pPolyline.GeometryCount; i++)
{
pRing = new RingClass();
pRing.AddSegmentCollection(pPolyline.get_Geometry(i) as ISegmentCollection);
pPolygon.AddGeometry(pRing as IGeometry, ref ob, ref ob);
}