ArcObjects Library Reference  (Geometry)    

IMultiPatch_QueryBeginningRings_Example

[C#]
private void TestBeginningRings()
{
  //Get the map document
  IMxDocument mxDocument = m_application.Document as IMxDocument;
  //Get the features selection
  IEnumFeature selectedFeatures = mxDocument.FocusMap.FeatureSelection as IEnumFeature;
  //Loop over all selected features and look if it is a polygon
  selectedFeatures.Reset();
  IFeature currentFeature = selectedFeatures.Next();
  while (currentFeature != null)
  {
    //Check if currentFeature is multipatch
    if (currentFeature.Shape.GeometryType == esriGeometryType.esriGeometryMultiPatch)
    {
      IMultiPatch multiPatch = currentFeature.Shape as IMultiPatch;
      int ringType = 0;
      int beginningRingsCount = multiPatch.get_BeginningRingCount(ringType);
      if (beginningRingsCount > 0)
      {
        IRing[] beginningRings = new IRing[beginningRingsCount];
        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();
        geometryBridge.QueryBeginningRings(multiPatch, ringType, ref beginningRings);
        System.Windows.Forms.MessageBox.Show("Feature with OID = " + currentFeature.OID + " has " +
                                             beginningRings.Length + " inner Rings");
        
      }
      else
      {
        System.Windows.Forms.MessageBox.Show("Feature with OID = " + currentFeature.OID + " has " +
                                             " 0 inner Rings");
      }
    }
    currentFeature = selectedFeatures.Next();
  }
}

[Visual Basic 6.0, Visual Basic .NET, C++]
No example is available for Visual Basic 6.0, Visual Basic .NET, or C++. To view a C# example, click the Language Filter button Language Filter in the upper-left corner of the page.