Class: RiverGeometry

RiverGeometry

new RiverGeometry(options)

engineExtensions/core/RiverGeometry.js, line 771

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.

Name Type Description
options Object

Object with the following properties:

Name Type Default Description
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 Cesium.ArcType.GEODESIC and Cesium.ArcType.RHUMB.

See:
  • RiverGeometry#createGeometry
  • RiverGeometry#fromPositions
Example
// 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);

Members

_indices

feat:2106 河流覆盖物类型 传入自定义顶点indices 传入自定义UV坐标

packedLengthNumber

The number of elements used to pack the object into an array.

Methods

RiverGeometry.computeRectangle(options, result){Cesium.Rectangle}

engineExtensions/core/RiverGeometry.js, line 1064

Returns the bounding rectangle given the provided options

Name Type Description
options Object

Object with the following properties:

Name Type Default Description
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 Cesium.ArcType.GEODESIC and Cesium.ArcType.RHUMB.

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.

Returns:
Type Description
Cesium.Rectangle The result rectangle

RiverGeometry.createGeometry(polygonGeometry){Cesium.Geometry|undefined}

engineExtensions/core/RiverGeometry.js, line 1104

Computes the geometric representation of a polygon, including its vertices, indices, and a bounding sphere.

Name Type Description
polygonGeometry RiverGeometry

A description of the polygon.

Returns:
Type Description
Cesium.Geometry | undefined The computed vertices and indices.

RiverGeometry.fromPositions(options){RiverGeometry}

engineExtensions/core/RiverGeometry.js, line 896

A description of a polygon from an array of positions. Polygon geometry can be rendered with both Primitive and GroundPrimitive.

Name Type Description
options Object

Object with the following properties:

Name Type Default Description
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 Cesium.ArcType.GEODESIC and Cesium.ArcType.RHUMB.

See:
  • RiverGeometry#createGeometry
Returns:
Type Description
RiverGeometry
Example
// 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);

RiverGeometry.pack(value, array, startingIndex){Array.<Number>}

engineExtensions/core/RiverGeometry.js, line 938

Stores the provided instance into the provided array.

Name Type Default Description
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.

Returns:
Type Description
Array.<Number> The array that was packed into

RiverGeometry.unpack(array, startingIndex, result)

engineExtensions/core/RiverGeometry.js, line 986

Retrieves an instance from a packed array.

Name Type Default Description
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.