IMultiPatch Interface

Provides access to members that identify a MultiPatch and permit controlled access to its parts.

Description

A multipatch is a series of three-dimensional surfaces that are represented as groups of geometries. These geometries may be Triangle Strips, Triangle Fans, or groups of Rings (ring-groups ). In a multipatch there is one triangle strip, or triangle fan per surface, whereas there can be one or more rings per surface. A single multipatch may comprise combinations of triangle strips, triangle fans, and ring groups.

--------------------- Multipatch ---------------------

| | |

Triangle Strip Triangle Fan Rings

Triangle strips are a sequence of connected triangles 0,1,2,3,4,...n that each build from their predecessor.

Triangle fans are a sequence of connected triangles that each use the first point in the sequence as an apex 0,1,0,2,0,3,0,4,...,0,n

Triangle strips and triangle fans specify surfaces by themselves. A ring works contextually with other rings to specify a surface, but it may also be its own surface.

<->

The main difference between the ring and the triangles for a developer is when using

IPointCollection :: GetPoint(index)

for the multipatch.

If the index points to a point in a (segment of a) ring, you get a reference to a copy of the point, otherwise you get a reference to the point directly. This means that you can directly modify points in triangles but in order to modify points in a ring, you must use

IPointCollection :: UpdatePoint

Ring Groups

--------------

Rings all have the same structure, but they have a special role when defining a multipatch surface. The roles of rings are determined by the multipatch (they are not a property of the ring itself)

The roles are called:

  • Ring (unknown)
  • First Ring
  • Inner Ring
  • Outer Ring

One rule that is not enforced, but that should be followed when creating a ring group, is that all rings in a group are co-planar. This is an OpenGL 3D graphics standard.

This means, for example, that a closed cube would comprise six ring groups. Each group would have a single ring. A hole in one of the sides of the cube would not alter the number of groups. Instead, an additional ring would be added to one of the groups to represent the hole.

<->

Another rule is that there is only one group per outer ring. If, for instance, there was another co-planar ring inside the hole mentioned above, this would be represented as another group. This is because it is affectively another surface, even though it is coplanar with the side-ring and the hole-ring.

<->

Each group has a ring sequence, and in combination with the role of the rings in the sequence, a surface can be defined. A multipatch can have a number of surfaces represented by ring groups, the different roles of the rings help to determine the one group from the next, and within each group, determine the structure of the surface.

Following are some examples of using the roles of rings in the ring sequence of a group to define a surface.

---------------------------------------------------------

Multipatch 1 - First Ring designates the start of a ring group. Any subsequent surface other than Ring breaks the sequence.

Triangle strip, triangle fan, ring, ring, ring, first ring, ring

The above sequence is interpreted as five surfaces as follows:

  • Surface 1 - triangle strip
  • Surface 2 - triangle fan
  • Surface 3 - Ring
  • Surface 4 - Ring
  • Surface 5 - First Ring, Ring

---------------------------------------------------------

Multipatch 2 - Triangle strip, outer ring, inner ring, inner ring, ring, first ring, ring

This sequence is interpreted as four surfaces as follows:

  • Surface 1 - triangle strip
  • Surface 2 - outer ring, inner ring, inner ring
  • Surface 3 - ring
  • Surface 4 - first ring, ring

---------------------------------------------------------

Outer ring/Inner ring nomenclature is a more structured form for the surface than First Ring/Ring series. The former explicitly defines that any subsequent inner is a hole in the ring. In the sequence "Inner" must always follow "Outer" or "Inner". It would otherwise be an error. Anything other than "Inner" would stop the sequence for the Inner/Outer group.

Members

Name Description
Read-only property BeginningRingCount The number of beginning rings, counting only those of the desired types.
Read-only property Dimension The topological dimension of this geometry.
Read-only property Envelope Creates a copy of this geometry's envelope and returns it.
Method FindBeginningRing Returns the beginning ring of the ring group containing the specified following ring.
Read-only property FollowingRingCount The number of following rings in the ring group that starts with the specified beginning ring.
Read-only property GeometryType The type of this geometry.
Method GeoNormalize Shifts longitudes, if need be, into a continuous range of 360 degrees.
Method GeoNormalizeFromLongitude Normalizes longitudes into a continuous range containing the longitude. This method is obsolete.
Method GetRingType Gets the esriMultiPatchRingType of the input Ring and returns a boolean indicating if that ring is a beginning ring.
Method InvalXYFootprint Notifies the multipatch that its cached footprint has been modified by an outside agent. The footprint will be recalculated the next time it is requested.
Read-only property IsEmpty Indicates whether this geometry contains any points.
Method Project Projects this geometry into a new spatial reference.
Method PutRingType Defines the type of the input Ring.
Method QueryBeginningRings Populates an array with references to all beginning rings of the specified types. This method is intended for internal use only.
Method QueryEnvelope Copies this geometry's envelope properties into the specified envelope.
Method QueryFollowingRings Populates an array with references to following rings that are in the ring group that starts with the specified beginning ring. This method is intended for internal use only.
Method SetEmpty Removes all points from this geometry.
Method SnapToSpatialReference Moves points of this geometry so that they can be represented in the precision of the geometry's associated spatial reference system.
Read/write property SpatialReference The spatial reference associated with this geometry.
Read-only property XYFootprint A reference to a cached copy of the multipatch's footprint in the x-y plane. If the footprint is modified, InvalXYFootprint should be called.

