TerrainProviderFlat
压平指定区域的地形
TerrainProviderFlat(options)
options | 说明 |
---|---|
url | cesium 地形服务 url |
flattenPositions | 压平区域,经纬度数组[lat,lng] |
flattenHeight | 压平高度,默认 0 |
其他 | 支持所有 Cesium.CesiumTerrainProvider 参数 |
.fromUrl(url, options): Promise.<TerrainProviderFlat>
通过静态方法 fromUrl 创建实例,适用于 cesium 1.107 之后的版本
示例代码:
const flattenPositions = [
[116.29162576772252, 40.28716816416023],
[116.28193390729905, 40.285877601094036],
[116.28305798648037, 40.29338328209833],
[116.29575557530349, 40.294120209992876],
[116.29162576772252, 40.28716816416023],
];
//cesium 1.107 版本前:
const terrainProvider = new DT.TerrainProviderFlat({
url: Cesium.IonResource.fromAssetId(1),
flattenPositions,
flattenHeight:500,
requestVertexNormals: false,
requestWaterMask: false
})
viewer.terrainProvider = terrainProvider;
//cesium 1.107 版本后:
const terrainProvider = await DT.TerrainProviderFlat.fromUrl(
Cesium.IonResource.fromAssetId(1),
{
flattenPositions,
flattenHeight: 500,
requestVertexNormals: false,
requestWaterMask: false,
}
);
viewer.terrainProvider = terrainProvider;