This document is archived and information here might be outdated. Recommended version. |
Construct a MultiPatch by extruding a (non-point) geometry using its initial Zs for one base, and a uniform input Z for the other.
[Visual Basic .NET] Public Sub ConstructExtrudeAbsolute ( _ ByVal toZ As Double, _ ByVal baseGeom As IGeometry _ )
[C#] public void ConstructExtrudeAbsolute ( double toZ, IGeometry baseGeom );
[C++]
HRESULT ConstructExtrudeAbsolute(
double toZ,
IGeometry* baseGeom
);
[C++] Parameters toZ
toZ is a parameter of type double baseGeom
baseGeom is a parameter of type IGeometry*
Creates a MultiPatch from a base non-point geometry by extruding the base geometry along the Z-axis from the base geometry to a given absolute Z plane. The base Z value of the geometry is preserved and top Z value is uniformly equal to the input absolute Z. The resulting extrusion is always parallel to the XY-plane on the top and only parallel at the base if the base geometry is parallel to the XY-plane.
All non-linear segments are treated as linear segments when extrusion is performed. Only Polylines, Polygons, and Envelopes are allowed as input geometries.
private static object _missing = Type.Missing;
public static IGeometry GetMultiPatchGeometry()
{
const int DensificationDivisions = 20;
const double MaxDeviation = 0.1;
const double BaseZ = 0;
const double ToZ = -10;
//Extrusion: 3D Polyline Having Vertices With Varying Z Values, Extruded To Specified Z Value
// Via ConstructExtrudeAbsolute()
IPointCollection polylinePointCollection = new PolylineClass();
polylinePointCollection.AddPoint(ConstructPoint2D(-10, -10), ref _missing, ref _missing);
polylinePointCollection.AddPoint(ConstructPoint2D(0, -5), ref _missing, ref _missing);
polylinePointCollection.AddPoint(ConstructPoint2D(0, 5), ref _missing, ref _missing);
polylinePointCollection.AddPoint(ConstructPoint2D(10, 10), ref _missing, ref _missing);
IPolyline polyline = polylinePointCollection as IPolyline;
polyline.Densify(polyline.Length / DensificationDivisions, MaxDeviation);
IGeometry polylineGeometry = polyline as IGeometry;
MakeZAware(polylineGeometry);
Random random = new Random();
for (int i = 0; i < polylinePointCollection.PointCount; i++)
{
IPoint polylinePoint = polylinePointCollection.get_Point(i);
polylinePointCollection.UpdatePoint(i, ConstructPoint3D(polylinePoint.X, polylinePoint.Y, BaseZ - 2 * Math.Sin(random.NextDouble())));
}
ITopologicalOperator topologicalOperator = polylineGeometry as ITopologicalOperator;
topologicalOperator.Simplify();
IConstructMultiPatch constructMultiPatch = new MultiPatchClass();
constructMultiPatch.ConstructExtrudeAbsolute(ToZ, polylineGeometry);
return constructMultiPatch as IGeometry;
}
public static IPoint ConstructPoint2D(double x, double y)
{
IPoint point = new PointClass();
point.PutCoords(x, y);
return point;
}
private static void MakeZAware(IGeometry geometry)
{
IZAware zAware = geometry as IZAware;
zAware.ZAware = true;
}
IConstructMultiPatch Interface | IExtrude.ExtrudeBetween Method | IConstructMultiPatch.ConstructExtrudeAbsolute Method | IConstructMultiPatch.ConstructExtrudeBetween Method | IExtrude.ExtrudeAbsolute Method | IConstructMultiPatch.ConstructExtrudeRelative Method | IConstructMultiPatch.ConstructExtrudeFromTo Method | IConstructMultiPatch Interface | IConstructMultiPatch.ConstructExtrudeAlongLine Method | IConstructMultiPatch.ConstructExtrude Method | IExtrude.Extrude Method | IExtrude.ExtrudeFromTo Method | IExtrude.ExtrudeRelative Method | IExtrude.ExtrudeAlongLine Method | IExtrude Interface | IGlobeHeightProperties.ExtrusionExpressionString Property