# new MapGISTerrainProvider(options)
MapGIS地形图层
参数:
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
options |
Object | ||
url |
String | Cesium.Resource | null | 服务基地址,当类型为字符串或者Cesium.Resource时, 表示仅加载一个DEM地形服务,如果是一个数组,则表示加载多个DEM地形服务, 此时传入的格式变为了[{url:'',range:{},range3D:{},requestVertexNormals:true,maxLevel:20}],详见Cesium.Resource |
tilingScheme |
Cesium.TilingScheme | Cesium.GeographicTilingScheme() | 地形的平铺方案,详见Cesium.TilingScheme |
range |
Object | null | 地形二维范围 |
range3D |
Object | null | 地形三维范围 |
requestVertexNormals |
Boolean | false | 是否请求法向量 |
maxLevel |
Number | 20 | 地形最大显示级数 |
terrainColorTblInfo |
Array | null | 地形分析-高程赋色功能的色表,格式为['#000000', '#2747E0', '#D33B7D', '#D33038', '#FF9742', '#ffd700', '#FFFFFF'] |
terrainColorTblMinHeight |
Number | null | 地形分析-高程赋色功能的最小高度 |
terrainColorTblMaxHeight |
Number | null | 地形分析-高程赋色功能的最大高度 |
repeat |
Cesium.Cartesian2 | new Cesium.Cartesian2(1, 1) | 坡度箭头重复次数,详见Cesium.Cartesian2 |
proxy |
Cesium.Proxy | null | 请求拦截器,可对最后发出的请求链接进行编辑,详见Cesium.Proxy |
serviceList |
Array | [] | 多个DEM地形服务列表。当url为空时,则加载serviceList中的多个DEM地形服务。 |
credit |
Cesium.Credit | null | A credit for the data source, which is displayed on the canvas,详见Cesium.Credit |
支持如下方法:
[1、通过场景服务的url获取MapGISTerrainProvider对象]成员变量
# readonly availability
该属性记录了MapGISTerrainProvider下的地形图层支持的级数和每一级数支持显示的地形瓦片行列号范围;
当提供了一个地形瓦片的级数、行号和列号时,可通过该对象的isTileAvailable方法知道地形图层是否包含该地形瓦片;
当MapGISTerrainProvider未加载完毕时,不可访问该对象;
当服务元信息中未包含available属性时,该对象为空;
Gets an object that can be used to determine availability of terrain from this provider, such as
at points and in rectangles. This function should not be called before
MapGISTerrainProvider.ready returns true. This property may be undefined if availability
information is not available. Note that this reflects tiles that are known to be available currently.
Additional tiles may be discovered to be available in the future, e.g. if availability information
exists deeper in the tree rather than it all being discoverable at the root. However, a tile that
is available now will not become unavailable in the future.
# readonly credit
Gets the credit to display when this terrain provider is active. Typically this is used to credit the source of the terrain. This function should not be called before Cesium.CesiumTerrainProvider.ready returns true.
# readonly errorEvent
Gets an event that is raised when the terrain provider encounters an asynchronous error. By subscribing to the event, you will be notified of the error and can potentially recover from it. Event listeners are passed an instance of Cesium.TileProviderError.
# readonly hasMetadata
Gets a value indicating whether or not the requested tiles include metadata. This function should not be called before Cesium.CesiumTerrainProvider.ready returns true.
# terrainColorTblInfo
地形分析-高程赋色功能的色表,格式为['#000000', '#2747E0', '#D33B7D', '#D33038', '#FF9742', '#ffd700', '#FFFFFF']
# readonly tilingScheme
Gets the tiling scheme used by this provider. This function should not be called before Cesium.CesiumTerrainProvider.ready returns true.
方法
# async static fromUrl(url, options)
参数:
名称 | 类型 | 描述 |
---|---|---|
url |
String | 服务的基地址 |
options |
Object | 实例化对象时提供的额外配置参数,若该对象中包含构造参数则会覆盖对应的构造参数 |
示例
const url = 'http://webclient.smaryun.com:8089/igs/rest/services/Scene/TwTerrain/SceneServer'
const addTerrainProvider = async (url) => {
const imageryProvider = await MapGISTerrainProvider.fromUrl(url)
if (terrainProvider) {
viewer.terrainProvider = terrainProvider
}
}
addTerrainProvider(url)