ArcObjects Library Reference (Geometry)  

IPolygon4.ExteriorRingBag Property

Creates and returns a geometry bag that contains references to all exterior rings.

[Visual Basic .NET]
Public ReadOnly Property ExteriorRingBag As IGeometryBag
[C#]
public IGeometryBag ExteriorRingBag {get;}
[C++]
HRESULT get_ExteriorRingBag(
  IGeometryBag** ringBag
);
[C++]

Parameters

ringBag [out, retval]

  ringBag is a parameter of type IGeometryBag

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.
[C#]

        public static void PolygonToString(IPolygon4 polygon)

        {

               IGeometryBag exteriorRingGeometryBag = polygon.ExteriorRingBag;

 

               IGeometryCollection exteriorRingGeometryCollection = exteriorRingGeometryBag as IGeometryCollection;

 

               Trace.WriteLine("polygon.ExteriorRingCount = " + exteriorRingGeometryCollection.GeometryCount);

 

               for (int i = 0; i < exteriorRingGeometryCollection.GeometryCount; i++)

               {

                      Trace.WriteLine("polygon.ExteriorRing[" + i + "]");

 

                      IGeometry exteriorRingGeometry = exteriorRingGeometryCollection.get_Geometry(i);

 

                      IPointCollection exteriorRingPointCollection = exteriorRingGeometry as IPointCollection;

 

                      for (int j = 0; j < exteriorRingPointCollection.PointCount; j++)

                      {

                             Trace.WriteLine("Point[" + j + "] = " + PointToString(exteriorRingPointCollection.get_Point(j)));

                      }

 

                      IGeometryBag interiorRingGeometryBag = polygon.get_InteriorRingBag(exteriorRingGeometry as IRing);

 

                      IGeometryCollection interiorRingGeometryCollection = interiorRingGeometryBag as IGeometryCollection;

 

                      Trace.WriteLine("polygon.InteriorRingCount[exteriorRing" + i + "] = " + interiorRingGeometryCollection.GeometryCount);

 

                      for (int k = 0; k < interiorRingGeometryCollection.GeometryCount; k++)

                      {

                             Trace.WriteLine("polygon.InteriorRing[" + k + "]");

 

                             IGeometry interiorRingGeometry = interiorRingGeometryCollection.get_Geometry(k);

 

                             IPointCollection interiorRingPointCollection = interiorRingGeometry as IPointCollection;

 

                             for (int m = 0; m < interiorRingPointCollection.PointCount; m++)

                             {

                                    Trace.WriteLine("Point[" + m + "] = " + PointToString(interiorRingPointCollection.get_Point(m)));

                             }

                      }

               }

        }

 

        private static string PointToString(IPoint point)

        {

            return (point.X + ", " + point.Y + ", " + point.Z);

        }

See Also

IPolygon4 Interface