ArcObjects Library Reference  (Geometry)    

IMultiPatch_QueryFollowingRings_Example

[C#]
private void TestFollowingRings()
{
  //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);
        
        
        for(int i = 0; i < beginningRings.Length; i++)
        {
          IRing[] followingRings = new IRing[multiPatch.get_FollowingRingCount(beginningRings[i])];
          geometryBridge.QueryFollowingRings(multiPatch, beginningRings[i], ref followingRings);
          System.Windows.Forms.MessageBox.Show("Feature with OID = " + currentFeature.OID + " has " +
                                               beginningRings.Length + " inner Rings and " + followingRings.Length + " following Rings");
        
        }
       
      }
      else
      {
        System.Windows.Forms.MessageBox.Show("Feature with OID = " + currentFeature.OID + " has " +
                                             " 0 inner Rings and 0 following 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.