![]() |
This document is archived and information here might be outdated. Recommended version. |
A collection of surface patches.
Use the ISupportErrorInfo method InterfaceSupportsErrorInfo to determine if the object supports extended error information. If the object supports extended error info, VC++ developers should use the OLE/COM IErrorInfo interface to access the ErrorInfo object. Visual Basic developers should use the global error object Err to retrieve this extended error information.
| Interfaces | Description |
|---|---|
| IArea | Provides access to members that return properties common to rings and polygons. |
| IArea3D | Provides access to members that return properties common to MultiPatches. |
| IClone (esriSystem) | Provides access to members that control cloning of objects. |
| IConstructMultiPatch | Provides access to members that can be used to construct MultiPatches. |
| IGeneralMultiPatchInfo | Interface to get infomation of a GeneralMultiPatch. |
| IGeometry | Provides access to members that describe properties and behavior of all geometric objects. |
| IGeometry2 | Provides access to members that extend the IGeometry interface with a more sophisticated projection method. |
| IGeometry3 | Provides rapid access to a geometry's extent in the x-y plane. |
| IGeometry4 | Provides access to methods that indicate if a geometry has been changed (edited, projected, etc). |
| IGeometry5 | Provides access to members that extend the IGeometry interface with a more sophisticated projection method. |
| IGeometryCollection | Provides access to members that can be used for accessing, adding and removing individual geometries of a multi-part geometry (Multipoint, Polyline, Polygon, MultiPatch, and GeometryBag). |
| IHitTest | Provides access to members that locate a part of a geometry closest to a point. |
| IHitTest3D | Provides access to members that locate a part of a geometry closest to a point. |
| IMAware | Indicator interface that identifies geometric objects that can have persistent M values attached to their vertices. |
| IMCollection | Provides access to members that control operations on M-aware multipoints, polylines, polygons and multipatches. |
| IMSnap | Provides access to a method that snaps ms of the geometry to the precision of the spatial reference associated with the geometry. |
| IMultiPatch | Provides access to members that identify a MultiPatch and permit controlled access to its parts. |
| IPersist (esriSystem) | |
| IPersistStream (esriSystem) | |
| IPointCollection | Provides access to members that manipulate the points of a Multipoint, Path, Ring, Polyline, Polygon, TriangleFan, TriangleStrip, or MultiPatch. |
| IPointCollection4 | Provides access to members that manipulate the points of a Multipoint, Path, Ring, Polyline, Polygon, TriangleFan, TriangleStrip, or MultiPatch. |
| IPointIDAware | Indicator interface that identifies geometries that can have persistent point ID values attached to coordinates. |
| IProximityOperator | Provides access to members that find the 2D distance between two geometries. |
| IProximityOperator3D | Provides access to members that find the 3D distance between two geometries with Zs. |
| IRelationalOperator | Provides access to members that determine if a certain spatial relationship exists between two geometries. |
| IRelationalOperator2 | Additional relational functions. |
| IRelationalOperator3D | Provides access to members that determine if a certain spatial relationship exists between two geometries with Zs. |
| IRelationalOperator3D2 | Provides access to members that determine if a certain spatial relationship exists between two geometries with Zs. |
| ISupportErrorInfo (esriSystem) | |
| ITopologicalOperator | Provides access to members for constructing new geometries based upon topological relationships between existing geometries. |
| ITopologicalOperator2 | Provides access to members that extend the ITopologicalOperator interface. |
| ITopologicalOperator3 | Provides additional information on non-simple geometries. |
| ITransform2D | Provides access to methods for transforming geometries using either specific parameters or arbitrary transformation objects (affine transformations, geographic transformations, etc.). |
| ITransform3D | Provides access to methods for transforming 3D geometries using either specific parameters or arbitrary transformation objects. |
| IVolume | Provides access to members that return properties common to MultiPatches. |
| IXMLSerialize (esriSystem) | Provides access to members that XML serialize and deserialize an object to/from XML. |
| IZAware | Indicator interface that identifies geometries that can have persistent Z values attached to their vertices. |
| IZCollection | Provides access to operations on Z-aware geometries. |

