delphi
function CreatePolygonfromRing(ExRing: IRing): IGeoMetry;
var
newSegCol, SegCol : ISegmentCollection;
PPolygon : IPolygon;
begin
SegCol := ExRing as ISegmentCollection;
PPolygon := CoPolygon.Create as IPolygon;
newSegCol := PPolygon as ISegmentCollection;
newSegCol.AddSegmentCollection(SegCol);
result := PPolygon as IGeoMetry;
end;
C#代码
public static IGeometry CreatePolygonfromRing(IRing ExRing)
{
ISegmentCollection SegCol= ExRing as ISegmentCollection;
IPolygon PPolygon =new PolygonClass();
ISegmentCollection newSegCol = PPolygon as ISegmentCollection;
newSegCol.AddSegmentCollection(SegCol);
return PPolygon as IGeometry;
}