QuantizedMeshTerrainData

new Cesium.QuantizedMeshTerrainData(options)

单个瓦片的地形数据,其中地形数据以量化网格表示。量化 网格由三个顶点属性组成:经度、纬度和高度。所有属性都表示为 0到32767范围内的16位值。经度和纬度在瓦片的西南角 为零,在东北角为32767。高度在瓦片的最小高度处 为零,在瓦片的最大高度处为32767。
Name Type Description
options object 具有以下属性的对象:
Name Type Default Description
quantizedVertices Uint16Array 包含量化网格的缓冲区。
indices Uint16Array | Uint32Array 指定量化顶点如何链接 在一起形成三角形的索引。每三个索引指定一个三角形。
minimumHeight number 瓦片内的最小地形高度,以椭球体以上的米为单位。
maximumHeight number 瓦片内的最大地形高度,以椭球体以上的米为单位。
boundingSphere BoundingSphere 包围网格中所有顶点的球体。
orientedBoundingBox OrientedBoundingBox optional 包围网格中所有顶点的定向边界框。
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 位掩码,指示此瓦片的四个子瓦片中哪些存在。 如果设置了子瓦片的位,则在需要时也会请求该瓦片的几何数据。如果清除了该位, 则不会请求子瓦片,而是从父瓦片向上采样几何数据。位值如下:
位位置位值子瓦片
01西南
12东南
24西北
38东北
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([// 顺序为西南、西北、东南、东北
                                         // 经度
                                         0, 0, 32767, 32767,
                                         // 纬度
                                         0, 32767, 0, 32767,
                                         // 高度
                                         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。
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.