Gets the number of rings in this Polygon. Polygons may have one or more rings.

Namespace:  ESRI.ArcGISExplorer.Geometry

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public int RingCount { get; }
Visual Basic (Declaration)
Public ReadOnly Property RingCount As Integer

Field Value

An integer indicating the number of rings.

Remarks

Polygons may consist of one or more individual rings; those with one ring are known as single part polygons, and those with more than one ring are known as multipart polygons. Each ring is made up of a number of points, which define the vertices of the ring. Rings may be outer rings, describing an outer boundary of a section of Polygon, or may be inner rings, describing a hole within an outer ring. Each individual ring in a Polygon must describe a closed shape - the first Point must be at the same location as the last Point; see the Close()()() method.

Examples

The code below shows how the GetRing and RemoveRing methods and RingCount property can be used to turn one multipart Polygon into multiple single part polygons. The code assumes there is an existing multipart Polygon called poly.
CopyC#
// Create a list to hold all the created polygons, 
System.Collections.Generic.List<Polygon> singlePrts = new System.Collections.Generic.List<Polygon>(pgon.RingCount);

// Use RingCount and GetRing to iterate through every ring except the first ring in the polygon.
for (int i = 1; i < pgon.RingCount; i++)
{
    // Create a new Polygon from the ring, and add to the list.
    // Note - simplifying will correct turn any inner rings (holes) into outer rings (boundaries).
    Polygon newPoly = GeometryOperations.Simplify(new Polygon(pgon.GetRing(i)));
    singlePrts.Add(newPoly);
}

// Remove the subsequent rings from the original Polygon and add the original Polygon to the list.
while (pgon.RingCount > 1)
{
    pgon.RemoveRing(1);
}
singlePrts.Add(pgon);
CopyVB.NET
' Create a list to hold all the created Polygons, 
Dim singlePrts As System.Collections.Generic.List(Of Polygon) = New System.Collections.Generic.List(Of Polygon)(poly.RingCount)

' Use RingCount and GetRing to iterate through every ring except the first ring in the polygon.
For i As Integer = 1 To poly.RingCount - 1
    ' Create a new Polygon from the ring, and add to the list.
    ' Note - simplifying will correct turn any inner rings (holes) into outer rings (boundaries).
    Dim newPoly As Polygon = GeometryOperations.Simplify(New Polygon(poly.GetRing(i)))
    singlePrts.Add(newPoly)
Next i

' Remove the subsequent rings from the original Polygon and add the original Polygon to the list.
While poly.RingCount > 1
    poly.RemoveRing(1)
End While
singlePrts.Add(poly)

See Also