new PolygonGeometry()
Polygonal geometry classes can be drawn using Primitive and GroundPrimitive.
| Name | Type | Default | Description |
|---|---|---|---|
options.polygonHierarchy |
PolygonHierarchy |
optional
It can contain a porous polygonal hierarchical structure. |
|
options.height |
Number | 0.0 |
optional
The distance (in meters) between the surfaces of polygons and ellipsoids. |
options.extrudedHeight |
Number |
optional
The distance between the stretched surface of a polygon and the surface of an ellipsoid. |
|
options.vertexFormat |
VertexFormat | VertexFormat.DEFAULT |
optional
The vertex attributes to be calculated. |
options.stRotation |
Number | 0.0 |
optional
Rotation of texture coordinates in radians. Positive rotation is counterclockwise. |
options.ellipsoid |
Ellipsoid | Ellipsoid.WGS84 |
optional
The ellipsoid to be used as a reference. |
options.granularity |
Number | Math.RADIANS_PER_DEGREE |
optional
The distance (in radians) between each latitude and longitude. Determine the number of positions in the buffer. |
options.perPositionHeight |
Boolean | false |
optional
Use options.options height for each position instead of options.height to determine the height. |
options.closeTop |
Boolean | true |
optional
When false, keep the top of the stretched polygon open. |
options.closeBottom |
Boolean | true |
optional
When false, keep the bottom of the stretched polygon open. |
- See:
-
- PolygonGeometry#createGeometry
- PolygonGeometry#fromPositions
Example
// 1. create a polygon from points
var polygon = new SuperMap3D.PolygonGeometry({
polygonHierarchy : new SuperMap3D.PolygonHierarchy(
SuperMap3D.Cartesian3.fromDegreesArray([
-72.0, 40.0,
-70.0, 35.0,
-75.0, 30.0,
-70.0, 30.0,
-68.0, 40.0
])
)
});
var geometry = SuperMap3D.PolygonGeometry.createGeometry(polygon);
// 2. create a nested polygon with holes
var polygonWithHole = new SuperMap3D.PolygonGeometry({
polygonHierarchy : new SuperMap3D.PolygonHierarchy(
SuperMap3D.Cartesian3.fromDegreesArray([
-109.0, 30.0,
-95.0, 30.0,
-95.0, 40.0,
-109.0, 40.0
]),
[new SuperMap3D.PolygonHierarchy(
SuperMap3D.Cartesian3.fromDegreesArray([
-107.0, 31.0,
-107.0, 39.0,
-97.0, 39.0,
-97.0, 31.0
]),
[new SuperMap3D.PolygonHierarchy(
SuperMap3D.Cartesian3.fromDegreesArray([
-105.0, 33.0,
-99.0, 33.0,
-99.0, 37.0,
-105.0, 37.0
]),
[new SuperMap3D.PolygonHierarchy(
SuperMap3D.Cartesian3.fromDegreesArray([
-103.0, 34.0,
-101.0, 34.0,
-101.0, 36.0,
-103.0, 36.0
])
)]
)]
)]
)
});
var geometry = SuperMap3D.PolygonGeometry.createGeometry(polygonWithHole);
// 3. create extruded polygon
var extrudedPolygon = new SuperMap3D.PolygonGeometry({
polygonHierarchy : new SuperMap3D.PolygonHierarchy(
SuperMap3D.Cartesian3.fromDegreesArray([
-72.0, 40.0,
-70.0, 35.0,
-75.0, 30.0,
-70.0, 30.0,
-68.0, 40.0
])
),
extrudedHeight: 300000
});
var geometry = SuperMap3D.PolygonGeometry.createGeometry(extrudedPolygon);
Members
-
packedLengthNumber
-
The number of elements used to package an object into an array.
Methods
-
static createGeometry(polygonGeometry){Geometry|undefined}
-
Calculate the geometric representation of polygons, including vertices, indices, and bounding balls.
Name Type Description polygonGeometryPolygonGeometry Description of polygons.
Returns:
Type Description Geometry | undefined Calculated vertices and indices. -
static fromPositions(){PolygonGeometry}
-
A polygon description defined by a vertex coordinate array. Its geometry can be rendered in two ways: Primitive and GroundPrimitive.
Name Type Default Description options.positionsArray.<Cartesian3> Define the position array of polygon corners.
options.heightNumber 0.0 optional The height of the polygon.
options.extrudedHeightNumber optional Squeeze out the height of the polygon.
options.vertexFormatVertexFormat VertexFormat.DEFAULT optional The vertex attributes to be calculated.
options.stRotationNumber 0.0 optional The rotation angle of texture coordinates, measured in radians. Positive rotation is counterclockwise.
options.ellipsoidEllipsoid Ellipsoid.WGS84 optional An ellipsoid used as a reference.
options.granularityNumber Math.RADIANS_PER_DEGREE optional The distance between each latitude and longitude (in radians). Determine the number of positions in the buffer.
options.perPositionHeightBoolean false optional Use the height of options.positions for each position instead of using options.height to determine the height.
options.closeTopBoolean true optional When false, the top of the extruded polygon will be opened.
options.closeBottomBoolean true optional When false, the bottom of the extruded polygon is not open.
- See:
-
- PolygonGeometry#createGeometry
Returns:
Type Description PolygonGeometry Example
// create a polygon from points var polygon = SuperMap3D.PolygonGeometry.fromPositions({ positions : SuperMap3D.Cartesian3.fromDegreesArray([ -72.0, 40.0, -70.0, 35.0, -75.0, 30.0, -70.0, 30.0, -68.0, 40.0 ]) }); var geometry = SuperMap3D.PolygonGeometry.createGeometry(polygon); -
static pack(value, array, startingIndex){Array.<Number>}
-
Store the provided instance in the provided array.
Name Type Default Description valuePolygonGeometry The value to be packaged.
arrayArray.<Number> The array to be loaded.
startingIndexNumber 0 optional Start packaging the index of the array of elements.
Returns:
Type Description Array.<Number> The array that has been loaded. -
static unpack(array, startingIndex, result)
-
Retrieve instances from the packaged array.
Name Type Default Description arrayArray.<Number> Package the array.
startingIndexNumber 0 optional The starting index of the element to be decompressed.
resultPolygonGeometry optional The object in which to store the results.