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


IMultiPatch.QueryBeginningRings Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IM > IMultiPatch Interface > IMultiPatch.QueryBeginningRings Method
ArcGIS Developer Help

IMultiPatch.QueryBeginningRings Method

Populates an array with references to all beginning rings of the specified types. This method is intended for internal use only.

[Visual Basic .NET]
Public Sub QueryBeginningRings ( _
    ByVal ringTypesDesired As Integer, _
    ByVal numBeginningRingsRequested As Integer, _
    ByRef beginningRings As IRing _
)
[C#]
public void QueryBeginningRings (
    int ringTypesDesired,
    int numBeginningRingsRequested,
    ref IRing beginningRings
);
[C++]
HRESULT QueryBeginningRings(
  long ringTypesDesired,
  long numBeginningRingsRequested,
  IRing** beginningRings
);
[C++]
Parameters
ringTypesDesired 

ringTypesDesired is a parameter of type long numBeginningRingsRequested
numBeginningRingsRequested is a parameter of type long beginningRings [out]
beginningRings is a parameter of type IRing**

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

When using C# or VB.NET you must use the IGeometryBridge interface to call this method.

[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