QuantizedMeshTerrainData

new Cesium.QuantizedMeshTerrainData(options)

单个瓦片的地形数据,其地形数据以量化网格(quantized mesh)的形式表示。量化 网格由三个顶点属性组成:经度、纬度和高度。所有属性均以 0 到 32767 范围内的 16 位值表示。经度和纬度在瓦片的西南角为 0,在东北角为 32767。高度在瓦片的最小高度处为 0, 在最大高度处为 32767。
Name Type Description
options object Object with the following properties:
Name Type Default Description
quantizedVertices Uint16Array 包含量化网格的缓冲区。
indices Uint16Array | Uint32Array 指定量化顶点如何 连接成三角形的索引。每三个索引指定一个三角形。
minimumHeight number 瓦片内的最小地形高度,以椭球面上方的米为单位。
maximumHeight number 瓦片内的最大地形高度,以椭球面上方的米为单位。
boundingSphere BoundingSphere 包围网格中所有顶点的球体。
orientedBoundingBox OrientedBoundingBox optional 包围网格中所有顶点的 OrientedBoundingBox。
horizonOcclusionPoint Cartesian3 网格的地平线遮挡点。如果此点 位于地平线以下,则假定整个瓦片也位于地平线以下。 该点以椭球缩放坐标表示。
westIndices Array.<number> 瓦片西边缘上顶点的索引。
southIndices Array.<number> 瓦片南边缘上顶点的索引。
eastIndices Array.<number> 瓦片东边缘上顶点的索引。
northIndices Array.<number> 瓦片北边缘上顶点的索引。
westSkirtHeight number 要在瓦片西边缘添加的裙边高度。
southSkirtHeight number 要在瓦片南边缘添加的裙边高度。
eastSkirtHeight number 要在瓦片东边缘添加的裙边高度。
northSkirtHeight number 要在瓦片北边缘添加的裙边高度。
childTileMask number 15 optional 一个位掩码,指示此瓦片的四个子瓦片中哪些存在。 如果某个子瓦片的位被置位,则在需要时会同时请求该瓦片的几何数据。 如果位被清除,则不会请求该子瓦片,而是从父瓦片进行上采样。 位值如下:
Bit PositionBit ValueChild Tile
01Southwest
12Southeast
24Northwest
38Northeast
createdByUpsampling boolean false optional 如果此实例是通过对另一个实例上采样创建的,则为 true; 否则为 false。
encodedNormals Uint8Array optional 包含逐顶点法线的缓冲区,使用 'oct' 编码方式编码。
waterMask Uint8Array optional 包含水掩码的缓冲区。
credits Array.<Credit> optional 此瓦片的版权声明数组。
Example:
const data = new Cesium.QuantizedMeshTerrainData({
    minimumHeight : -100,
    maximumHeight : 2101,
    quantizedVertices : new Uint16Array([// order is SW NW SE NE
                                         // longitude
                                         0, 0, 32767, 32767,
                                         // latitude
                                         0, 32767, 0, 32767,
                                         // heights
                                         16384, 0, 32767, 16384]),
    indices : new Uint16Array([0, 3, 1,
                               0, 2, 3]),
    boundingSphere : new Cesium.BoundingSphere(new Cesium.Cartesian3(1.0, 2.0, 3.0), 10000),
    orientedBoundingBox : new Cesium.OrientedBoundingBox(new Cesium.Cartesian3(1.0, 2.0, 3.0), Cesium.Matrix3.fromRotationX(Cesium.Math.PI, new Cesium.Matrix3())),
    horizonOcclusionPoint : new Cesium.Cartesian3(3.0, 2.0, 1.0),
    westIndices : [0, 1],
    southIndices : [0, 1],
    eastIndices : [2, 3],
    northIndices : [1, 3],
    westSkirtHeight : 1.0,
    southSkirtHeight : 1.0,
    eastSkirtHeight : 1.0,
    northSkirtHeight : 1.0
});
See:

Members

此瓦片的版权声明数组。

waterMask : Uint8Array|HTMLImageElement|HTMLCanvasElement|undefined

此地形数据中包含的水掩码(如果有)。水掩码是一个矩形 Uint8Array 或图像,其中值 255 表示水域,值 0 表示陆地。 也允许 0 到 255 之间的值,以在陆地和水域之间平滑混合。

Methods

interpolateHeight(rectangle, longitude, latitude)number

计算指定经度和纬度处的地形高度。
Name Type Description
rectangle Rectangle 此地形数据所覆盖的矩形范围。
longitude number 以弧度表示的经度。
latitude number 以弧度表示的纬度。
Returns:
指定位置处的地形高度。该位置会被限制在 矩形范围内,因此对于远离矩形的位置,结果可能不正确。

isChildAvailable(thisX, thisY, childX, childY)boolean

根据给定的 QuantizedMeshTerrainData.childTileMask 确定某个子瓦片是否可用。给定的子瓦片坐标被假定为 此瓦片四个子瓦片之一。如果给出的是非子瓦片坐标, 则返回东南子瓦片的可用性。
Name Type Description
thisX number 此(父)瓦片的瓦片 X 坐标。
thisY number 此(父)瓦片的瓦片 Y 坐标。
childX number 要检查可用性的子瓦片的瓦片 X 坐标。
childY number 要检查可用性的子瓦片的瓦片 Y 坐标。
Returns:
如果子瓦片可用则为 true;否则为 false。

upsample(tilingScheme, thisX, thisY, thisLevel, descendantX, descendantY, descendantLevel)Promise.<QuantizedMeshTerrainData>|undefined

对此地形数据进行上采样,以供后代瓦片使用。生成的实例将包含 此实例中顶点的一部分,必要时进行插值。
Name Type Description
tilingScheme TilingScheme 此地形数据的瓦片方案。
thisX number 此瓦片在瓦片方案中的 X 坐标。
thisY number 此瓦片在瓦片方案中的 Y 坐标。
thisLevel number 此瓦片在瓦片方案中的层级。
descendantX number 我们要对其进行上采样的后代瓦片在瓦片方案中的 X 坐标。
descendantY number 我们要对其进行上采样的后代瓦片在瓦片方案中的 Y 坐标。
descendantLevel number 我们要对其进行上采样的后代瓦片在瓦片方案中的层级。
Returns:
为后代瓦片提供上采样高度图地形数据的 promise, 如果过多的异步上采样操作正在进行且请求已被 推迟,则为 undefined。

wasCreatedByUpsampling()boolean

获取一个指示此地形数据是否通过对较低分辨率 地形数据上采样而创建的标记。如果此值为 false,则数据来自其他来源,例如 从远程服务器下载。对于通过调用 HeightmapTerrainData#upsample 返回的实例,此方法应返回 true。
Returns:
如果此实例是通过上采样创建的则为 true;否则为 false。
需要帮助?获取答案的最快方式是在 Cesium 论坛 上向社区和团队提问。