# new RiverGeometry(options)
A description of a polygon on the ellipsoid. The polygon is Cesium.defined by a polygon hierarchy. Polygon geometry can be rendered with both Primitive and GroundPrimitive.
参数:
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
options |
Object | Object with the following properties: |
|
polygonHierarchy |
PolygonHierarchy | A polygon hierarchy that can include holes. |
|
height |
Number | 0.0 | The distance in meters between the polygon and the ellipsoid surface. |
extrudedHeight |
Number | The distance in meters between the polygon's extruded face and the ellipsoid surface. |
|
vertexFormat |
Cesium.VertexFormat | Cesium.VertexFormat.DEFAULT | The vertex attributes to be computed. |
indices |
Array.<Number> | 自定义顶点索引 |
|
st |
Float32Array | 自定义UV坐标 |
|
stRotation |
Number | 0.0 | The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise. |
ellipsoid |
Cesium.Ellipsoid | Cesium.Ellipsoid.WGS84 | The ellipsoid to be used as a reference. |
granularity |
Number | Cesium.Math.RADIANS_PER_DEGREE | The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer. |
perPositionHeight |
Boolean | false | Use the height of options.positions for each position instead of using options.height to determine the height. |
closeTop |
Boolean | true | When false, leaves off the top of an extruded polygon open. |
closeBottom |
Boolean | true | When false, leaves off the bottom of an extruded polygon open. |
arcType |
Cesium.ArcType | Cesium.ArcType.GEODESIC | The type of line the polygon edges must follow. Valid options are |
- See:
-
- RiverGeometry#createGeometry
- RiverGeometry#fromPositions
示例
// 1. create a polygon from points
var polygon = new Cesium.RiverGeometry({
polygonHierarchy : new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArray([
-72.0, 40.0,
-70.0, 35.0,
-75.0, 30.0,
-70.0, 30.0,
-68.0, 40.0
])
)
});
var geometry = Cesium.RiverGeometry.createGeometry(polygon);
// 2. create a nested polygon with holes
var polygonWithHole = new Cesium.RiverGeometry({
polygonHierarchy : new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArray([
-109.0, 30.0,
-95.0, 30.0,
-95.0, 40.0,
-109.0, 40.0
]),
[new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArray([
-107.0, 31.0,
-107.0, 39.0,
-97.0, 39.0,
-97.0, 31.0
]),
[new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArray([
-105.0, 33.0,
-99.0, 33.0,
-99.0, 37.0,
-105.0, 37.0
]),
[new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArray([
-103.0, 34.0,
-101.0, 34.0,
-101.0, 36.0,
-103.0, 36.0
])
)]
)]
)]
)
});
var geometry = Cesium.RiverGeometry.createGeometry(polygonWithHole);
// 3. create extruded polygon
var extrudedPolygon = new Cesium.RiverGeometry({
polygonHierarchy : new Cesium.PolygonHierarchy(
Cesium.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 = Cesium.RiverGeometry.createGeometry(extrudedPolygon);
成员变量
方法
# static computeRectangle(options, resultopt)
Returns the bounding rectangle given the provided options
参数:
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
options |
Object | Object with the following properties: |
|
polygonHierarchy |
PolygonHierarchy | A polygon hierarchy that can include holes. |
|
granularity |
Number | Cesium.Math.RADIANS_PER_DEGREE | The distance, in radians, between each latitude and longitude. Determines the number of positions sampled. |
arcType |
Cesium.ArcType | Cesium.ArcType.GEODESIC | The type of line the polygon edges must follow. Valid options are |
ellipsoid |
Cesium.Ellipsoid | Cesium.Ellipsoid.WGS84 | The ellipsoid to be used as a reference. |
result |
Cesium.Rectangle | An object in which to store the result. |
The result rectangle
# static createGeometry(polygonGeometry)
Computes the geometric representation of a polygon, including its vertices, indices, and a bounding sphere.
参数:
| 名称 | 类型 | 描述 |
|---|---|---|
polygonGeometry |
RiverGeometry | A description of the polygon. |
The computed vertices and indices.
# static fromPositions(options)
A description of a polygon from an array of positions. Polygon geometry can be rendered with both Primitive and GroundPrimitive.
参数:
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
options |
Object | Object with the following properties: |
|
positions |
Array.<Cesium.Cartesian3> | An array of positions that Cesium.defined the corner points of the polygon. |
|
height |
Number | 0.0 | The height of the polygon. |
extrudedHeight |
Number | The height of the polygon extrusion. |
|
vertexFormat |
Cesium.VertexFormat | Cesium.VertexFormat.DEFAULT | The vertex attributes to be computed. |
indices |
Array.<Number> | 自定义顶点索引 |
|
st |
Float32Array | 自定义UV坐标 |
|
stRotation |
Number | 0.0 | The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise. |
ellipsoid |
Cesium.Ellipsoid | Cesium.Ellipsoid.WGS84 | The ellipsoid to be used as a reference. |
granularity |
Number | Cesium.Math.RADIANS_PER_DEGREE | The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer. |
perPositionHeight |
Boolean | false | Use the height of options.positions for each position instead of using options.height to determine the height. |
closeTop |
Boolean | true | When false, leaves off the top of an extruded polygon open. |
closeBottom |
Boolean | true | When false, leaves off the bottom of an extruded polygon open. |
arcType |
Cesium.ArcType | Cesium.ArcType.GEODESIC | The type of line the polygon edges must follow. Valid options are |
- See:
-
- RiverGeometry#createGeometry
示例
// create a polygon from points
var polygon = Cesium.RiverGeometry.fromPositions({
positions : Cesium.Cartesian3.fromDegreesArray([
-72.0, 40.0,
-70.0, 35.0,
-75.0, 30.0,
-70.0, 30.0,
-68.0, 40.0
])
});
var geometry = Cesium.RiverGeometry.createGeometry(polygon);
# static pack(value, array, startingIndexopt)
Stores the provided instance into the provided array.
参数:
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
value |
RiverGeometry | The value to pack. |
|
array |
Array.<Number> | The array to pack into. |
|
startingIndex |
Number | 0 | The index into the array at which to start packing the elements. |
The array that was packed into
# static unpack(array, startingIndexopt, resultopt)
Retrieves an instance from a packed array.
参数:
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
array |
Array.<Number> | The packed array. |
|
startingIndex |
Number | 0 | The starting index of the element to be unpacked. |
result |
RiverGeometry | The object into which to store the result. |
