qd-changjing/public/static/Build/Documentation/CustomHeightmapTerrainProvi...

1921 lines
73 KiB
HTML
Raw Normal View History

2022-07-05 16:56:29 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CustomHeightmapTerrainProvider - Cesium Documentation</title>
<!--[if lt IE 9]>
<script src="javascript/html5.js"></script>
<![endif]-->
<link href="styles/jsdoc-default.css" rel="stylesheet">
<link href="styles/prism.css" rel="stylesheet">
</head>
<body>
<div id="main">
<h1 class="page-title">
<a href="index.html"><img src="Images/CesiumLogo.png" class="cesiumLogo"></a>
CustomHeightmapTerrainProvider
<div class="titleCenterer"></div>
</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="nameContainer">
<h4 class="name" id="CustomHeightmapTerrainProvider">
<a href="#CustomHeightmapTerrainProvider" class="doc-link"></a>
new Cesium.CustomHeightmapTerrainProvider<span class="signature">(options)</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L57">Core/CustomHeightmapTerrainProvider.js 57</a>
</div>
</h4>
</div>
<div class="description">
A simple <a href="TerrainProvider.html"><code>TerrainProvider</code></a> that gets height values from a callback function.
It can be used for procedurally generated terrain or as a way to load custom
heightmap data without creating a subclass of <a href="TerrainProvider.html"><code>TerrainProvider</code></a>.
There are some limitations such as no water mask, no vertex normals, and no
availability, so a full-fledged <a href="TerrainProvider.html"><code>TerrainProvider</code></a> subclass is better suited
for these more sophisticated use cases.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
Object with the following properties:
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type"><a href="CustomHeightmapTerrainProvider.html#.GeometryCallback">CustomHeightmapTerrainProvider.GeometryCallback</a></span>
</td>
<td class="description last">
The callback function for requesting tile geometry.</td>
</tr>
<tr>
<td class="name"><code>width</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The number of columns per heightmap tile.</td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The number of rows per heightmap tile.</td>
</tr>
<tr>
<td class="name"><code>tilingScheme</code></td>
<td class="type">
<span class="param-type"><a href="TilingScheme.html">TilingScheme</a></span>
</td>
<td class="description last">
<span class="optional">optional</span>
The tiling scheme specifying how the ellipsoidal
surface is broken into tiles. If this parameter is not provided, a <a href="GeographicTilingScheme.html"><code>GeographicTilingScheme</code></a>
is used.</td>
</tr>
<tr>
<td class="name"><code>ellipsoid</code></td>
<td class="type">
<span class="param-type"><a href="Ellipsoid.html">Ellipsoid</a></span>
</td>
<td class="description last">
<span class="optional">optional</span>
The ellipsoid. If the tilingScheme is specified,
this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither
parameter is specified, the WGS84 ellipsoid is used.</td>
</tr>
<tr>
<td class="name"><code>credit</code></td>
<td class="type">
<span class="param-type"><a href="Credit.html">Credit</a></span>
|
<span class="param-type">String</span>
</td>
<td class="description last">
<span class="optional">optional</span>
A credit for the data source, which is displayed on the canvas.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">const viewer = new Cesium.Viewer("cesiumContainer", {
terrainProvider: new Cesium.CustomHeightmapTerrainProvider({
width: 32,
height: 32,
callback: function (x, y, level) {
return new Float32Array(32 * 32); // all zeros
},
}),
});</code></pre>
<h5>See:</h5>
<ul class="see-list">
<li><a href="TerrainProvider.html">TerrainProvider</a></li>
</ul>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<div class="nameContainer">
<h4 class="name" id="credit">
<a href="#credit" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> credit<span class="type-signature"> : <a href="Credit.html">Credit</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L118">Core/CustomHeightmapTerrainProvider.js 118</a>
</div>
</h4>
</div>
<div class="description">
Gets the credit to display when this terrain provider is active. Typically this is used to credit
the source of the terrain.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="errorEvent">
<a href="#errorEvent" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> errorEvent<span class="type-signature"> : <a href="Event.html">Event</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L105">Core/CustomHeightmapTerrainProvider.js 105</a>
</div>
</h4>
</div>
<div class="description">
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 <a href="TileProviderError.html"><code>TileProviderError</code></a>.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="hasVertexNormals">
<a href="#hasVertexNormals" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> hasVertexNormals<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L184">Core/CustomHeightmapTerrainProvider.js 184</a>
</div>
</h4>
</div>
<div class="description">
Gets a value indicating whether or not the requested tiles include vertex normals.
Vertex normals are not supported by <a href="CustomHeightmapTerrainProvider.html"><code>CustomHeightmapTerrainProvider</code></a>, so the return
value will always be false.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="hasWaterMask">
<a href="#hasWaterMask" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> hasWaterMask<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L170">Core/CustomHeightmapTerrainProvider.js 170</a>
</div>
</h4>
</div>
<div class="description">
Gets a value indicating whether or not the provider includes a water mask. The water mask
indicates which areas of the globe are water rather than land, so they can be rendered
as a reflective surface with animated waves.
Water mask is not supported by <a href="CustomHeightmapTerrainProvider.html"><code>CustomHeightmapTerrainProvider</code></a>, so the return
value will always be false.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="height">
<a href="#height" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> height<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L208">Core/CustomHeightmapTerrainProvider.js 208</a>
</div>
</h4>
</div>
<div class="description">
Gets the number of rows per heightmap tile.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="ready">
<a href="#ready" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> ready<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L142">Core/CustomHeightmapTerrainProvider.js 142</a>
</div>
</h4>
</div>
<div class="description">
Gets a value indicating whether or not the provider is ready for use.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="readyPromise">
<a href="#readyPromise" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> readyPromise<span class="type-signature"> : Promise.&lt;Boolean></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L154">Core/CustomHeightmapTerrainProvider.js 154</a>
</div>
</h4>
</div>
<div class="description">
Gets a promise that resolves to true when the provider is ready for use.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="tilingScheme">
<a href="#tilingScheme" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> tilingScheme<span class="type-signature"> : <a href="TilingScheme.html">TilingScheme</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L130">Core/CustomHeightmapTerrainProvider.js 130</a>
</div>
</h4>
</div>
<div class="description">
Gets the tiling scheme used by this provider.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="width">
<a href="#width" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> width<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L196">Core/CustomHeightmapTerrainProvider.js 196</a>
</div>
</h4>
</div>
<div class="description">
Gets the number of columns per heightmap tile.
</div>
<dl class="details">
</dl>
<h3 class="subsection-title">Methods</h3>
<div class="nameContainer">
<h4 class="name" id="getLevelMaximumGeometricError">
<a href="#getLevelMaximumGeometricError" class="doc-link"></a>
getLevelMaximumGeometricError<span class="signature">(level)</span> &rarr; <span class="type-signature returnType">Number</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L263">Core/CustomHeightmapTerrainProvider.js 263</a>
</div>
</h4>
</div>
<div class="description">
Gets the maximum geometric error allowed in a tile at a given level.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>level</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The tile level for which to get the maximum geometric error.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
The maximum geometric error.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="getTileDataAvailable">
<a href="#getTileDataAvailable" class="doc-link"></a>
getTileDataAvailable<span class="signature">(x, y, level)</span> &rarr; <span class="type-signature returnType">Boolean|undefined</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L277">Core/CustomHeightmapTerrainProvider.js 277</a>
</div>
</h4>
</div>
<div class="description">
Determines whether data for a tile is available to be loaded.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The X coordinate of the tile for which to request geometry.</td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The Y coordinate of the tile for which to request geometry.</td>
</tr>
<tr>
<td class="name"><code>level</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The level of the tile for which to request geometry.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
Undefined if not supported, otherwise true or false.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="loadTileDataAvailability">
<a href="#loadTileDataAvailability" class="doc-link"></a>
loadTileDataAvailability<span class="signature">(x, y, level)</span> &rarr; <span class="type-signature returnType">undefined|Promise.&lt;void></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L293">Core/CustomHeightmapTerrainProvider.js 293</a>
</div>
</h4>
</div>
<div class="description">
Makes sure we load availability data for a tile
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The X coordinate of the tile for which to request geometry.</td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The Y coordinate of the tile for which to request geometry.</td>
</tr>
<tr>
<td class="name"><code>level</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The level of the tile for which to request geometry.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="requestTileGeometry">
<a href="#requestTileGeometry" class="doc-link"></a>
requestTileGeometry<span class="signature">(x, y, level, <span class="optional">request</span>)</span> &rarr; <span class="type-signature returnType">Promise.&lt;<a href="TerrainData.html">TerrainData</a>>|undefined</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L228">Core/CustomHeightmapTerrainProvider.js 228</a>
</div>
</h4>
</div>
<div class="description">
Requests the geometry for a given tile. The result includes terrain
data and indicates that all child tiles are available.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The X coordinate of the tile for which to request geometry.</td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The Y coordinate of the tile for which to request geometry.</td>
</tr>
<tr>
<td class="name"><code>level</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The level of the tile for which to request geometry.</td>
</tr>
<tr>
<td class="name"><code>request</code></td>
<td class="type">
<span class="param-type"><a href="Request.html">Request</a></span>
</td>
<td class="description last">
<span class="optional">optional</span>
The request object. Intended for internal use only.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
A promise for the requested geometry. If this method
returns undefined instead of a promise, it is an indication that too many requests are already
pending and the request will be retried later.
</div>
<dl class="details">
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<div class="nameContainer">
<h4 class="name" id=".GeometryCallback">
<a href="#.GeometryCallback" class="doc-link"></a>
Cesium.CustomHeightmapTerrainProvider.GeometryCallback<span class="signature">(x, y, level)</span> &rarr; <span class="type-signature returnType">Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array|Array.&lt;Number>|Promise.&lt;(Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array|Array.&lt;Number>)>|undefined</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/CustomHeightmapTerrainProvider.js#L12">Core/CustomHeightmapTerrainProvider.js 12</a>
</div>
</h4>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The X coordinate of the tile for which to request geometry.</td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The Y coordinate of the tile for which to request geometry.</td>
</tr>
<tr>
<td class="name"><code>level</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The level of the tile for which to request geometry.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
An array or a promise to an array of heights in row-major order. If undefined, the globe will render the parent tile.
</div>
<dl class="details">
</dl>
</article>
</section>
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a>
</footer>
</div>
<div class="nav">
<div class="menu">
<input type="text" class="classFilter" id="ClassFilter" placeholder="Search">
<ul id="ClassList"><li data-name="Animation"><a href="Animation.html">Animation</a></li><li data-name="AnimationViewModel"><a href="AnimationViewModel.html">AnimationViewModel</a></li><li data-name="Appearance"><a href="Appearance.html">Appearance</a></li><li data-name="ArcGisMapServerImageryProvider"><a href="ArcGisMapServerImageryProvider.html">ArcGisMapServerImageryProvider</a></li><li data-name="ArcGISTiledElevationTerrainProvider"><a href="ArcGISTiledElevationTerrainProvider.html">ArcGISTiledElevationTerrainProvider</a></li><li data-name="ArcType"><a href="global.html#ArcType">ArcType</a></li><li data-name="AssociativeArray"><a href="AssociativeArray.html">AssociativeArray</a></li><li data-name="Axis"><a href="global.html#Axis">Axis</a></li><li data-name="AxisAlignedBoundingBox"><a href="AxisAlignedBoundingBox.html">AxisAlignedBoundingBox</a></li><li data-name="backFaceCulling"><a href="global.html#backFaceCulling">backFaceCulling</a></li><li data-name="barycentricCoordinates"><a href="global.html#barycentricCoordinates">barycentricCoordinates</a></li><li data-name="BaseLayerPicker"><a href="BaseLayerPicker.html">BaseLayerPicker</a></li><li data-name="BaseLayerPickerViewModel"><a href="BaseLayerPickerViewModel.html">BaseLayerPickerViewModel</a></li><li data-name="Billboard"><a href="Billboard.html">Billboard</a></li><li data-name="BillboardCollection"><a href="BillboardCollection.html">BillboardCollection</a></li><li data-name="BillboardGraphics"><a href="BillboardGraphics.html">BillboardGraphics</a></li><li data-name="BillboardVisualizer"><a href="BillboardVisualizer.html">BillboardVisualizer</a></li><li data-name="binarySearch"><a href="global.html#binarySearch">binarySearch</a></li><li data-name="binarySearchComparator"><a href="global.html#binarySearchComparator">binarySearchComparator</a></li><li data-name="BingMapsGeocoderService"><a href="BingMapsGeocoderService.html">BingMapsGeocoderService</a></li><li data-name="BingMapsImageryProvider"><a href="BingMapsImageryProvider.html">BingMapsImageryProvider</a></li><li data-name="BingMapsStyle"><a href="global.html#BingMapsStyle">BingMapsStyle</a></li><li data-name="BlendEquation"><a href="global.html#BlendEquation">BlendEquation</a></li><li data-name="BlendFunction"><a href="global.html#BlendFunction">BlendFunction</a></li><li data-name="BlendingState"><a href="BlendingState.html">BlendingState</a></li><li data-name="BlendOption"><a href="global.html#BlendOption">BlendOption</a></li><li data-name="BoundingRectangle"><a href="BoundingRectangle.html">BoundingRectangle</a></li><li data-name="BoundingSphere"><a href="BoundingSphere.html">BoundingSphere</a></li><li data-name="boundingSphere"><a href="global.html#boundingSphere">boundingSphere</a></li><li data-name="BoxEmitter"><a href="BoxEmitter.html">BoxEmitter</a></li><li data-name="BoxGeometry"><a href="BoxGeometry.html">BoxGeometry</a></li><li data-name="BoxGeometryUpdater"><a href="BoxGeometryUpdater.html">BoxGeometryUpdater</a></li><li data-name="BoxGraphics"><a href="BoxGraphics.html">BoxGraphics</a></li><li data-name="BoxOutlineGeometry"><a href="BoxOutlineGeometry.html">BoxOutlineGeometry</a></li><li data-name="buildModuleUrl"><a href="global.html#buildModuleUrl">buildModuleUrl</a></li><li data-name="CallbackProperty"><a href="CallbackProperty.html">CallbackProperty</a></li><li data-name="Camera"><a href="Camera.html">Camera</a></li><li data-name="CameraEventAggregator"><a href="CameraEventAggregator.html">CameraEventAggregator</a></li><li data-name="CameraEventType"><a href="global.html#CameraEventType">CameraEventType</a></li><li data-name="cancelAnimationFrame"><a href="global.html#cancelAnimationFrame">cancelAnimationFrame</a></li><li data-name="Cartesian2"><a href="Cartesian2.html">Cartesian2</a></li><li data-name="Cartesian3"><a href="Cartesian3.html">Cartesian3</a></li><li data-name="Cartesian4"><a href="Cartesian4.html">Cartesian4</a></li><li data-name="Cartographic"><a href="Cartographic.html">Cartographic</a></li><li data-name="CartographicGeocoderService"><a href="CartographicGeocoderServic
</div>
</div>
<script>
if (window.frameElement) {
document.body.className = 'embedded';
var ele = document.createElement('a');
ele.className = 'popout';
ele.target = '_blank';
ele.href = window.location.href;
ele.title = 'Pop out';
document.getElementById('main').appendChild(ele);
}
// Set targets on external links. Sandcastle and GitHub shouldn't be embedded in any iframe.
Array.prototype.forEach.call(document.getElementsByTagName('a'), function(a) {
if (/^https?:/i.test(a.getAttribute('href'))) {
a.target='_blank';
}
});
</script>
<script src="javascript/prism.js"></script>
<script src="javascript/cesiumDoc.js"></script>
</body>
</html>