PolylineGeometry

new Cesium.PolylineGeometry(options)

将折线描述为由一连串线段构成的线带;前两个位置定义一条线段, 而其后每个位置都从前一个位置定义一条线段。该折线能够 使用材质进行显示。
Name Type Description
options object Object with the following properties:
Name Type Default Description
positions Array.<Cartesian3> 一组 Cartesian3,将折线中的位置定义为线带。
width number 1.0 optional 以像素为单位的宽度。
colors Array.<Color> optional 一组 Color,定义每个顶点或每个线段的颜色。
colorsPerVertex boolean false optional 一个布尔值,决定颜色是沿折线的每个线段保持平直,还是在顶点之间进行插值。
arcType ArcType ArcType.GEODESIC optional 折线线段必须遵循的线类型。
granularity number CesiumMath.RADIANS_PER_DEGREE optional 如果 options.arcType 不是 ArcType.NONE,则为每个经度和纬度之间的间隔(单位:弧度)。决定缓冲区中位置的数量。
vertexFormat VertexFormat VertexFormat.DEFAULT optional 要计算的顶点属性。
ellipsoid Ellipsoid Ellipsoid.default optional 用作参考的椭球体。
Throws:
Example:
// A polyline with two connected line segments
const polyline = new Cesium.PolylineGeometry({
  positions : Cesium.Cartesian3.fromDegreesArray([
    0.0, 0.0,
    5.0, 0.0,
    5.0, 5.0
  ]),
  width : 10.0
});
const geometry = Cesium.PolylineGeometry.createGeometry(polyline);
Demo:
See:
  • PolylineGeometry#createGeometry

Members

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

Methods

static Cesium.PolylineGeometry.createGeometry(polylineGeometry)Geometry|undefined

计算折线的几何表示,包括其顶点、索引和包围球。
Name Type Description
polylineGeometry PolylineGeometry 对折线的描述。
Returns:
计算得到的顶点和索引。

static Cesium.PolylineGeometry.pack(value, array, startingIndex)Array.<number>

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

static Cesium.PolylineGeometry.unpack(array, startingIndex, result)PolylineGeometry

从打包后的数组中取出一个实例。
Name Type Default Description
array Array.<number> 已打包的数组。
startingIndex number 0 optional 要解包的元素起始索引。
result PolylineGeometry optional 用于存储结果的对象。
Returns:
被修改的 result 参数;如果未提供,则为一个新的 PolylineGeometry 实例。
需要帮助?获取答案的最快方式是在 Cesium 论坛 上向社区和团队提问。