BufferPolygon
Cesium v1.147 · 中文

视图绑定到 BufferPolygonCollection 的底层缓冲数据上。

BufferPolygon 实例是 flyweights: 单个 BufferPolygon 实例可以临时绑定到任何概念 BufferPolygonCollection 中的“多边形”,使得非常大的集合能够 被迭代并更新,且内存占用最小。

表示为一个(1)外部线性环,包含三(3)个或更多位置。 可以可选地定义一个或多个内部线性环(“洞”)在 多边形内。每个洞表示为位置数组中的单个索引, 该索引处的顶点是内部线性环的起始点,该环 沿着后续顶点继续延伸,直到到达下一个洞的索引顶点或顶点列表的末尾。存储预计算的 三角剖分,每个三角形表示为三个顶点索引。

此功能尚未定稿,可能会根据 Cesium 的标准弃用政策进行更改。

new Cesium.BufferPolygon()

Experimental

This feature is not final and is subject to change without Cesium's standard deprecation policy.

See:

Extends

Members

与原始类型相关的功能ID;不要求唯一。
Inherited From:

readonly holeCount : number

到达位置数组的末尾或下一个孔洞偏移量。

readonly outerVertexCount : number

该多边形外线性环中顶点的数量。 VEC3 元素的数量。

readonly outerVertexOffset : number

集合位置数组中的偏移量到多边形外环的第一个顶点。 线性环,VEC3 元素的数量。

pickObject : object|undefined

用户定义的拾取对象,如有。当原始对象被渲染后, 拾取对象便无法再被更改。
Inherited From:
表示原始类型是否显示的布尔(0或1)标志。
Inherited From:

readonly triangleCount : number

Count of triangles in this polygon, number of VEC3 elements.

readonly vertexCount : number

Count of positions (vertices) in this polygon, including both outer ring and internal rings (holes), number of VEC3 elements.

Methods

static Cesium.BufferPolygon.clone(polygon, result) → BufferPolygon

将数据从源多边形复制到结果多边形。如果结果多边形不是 新的(集合中的最后一个多边形),则源和结果多边形必须具有相同的顶点数、洞数和三角形数。 must have the same vertex counts, hole counts, and triangle counts.
Name Type Description
polygon BufferPolygon
result BufferPolygon
Returns:

getHolePositions(holeIndex, result)

在集合三角形数组中指向多边形第一个三角形的偏移量, VEC3 元素的数量。 该多边形中三角形的数量,VEC3 元素的数量。 memory — changes to this array will not trigger render updates, which requires `.setPositions()`.
Name Type Description
holeIndex number
result TypedArray optional return {TypedArray}

getHoles(result) → TypedArray

如果提供 ‘result’ 参数,则将孔洞索引写入该数组并返回。否则,返回集合内存中的 ArrayView —— 对该数组的修改不会触发渲染更新,需使用 `.setHoles()`。 设置该多边形的孔洞索引,每个孔洞表示为该多边形位置数组中的一个偏移量。每个孔洞隐含地 从该顶点偏移量开始沿着内部线性环继续,直到 到达位置数组的末尾或下一个孔洞偏移量。 如果提供 ‘result’ 参数,则将孔洞索引写入该数组并返回。否则,返回集合内存中的 ArrayView —— 对该数组的修改不会触发渲染更新,需使用 `.setHoles()`。 返回指定孔洞中 (VEC3) 顶点的数量。 返回指定孔洞内线性环顶点位置的数组视图。如果提供 ‘result’ 参数,则将顶点位置写入该数组并返回。否则,返回集合内存中的 ArrayView —— 对该数组的修改不会触发渲染更新,需使用 `.setPositions()`。
Name Type Description
result TypedArray optional
Returns:

getHoleVertexCount(holeIndex) → number

否则,返回集合内存中的 ArrayView。
Name Type Description
holeIndex number
Returns:
Name Type Description
result BufferPrimitiveMaterial
Returns:
Inherited From:

getOuterPositions(result) → TypedArray

返回该多边形外线性环顶点位置的数组视图。 如果提供 ‘result’ 参数,则将顶点位置写入该数组并返回。否则,返回集合内存中的 ArrayView —— 对该数组的修改不会触发渲染更新,需使用 `.setPositions()`。 在集合孔洞数组中指向多边形第一个孔洞的偏移量,以及 整数元素的数量。 该多边形中孔洞的索引数量。
Name Type Description
result TypedArray optional
Returns:
返回该多边形顶点位置的数组视图。如果给出 'result' 参数, 顶点位置将写入该数组并返回。 否则,返回集合内存上的 ArrayView — 对该数组的更改不会触发渲染更新,这需要使用 `.setPositions()`。 返回 {TypedArray}
Name Type Description
result TypedArray optional return {TypedArray}

getTriangles(result) → TypedArray

返回一个该多边形三角形索引的数组视图,格式为: 每个三角形包含三个顶点索引。 如果提供 ‘result’ 参数,则将三角形索引写入该数组并返回。 否则,在集合内存中返回一个 ArrayView —— 对该数组的修改不会触发渲染更新,这需要调用 `.setTriangles()`。
Name Type Description
result TypedArray optional
Returns:
返回 {TypedArray}。 访问顶点位置的内部辅助函数。‘vertexOffset’ 参数 相对于多边形顶点块的起始位置,0 表示 多边形中的第一个顶点。如果提供 ‘result’ 参数,则将请求范围内的顶点写入结果数组并返回。
Name Type Description
holes TypedArray
Name Type Description
material BufferPrimitiveMaterial
Inherited From:
Name Type Description
positions TypedArray
设置该多边形的三角形索引,格式为每个三角形三个顶点索引。
Name Type Description
indices TypedArray
返回一个可序列化为 JSON 的对象来表示该多边形。这种编码方式 不节省内存,通常适用于调试和 测试。
Returns:
JSON-serializable object.
Inherited From:
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.