IMultiPatch.BeginningRingCount Property

The number of beginning rings, counting only those of the desired types.

Public Function get_BeginningRingCount ( _
    ByVal ringTypesDesired As Integer _
) As Integer
public int get_BeginningRingCount (
    int ringTypesDesired
);
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;

         }

IMultiPatch.FindBeginningRing Method

Returns the beginning ring of the ring group containing the specified following ring.

Public Function FindBeginningRing ( _
    ByVal followingRing As IRing _
) As IRing
public IRing FindBeginningRing (
    IRing followingRing
);
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;

         }

IMultiPatch.FollowingRingCount Property

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

Public Function get_FollowingRingCount ( _
    ByVal beginningRing As IRing _
) As Integer
public int get_FollowingRingCount (
    IRing beginningRing
);
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;

         }

IMultiPatch.GetRingType Method

Gets the esriMultiPatchRingType of the input Ring and returns a boolean indicating if that ring is a beginning ring.

Public Function GetRingType ( _
    ByVal queryRing As IRing, _
    ByRef isBeginningRing As Boolean _
) As esriMultiPatchRingType
public esriMultiPatchRingType GetRingType (
    IRing queryRing,
    ref bool isBeginningRing
);

Remarks

IMultiPatch GetRingType Example

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;

         }

IMultiPatch.InvalXYFootprint Method

Notifies the multipatch that its cached footprint has been modified by an outside agent. The footprint will be recalculated the next time it is requested.

Public Sub InvalXYFootprint ( _
)
public void InvalXYFootprint (
);

Description

InvalXYFootprint tells the MultiPatch that the XYFootprint it holds may have changed without its knowledge and needs to be recalculated before it can be used. InvalXYFootprint should be called anytime the parts of the MultiPatch are altered without altering the MultiPatch as a whole. Operations which operate on the entire MultiPatch or utilize the MultiPatch interfaces do not require InvalXYFootprint to be called.

IMultiPatch.PutRingType Method

Defines the type of the input Ring.

Public Sub PutRingType ( _
    ByVal queryRing As IRing, _
    ByVal ringType As esriMultiPatchRingType _
)
public void PutRingType (
    IRing queryRing,
    esriMultiPatchRingType ringType
);

Remarks

IMultiPatch PutRingType Example

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;

         }

IMultiPatch.QueryBeginningRings Method

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

Public Sub QueryBeginningRings ( _
    ByVal ringTypesDesired As Integer, _
    ByVal numBeginningRingsRequested As Integer, _
    ByRef beginningRings As IRing _
)
public void QueryBeginningRings (
    int ringTypesDesired,
    int numBeginningRingsRequested,
    ref IRing beginningRings
);

Remarks

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

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;

         }

IMultiPatch.QueryFollowingRings Method

Populates an array with references to following rings that are in the ring group that starts with the specified beginning ring. This method is intended for internal use only.

Public Sub QueryFollowingRings ( _
    ByVal beginningRing As IRing, _
    ByVal numFollowingRingsRequested As Integer, _
    ByRef followingRings As IRing _
)
public void QueryFollowingRings (
    IRing beginningRing,
    int numFollowingRingsRequested,
    ref IRing followingRings
);

Remarks

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

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;

         }

IMultiPatch.XYFootprint Property

A reference to a cached copy of the multipatch's footprint in the x-y plane. If the footprint is modified, InvalXYFootprint should be called.

Public ReadOnly Property XYFootprint As IGeometry
public IGeometry XYFootprint {get;}

Description

Returns the 2D envelope of the MultiPatch to the XY-Plane. The XYFootprint is used to display the envelope of MultiPatches in a 2D environment as well as perform simple time-efficient calculations.

If you want a real XY-Plane projection of a MultiPatch "XYFootprint", use the method ITransform3D:ProjectToPlane.

Remarks

To ensure that the XYFootprint is current (this is especially important if you directly modify the XYFootprint or one of the MultiPatch parts), call InvalXYFootprint.

Inherited Interfaces

Interfaces Description
IGeometry Provides access to members that describe properties and behavior of all geometric objects.

Classes that implement IMultiPatch

Classes Description
MultiPatch A collection of surface patches.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.