private static object _missing = Type.Missing;
public static IGeometry GetMultiPatchGeometry()
{
//Composite: House Composed Of 7 Ring, 1 TriangleStrip, And 1 Triangles Parts
IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();
IMultiPatch multiPatch = multiPatchGeometryCollection as IMultiPatch;
//Base (Exterior Ring)
IPointCollection basePointCollection = new RingClass();
basePointCollection.AddPoint(ConstructPoint3D(5, 4, 0), ref _missing, ref _missing);
basePointCollection.AddPoint(ConstructPoint3D(-5, 4, 0), ref _missing, ref _missing);
basePointCollection.AddPoint(ConstructPoint3D(-5, -4, 0), ref _missing, ref _missing);
basePointCollection.AddPoint(ConstructPoint3D(5, -4, 0), ref _missing, ref _missing);
basePointCollection.AddPoint(basePointCollection.get_Point(0), ref _missing, ref _missing);
multiPatchGeometryCollection.AddGeometry(basePointCollection as IGeometry, ref _missing, ref _missing);
multiPatch.PutRingType(basePointCollection as IRing, esriMultiPatchRingType.esriMultiPatchOuterRing);
//Front With Cutaway For Door (Exterior Ring)
IPointCollection frontPointCollection = new RingClass();
frontPointCollection.AddPoint(ConstructPoint3D(5, 4, 6), ref _missing, ref _missing);
frontPointCollection.AddPoint(ConstructPoint3D(5, 4, 0), ref _missing, ref _missing);
frontPointCollection.AddPoint(ConstructPoint3D(5, 1, 0), ref _missing, ref _missing);
frontPointCollection.AddPoint(ConstructPoint3D(5, 1, 4), ref _missing, ref _missing);
frontPointCollection.AddPoint(ConstructPoint3D(5, -1, 4), ref _missing, ref _missing);
frontPointCollection.AddPoint(ConstructPoint3D(5, -1, 0), ref _missing, ref _missing);
frontPointCollection.AddPoint(ConstructPoint3D(5, -4, 0), ref _missing, ref _missing);
frontPointCollection.AddPoint(ConstructPoint3D(5, -4, 6), ref _missing, ref _missing);
frontPointCollection.AddPoint(frontPointCollection.get_Point(0), ref _missing, ref _missing);
multiPatchGeometryCollection.AddGeometry(frontPointCollection as IGeometry, ref _missing, ref _missing);
multiPatch.PutRingType(frontPointCollection as IRing, esriMultiPatchRingType.esriMultiPatchOuterRing);
//Back (Exterior Ring)
IPointCollection backPointCollection = new RingClass();
backPointCollection.AddPoint(ConstructPoint3D(-5, 4, 6), ref _missing, ref _missing);
backPointCollection.AddPoint(ConstructPoint3D(-5, -4, 6), ref _missing, ref _missing);
backPointCollection.AddPoint(ConstructPoint3D(-5, -4, 0), ref _missing, ref _missing);
backPointCollection.AddPoint(ConstructPoint3D(-5, 4, 0), ref _missing, ref _missing);
backPointCollection.AddPoint(backPointCollection.get_Point(0), ref _missing, ref _missing);
multiPatchGeometryCollection.AddGeometry(backPointCollection as IGeometry, ref _missing, ref _missing);
multiPatch.PutRingType(backPointCollection as IRing, esriMultiPatchRingType.esriMultiPatchOuterRing);
//Right Side (Ring Group)
//Exterior Ring
IPointCollection rightSideExteriorPointCollection = new RingClass();
rightSideExteriorPointCollection.AddPoint(ConstructPoint3D(5, 4, 6), ref _missing, ref _missing);
rightSideExteriorPointCollection.AddPoint(ConstructPoint3D(-5, 4, 6), ref _missing, ref _missing);
rightSideExteriorPointCollection.AddPoint(ConstructPoint3D(-5, 4, 0), ref _missing, ref _missing);
rightSideExteriorPointCollection.AddPoint(ConstructPoint3D(5, 4, 0), ref _missing, ref _missing);
rightSideExteriorPointCollection.AddPoint(rightSideExteriorPointCollection.get_Point(0), ref _missing, ref _missing);
multiPatchGeometryCollection.AddGeometry(rightSideExteriorPointCollection as IGeometry, ref _missing, ref _missing);
multiPatch.PutRingType(rightSideExteriorPointCollection as IRing, esriMultiPatchRingType.esriMultiPatchOuterRing);
//Interior Ring
IPointCollection rightSideInteriorPointCollection = new RingClass();
rightSideInteriorPointCollection.AddPoint(ConstructPoint3D(1, 4, 4), ref _missing, ref _missing);
rightSideInteriorPointCollection.AddPoint(ConstructPoint3D(1, 4, 2), ref _missing, ref _missing);
rightSideInteriorPointCollection.AddPoint(ConstructPoint3D(-1, 4, 2), ref _missing, ref _missing);
rightSideInteriorPointCollection.AddPoint(ConstructPoint3D(-1, 4, 4), ref _missing, ref _missing);
rightSideInteriorPointCollection.AddPoint(rightSideInteriorPointCollection.get_Point(0), ref _missing, ref _missing);
multiPatchGeometryCollection.AddGeometry(rightSideInteriorPointCollection as IGeometry, ref _missing, ref _missing);
multiPatch.PutRingType(rightSideInteriorPointCollection as IRing, esriMultiPatchRingType.esriMultiPatchInnerRing);
//Left Side (Ring Group)
//Exterior Ring
IPointCollection leftSideExteriorPointCollection = new RingClass();
leftSideExteriorPointCollection.AddPoint(ConstructPoint3D(5, -4, 6), ref _missing, ref _missing);
leftSideExteriorPointCollection.AddPoint(ConstructPoint3D(5, -4, 0), ref _missing, ref _missing);
leftSideExteriorPointCollection.AddPoint(ConstructPoint3D(-5, -4, 0), ref _missing, ref _missing);
leftSideExteriorPointCollection.AddPoint(ConstructPoint3D(-5, -4, 6), ref _missing, ref _missing);
leftSideExteriorPointCollection.AddPoint(leftSideExteriorPointCollection.get_Point(0), ref _missing, ref _missing);
multiPatchGeometryCollection.AddGeometry(leftSideExteriorPointCollection as IGeometry, ref _missing, ref _missing);
multiPatch.PutRingType(leftSideExteriorPointCollection as IRing, esriMultiPatchRingType.esriMultiPatchOuterRing);
//Interior Ring
IPointCollection leftSideInteriorPointCollection = new RingClass();
leftSideInteriorPointCollection.AddPoint(ConstructPoint3D(1, -4, 4), ref _missing, ref _missing);
leftSideInteriorPointCollection.AddPoint(ConstructPoint3D(-1, -4, 4), ref _missing, ref _missing);
leftSideInteriorPointCollection.AddPoint(ConstructPoint3D(-1, -4, 2), ref _missing, ref _missing);
leftSideInteriorPointCollection.AddPoint(ConstructPoint3D(1, -4, 2), ref _missing, ref _missing);
leftSideInteriorPointCollection.AddPoint(leftSideInteriorPointCollection.get_Point(0), ref _missing, ref _missing);
multiPatchGeometryCollection.AddGeometry(leftSideInteriorPointCollection as IGeometry, ref _missing, ref _missing);
multiPatch.PutRingType(leftSideInteriorPointCollection as IRing, esriMultiPatchRingType.esriMultiPatchInnerRing);
//Roof
IPointCollection roofPointCollection = new TriangleStripClass();
roofPointCollection.AddPoint(ConstructPoint3D(-5, 4, 6), ref _missing, ref _missing);
roofPointCollection.AddPoint(ConstructPoint3D(5, 4, 6), ref _missing, ref _missing);
roofPointCollection.AddPoint(ConstructPoint3D(-5, 0, 9), ref _missing, ref _missing);
roofPointCollection.AddPoint(ConstructPoint3D(5, 0, 9), ref _missing, ref _missing);
roofPointCollection.AddPoint(ConstructPoint3D(-5, -4, 6), ref _missing, ref _missing);
roofPointCollection.AddPoint(ConstructPoint3D(5, -4, 6), ref _missing, ref _missing);
multiPatchGeometryCollection.AddGeometry(roofPointCollection as IGeometry, ref _missing, ref _missing);
//Triangular Area Between Roof And Front/Back
IPointCollection triangularAreaPointCollection = new TrianglesClass();
//Area Between Roof And Front
triangularAreaPointCollection.AddPoint(ConstructPoint3D(5, 0, 9), ref _missing, ref _missing);
triangularAreaPointCollection.AddPoint(ConstructPoint3D(5, 4, 6), ref _missing, ref _missing);
triangularAreaPointCollection.AddPoint(ConstructPoint3D(5, -4, 6), ref _missing, ref _missing);
//Area Between Roof And Back
triangularAreaPointCollection.AddPoint(ConstructPoint3D(-5, 0, 9), ref _missing, ref _missing);
triangularAreaPointCollection.AddPoint(ConstructPoint3D(-5, -4, 6), ref _missing, ref _missing);
triangularAreaPointCollection.AddPoint(ConstructPoint3D(-5, 4, 6), ref _missing, ref _missing);
multiPatchGeometryCollection.AddGeometry(triangularAreaPointCollection as IGeometry, ref _missing, ref _missing);
return multiPatchGeometryCollection as IGeometry;
}
private static IPoint ConstructPoint3D(double x, double y, double z)
{
IPoint point = ConstructPoint2D(x, y);
point.Z = z;
return point;
}
private static IPoint ConstructPoint2D(double x, double y)
{
IPoint point = new PointClass();
point.PutCoords(x, y);
return point;
}