This document is archived and information here might be outdated.  Recommended version.


IMultiPatch.FollowingRingCount Property (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Geometry)  

IMultiPatch.FollowingRingCount Property

The number of following rings in the ring group that starts with the specified beginning ring.

[Visual Basic .NET]
Public Function get_FollowingRingCount ( _
    ByVal beginningRing As IRing _
) As Integer
[C#]
public int get_FollowingRingCount (
    IRing beginningRing
);
[C++]
HRESULT get_FollowingRingCount(
  IRing* beginningRing,
  long* FollowingRingCount
);
[C++]

Parameters beginningRing
beginningRing is a parameter of type IRing FollowingRingCount [out, retval] FollowingRingCount is a parameter of type long

Product Availability

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

 

        private static object _missing=Type.Missing;

 

        public static void QueryMultiPatchRings()

        {

            const esriMultiPatchRingType DesiredRingTypeMask=esriMultiPatchRingType.esriMultiPatchBeginningRingMask;

 

            IGeometryBridge geometryBridge=new GeometryEnvironmentClass();

 

            IMultiPatch multiPatch=GetMultiPatchGeometry() as IMultiPatch;

 

            int beginningRingCount=multiPatch.get_BeginningRingCount((int)DesiredRingTypeMask);

            Trace.WriteLine("BeginningRingCount=" + beginningRingCount);

           

            IRing[] beginningRingArray=new IRing[beginningRingCount];

 

            geometryBridge.QueryBeginningRings(multiPatch, (int)DesiredRingTypeMask, ref beginningRingArray);

 

            for (int i=0; i < beginningRingArray.Length; i++)

            {

                IRing beginningRing=beginningRingArray[i];

                Trace.WriteLine("BeginningRing[" + i + "].MultiPatchRingType=" + GetMultiPatchRingType(multiPatch, beginningRing));

                Trace.WriteLine("BeginningRing[" + i + "].IsBeginningRing=" + IsBeginningRing(multiPatch, beginningRing));

                Trace.WriteLine("BeginningRing[" + i + "].Length=" + beginningRing.Length);

 

                int followingRingCount=multiPatch.get_FollowingRingCount(beginningRing);

                Trace.WriteLine("BeginningRing[" + i + "].FollowingRingCount=" + followingRingCount);

 

                IRing[] followingRingArray=new IRing[followingRingCount];

 

                geometryBridge.QueryFollowingRings(multiPatch, beginningRing, ref followingRingArray);

 

                for (int j=0; j < followingRingArray.Length; j++)

                {

                    IRing followingRing=followingRingArray[j];

                    Trace.WriteLine("BeginningRing[" + i + "].FollowingRing[" + j + "].MultiPatchRingType=" + GetMultiPatchRingType(multiPatch, followingRing));

                    Trace.WriteLine("BeginningRing[" + i + "].FollowingRing[" + j + "].IsBeginningRing=" + IsBeginningRing(multiPatch, followingRing));

                    Trace.WriteLine("BeginningRing[" + i + "].FollowingRing[" + j + "].Length=" + followingRing.Length);

                   

                    IRing foundBeginningRing=multiPatch.FindBeginningRing(followingRing);

                    Trace.WriteLine("BeginningRing[" + i + "].FollowingRing[" + j + "].FoundBeginningRing.MultiPatchRingType=" + GetMultiPatchRingType(multiPatch, foundBeginningRing));

                    Trace.WriteLine("BeginningRing[" + i + "].FollowingRing[" + j + "].FoundBeginningRing.IsBeginningRing=" + IsBeginningRing(multiPatch, foundBeginningRing));

                    Trace.WriteLine("BeginningRing[" + i + "].FollowingRing[" + j + "].FoundBeginningRing.Length=" + foundBeginningRing.Length);

                }

            }

        }

 

        private static esriMultiPatchRingType GetMultiPatchRingType(IMultiPatch multiPatch, IRing ring)

        {

            bool isBeginningRing=false;

 

            esriMultiPatchRingType multiPatchRingType=multiPatch.GetRingType(ring, ref isBeginningRing);

 

            return multiPatchRingType;

        }

 

        private static bool IsBeginningRing(IMultiPatch multiPatch, IRing ring)

        {

            bool isBeginningRing=false;

 

            esriMultiPatchRingType multiPatchRingType=multiPatch.GetRingType(ring, ref isBeginningRing);

 

            return isBeginningRing;

        }

 

        private static IGeometry GetMultiPatchGeometry()

        {

            //RingGroup: Upright Square Composed Of Multiple Exterior Rings And Multiple Interior Rings

 

            IGeometryCollection multiPatchGeometryCollection=new MultiPatchClass();

 

            IMultiPatch multiPatch=multiPatchGeometryCollection as IMultiPatch;

 

            //Exterior Ring 1

 

            IPointCollection exteriorRing1PointCollection=new RingClass();

            exteriorRing1PointCollection.AddPoint(ConstructPoint3D(5, 0, -5), ref _missing, ref _missing);

            exteriorRing1PointCollection.AddPoint(ConstructPoint3D(-5, 0, -5), ref _missing, ref _missing);

            exteriorRing1PointCollection.AddPoint(ConstructPoint3D(-5, 0, 5), ref _missing, ref _missing);

            exteriorRing1PointCollection.AddPoint(ConstructPoint3D(5, 0, 5), ref _missing, ref _missing);

            exteriorRing1PointCollection.AddPoint(ConstructPoint3D(5, 0, -5), ref _missing, ref _missing);

 

            multiPatchGeometryCollection.AddGeometry(exteriorRing1 as IGeometry, ref _missing, ref _missing);

 

            multiPatch.PutRingType(exteriorRing1, esriMultiPatchRingType.esriMultiPatchOuterRing);

 

            //Interior Ring 1

 

            IPointCollection interiorRing1PointCollection=new RingClass();

            interiorRing1PointCollection.AddPoint(ConstructPoint3D(-4, 0, -4), ref _missing, ref _missing);

            interiorRing1PointCollection.AddPoint(ConstructPoint3D(4, 0, -4), ref _missing, ref _missing);

            interiorRing1PointCollection.AddPoint(ConstructPoint3D(4, 0, 4), ref _missing, ref _missing);

            interiorRing1PointCollection.AddPoint(ConstructPoint3D(-4, 0, 4), ref _missing, ref _missing);

            interiorRing1PointCollection.AddPoint(ConstructPoint3D(-4, 0, -4), ref _missing, ref _missing);

 

            multiPatchGeometryCollection.AddGeometry(interiorRing1 as IGeometry, ref _missing, ref _missing);

 

            multiPatch.PutRingType(interiorRing1, esriMultiPatchRingType.esriMultiPatchInnerRing);

 

            //Exterior Ring 2

 

            IPointCollection exteriorRing2PointCollection=new RingClass();

            exteriorRing2PointCollection.AddPoint(ConstructPoint3D(3, 0, -3), ref _missing, ref _missing);

            exteriorRing2PointCollection.AddPoint(ConstructPoint3D(-3, 0, -3), ref _missing, ref _missing);

            exteriorRing2PointCollection.AddPoint(ConstructPoint3D(-3, 0, 3), ref _missing, ref _missing);

            exteriorRing2PointCollection.AddPoint(ConstructPoint3D(3, 0, 3), ref _missing, ref _missing);

            exteriorRing2PointCollection.AddPoint(ConstructPoint3D(3, 0, -3), ref _missing, ref _missing);

 

            multiPatchGeometryCollection.AddGeometry(exteriorRing2 as IGeometry, ref _missing, ref _missing);

 

            multiPatch.PutRingType(exteriorRing2, esriMultiPatchRingType.esriMultiPatchOuterRing);

 

            //Interior Ring 2

 

            IPointCollection interiorRing2PointCollection=new RingClass();

            interiorRing2PointCollection.AddPoint(ConstructPoint3D(-2, 0, -2), ref _missing, ref _missing);

            interiorRing2PointCollection.AddPoint(ConstructPoint3D(2, 0, -2), ref _missing, ref _missing);

            interiorRing2PointCollection.AddPoint(ConstructPoint3D(2, 0, 2), ref _missing, ref _missing);

            interiorRing2PointCollection.AddPoint(ConstructPoint3D(-2, 0, 2), ref _missing, ref _missing);

            interiorRing2PointCollection.AddPoint(ConstructPoint3D(-2, 0, -2), ref _missing, ref _missing);

 

            multiPatchGeometryCollection.AddGeometry(interiorRing2 as IGeometry, ref _missing, ref _missing);

 

            multiPatch.PutRingType(interiorRing2, esriMultiPatchRingType.esriMultiPatchInnerRing);

 

            //Exterior Ring 3

 

            IPointCollection exteriorRing3PointCollection=new RingClass();

            exteriorRing3PointCollection.AddPoint(ConstructPoint3D(1, 0, -1), ref _missing, ref _missing);

            exteriorRing3PointCollection.AddPoint(ConstructPoint3D(-1, 0, -1), ref _missing, ref _missing);

            exteriorRing3PointCollection.AddPoint(ConstructPoint3D(-1, 0, 1), ref _missing, ref _missing);

            exteriorRing3PointCollection.AddPoint(ConstructPoint3D(1, 0, 1), ref _missing, ref _missing);

            exteriorRing3PointCollection.AddPoint(ConstructPoint3D(1, 0, -1), ref _missing, ref _missing);

 

            multiPatchGeometryCollection.AddGeometry(exteriorRing3 as IGeometry, ref _missing, ref _missing);

 

            multiPatch.PutRingType(exteriorRing3, esriMultiPatchRingType.esriMultiPatchOuterRing);

 

            return multiPatchGeometryCollection as IGeometry;

        }

 

        public static IPoint ConstructPoint3D(double x, double y, double z)

        {

            IPoint point=ConstructPoint2D(x, y);

            point.Z=z;

 

            return point;

        }

 

        public static IPoint ConstructPoint2D(double x, double y)

        {

            IPoint point=new PointClass();

            point.PutCoords(x, y);

 

            return point;

        }

 

See Also

IMultiPatch Interface