new Cesium.CesiumTerrainProvider(options)

要构造一个铯铁道厂,请拨打 CesiumTerrainProvider.fromIonAssetIdCesiumTerrainProvider.fromUrl . 不要直接给建筑师打电话.
A TerrainProvider that accesses terrain data in a Cesium terrain format. 地形格式可以是以下一种:
Name Type Description
options CesiumTerrainProvider.ConstructorOptions optional 描述初始化选项的对象
Example:
// Create Arctic DEM terrain with normals.
try {
  const viewer = new Cesium.Viewer("cesiumContainer", {
    terrainProvider: await Cesium.CesiumTerrainProvider.fromIonAssetId(3956, {
      requestVertexNormals: true
    })
  });
} catch (error) {
  console.log(error);
}
See:

Members

readonly availability : TileAvailability|undefined

从此提供者获取一个可用于确定地形可用的对象, 例如 在点和矩形上。 如果可用, 此属性可能未定义 资料不详。 请注意,这反映了目前已知可用的瓷砖. Additional tiles may be discovered to be available in the future, e.g. if availability information 更深处存在于树上 而不是在树根上都能发现 然而,一个瓷砖 现在可以使用,今后将不再无法使用.

readonly credit : Credit

当此地形提供者活动时, 获取信用值以显示 。 通常,这是用来信用的 地形的来源.

readonly errorEvent : Event

获得一个在地形提供者遇到同步错误时上升的事件 。 通过签名 对事件,您将被通知错误,并有可能从中恢复。 活动听众 are passed an instance of TileProviderError.

readonly hasMetadata : boolean

获得一个表示所请求的牌是否包含元数据的值.

readonly hasVertexNormals : boolean

获得一个表示所请求的牌是否包含顶点正常值的值.

readonly hasWaterMask : boolean

获得一个表示提供者是否包含水面罩的值 。 那个水面罩 说明全球哪些地区是水而不是土地,以便加以制造 作为带有动画波的反射面.

readonly requestMetadata : boolean

布尔旗,表示客户端是否应该请求服务器的元数据 . 元数据只有在客户端要求元数据时,才会附在标准的瓦片网格数据中 如果服务器提供了元数据.

readonly requestVertexNormals : boolean

布尔旗表示客户端是否应当请求服务器的顶点正常值 . Vertex正常数据只有在客户端要求顶点正常和 如果服务器提供顶点正常值.

readonly requestWaterMask : boolean

布尔旗, 表示客户端是否应当请求服务器提供水罩 . 只有在客户端要求水面罩和 如果服务器提供了水墨盒.

readonly tilingScheme : GeographicTilingScheme

获得此提供者使用的平板方案 .

Methods

static Cesium.CesiumTerrainProvider.fromIonAssetId(assetId, options)Promise.<CesiumTerrainProvider>

Creates a TerrainProvider from a Cesium ion asset ID that accesses terrain data in a Cesium terrain format 地形格式可以是以下一种:
Name Type Description
assetId number The Cesium ion asset id.
options CesiumTerrainProvider.ConstructorOptions optional 一个描述初始化选项的对象 .
Returns:
Throws:
  • RuntimeError : layer.json does not specify a format
  • RuntimeError : layer.json specifies an unknown format
  • RuntimeError : layer.json specifies an unsupported quantized-mesh version
  • RuntimeError : layer.json does not specify a tiles property, or specifies an empty array
  • RuntimeError : layer.json does not specify any tile URL templates
Example:
// Create Arctic DEM terrain with normals.
try {
  const viewer = new Cesium.Viewer("cesiumContainer", {
    terrainProvider: await Cesium.CesiumTerrainProvider.fromIonAssetId(3956, {
        requestVertexNormals: true
    })
  });
} catch (error) {
  console.log(error);
}

static Cesium.CesiumTerrainProvider.fromUrl(url, options)Promise.<CesiumTerrainProvider>

Creates a TerrainProvider that accesses terrain data in a Cesium terrain format. 地形格式可以是以下一种:
Name Type Description
url Resource | string | Promise.<Resource> | Promise.<string> Cesium 地形服务器的 URL .
options CesiumTerrainProvider.ConstructorOptions optional 一个描述初始化选项的对象 .
Returns:
Throws:
  • RuntimeError : layer.json does not specify a format
  • RuntimeError : layer.json specifies an unknown format
  • RuntimeError : layer.json specifies an unsupported quantized-mesh version
  • RuntimeError : layer.json does not specify a tiles property, or specifies an empty array
  • RuntimeError : layer.json does not specify any tile URL templates
Example:
// Create Arctic DEM terrain with normals.
try {
  const viewer = new Cesium.Viewer("cesiumContainer", {
    terrainProvider: await Cesium.CesiumTerrainProvider.fromUrl(
      Cesium.IonResource.fromAssetId(3956), {
        requestVertexNormals: true
    })
  });
} catch (error) {
  console.log(error);
}

getLevelMaximumGeometricError(level)number

获得特定关卡的瓷砖中允许的最大几何错误.
Name Type Description
level number 得到最大几何误差的瓦片级别.
Returns:
最大几何错误 .

getTileDataAvailable(x, y, level)boolean|undefined

确定是否有可加载的瓦片数据.
Name Type Description
x number 用于请求几何的瓷砖的X坐标.
y number 用于请求几何的瓦片的Y坐标.
level number 用于请求几何的瓦片的级别.
Returns:
Undefined if not supported or availability is unknown, otherwise true or false.

loadTileDataAvailability(x, y, level)undefined|Promise.<void>

确保加载一个瓦片的可用数据
Name Type Description
x number 用于请求几何的瓷砖的X坐标.
y number 用于请求几何的瓦片的Y坐标.
level number 用于请求几何的瓦片的级别.
Returns:
如果不需要加载, 或装入需要的牌时解决的 NT% 0 则未定义

requestTileGeometry(x, y, level, request)Promise.<TerrainData>|undefined

请求给定的瓦片的几何 。 其结果必须包括地形数据和 可选择包括一个水面罩,并注明有哪些儿童瓷砖.
Name Type Description
x number 用于请求几何的瓷砖的X坐标.
y number 用于请求几何的瓦片的Y坐标.
level number 用于请求几何的瓦片的级别.
request Request optional 请求对象 。 仅供内部使用.
Returns:
对要求的几何学的承诺. 如果这种方法 返回未定义而不是承诺,这表明已经有很多请求 待决,请求将在晚些时候重新审理.

Type Definitions

Cesium.CesiumTerrainProvider.ConstructorOptions

铯铁道制造器的初始化选项
Properties:
Name Type Attributes Default Description
requestVertexNormals boolean <optional>
false Flag that indicates if the client should request additional lighting information from the server, in the form of per vertex normals if available.
requestWaterMask boolean <optional>
false Flag that indicates if the client should request per tile water masks from the server, if available.
requestMetadata boolean <optional>
true Flag that indicates if the client should request per tile metadata from the server, if available.
ellipsoid Ellipsoid <optional>
Ellipsoid.default The ellipsoid. If not specified, the default ellipsoid is used.
credit Credit | string <optional>
数据源的信用,在画布上显示.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.