PolygonOutlineGeometry

new Cesium.PolygonOutlineGeometry(options)

在椭球体上多边形轮廓的描述。多边形由一个多边形层次结构定义。
Name Type Description
options Object 对象,具有以下属性:
Name Type Default Description
polygonHierarchy PolygonHierarchy 包含孔洞(holes)的多边形层次结构。
height Number 0.0 optional 边形与椭球面的距离,单位为米。
extrudedHeight Number optional 边形的挤压面与椭球面的距离,单位为米。
vertexFormat VertexFormat VertexFormat.DEFAULT optional 要计算的顶点属性。
ellipsoid Ellipsoid Ellipsoid.WGS84 optional 用作参考的椭球体。
granularity Number CesiumMath.RADIANS_PER_DEGREE optional 每个经度和纬度之间的距离,以弧度表示。确定缓冲区中的位置数。
perPositionHeight Boolean false optional 为每个位置使用options.positions的高度,而不是使用options.height来确定高度。
arcType ArcType ArcType.GEODESIC optional 多边形边缘必须遵循的线的类型。有效的选项是ArcType.GEODESICArcType.RHUMB
Example:
// 1. 从多个点创建一个多边形轮廓
var polygon = new Cesium.PolygonOutlineGeometry({
  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.PolygonOutlineGeometry.createGeometry(polygon);

// 2. . 创建一个有洞的嵌套多边形轮廓
var polygonWithHole = new Cesium.PolygonOutlineGeometry({
  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.PolygonOutlineGeometry.createGeometry(polygonWithHole);

// 3. 创建挤压多边形轮廓
var extrudedPolygon = new Cesium.PolygonOutlineGeometry({
  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.PolygonOutlineGeometry.createGeometry(extrudedPolygon);
See:
  • PolygonOutlineGeometry#createGeometry
  • PolygonOutlineGeometry#fromPositions

Members

packedLength : Number

用于将对象打包成数组的元素数。

Methods

staticCesium.PolygonOutlineGeometry.createGeometry(polygonGeometry)Geometry|undefined

计算多边形轮廓的几何表示,包括其顶点、索引和包围球。
Name Type Description
polygonGeometry PolygonOutlineGeometry 多边形轮廓的描述。
Returns:
计算的顶点和索引。

staticCesium.PolygonOutlineGeometry.fromPositions(options)PolygonOutlineGeometry

从位置数组中对多边形轮廓的描述。
Name Type Description
options Object 对象,具有以下属性:
Name Type Default Description
positions Array.<Cartesian3> 定义多边形的角点的位置数组。
height Number 0.0 optional 多边形的高度。
extrudedHeight Number optional 多边形挤压的高度。
ellipsoid Ellipsoid Ellipsoid.WGS84 optional 用作参考的椭球体。
granularity Number CesiumMath.RADIANS_PER_DEGREE optional 每个经度和纬度之间的距离,以弧度表示。确定缓冲区中的位置数。
perPositionHeight Boolean false optional 为每个位置使用options.positions的高度,而不是使用options.height来确定高度。
arcType ArcType ArcType.GEODESIC optional 多边形边缘必须遵循的线的类型。有效的选项是ArcType.GEODESICArcType.RHUMB
Returns:
Example:
// 从多个点创建一个多边形轮廓
var polygon = Cesium.PolygonOutlineGeometry.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.PolygonOutlineGeometry.createGeometry(polygon);
See:
  • PolygonOutlineGeometry#createGeometry

staticCesium.PolygonOutlineGeometry.pack(value, array, startingIndex)Array.<Number>

将提供的实例存储到提供的数组中。
Name Type Default Description
value PolygonOutlineGeometry 要包装的值。
array Array.<Number> 要被包装到的数组。
startingIndex Number 0 optional 开始包装元素的数组索引。
Returns:
被包装到的数组。

staticCesium.PolygonOutlineGeometry.unpack(array, startingIndex, result)PolygonOutlineGeometry

从已包装的数组中检索实例。
Name Type Default Description
array Array.<Number> 包装的数组。
startingIndex Number 0 optional 要解包的元素的起始索引。
result PolygonOutlineGeometry optional 存储结果的对象。
Returns:
修改后的结果参数或新的PolygonOutlineGeometry实例(如果没有提供)。