new HeightmapTerrainData()
Single terrain tile data (stored in the form of a height map); A height map is a rectangular array composed of elevation values, arranged in main row order (data direction: north to south for row direction, west to east for column direction)
| Name | Type | Default | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options.buffer |
TypedArray |
A buffer containing height data. |
|||||||||||||||||||||||||||||||||||||
options.width |
Number |
The width (longitude direction) of the altitude map, measured in samples. |
|||||||||||||||||||||||||||||||||||||
options.height |
Number |
The height (latitude direction) of the altitude map, measured in samples. |
|||||||||||||||||||||||||||||||||||||
options.childTileMask |
Number | 15 |
optional
A bit mask used to indicate whether the four sub tiles of the tile exist. If the corresponding bit of a sub tile is set to 1, the geometric data of that sub tile will be requested when needed; If the bit is 0, the child tile is not requested, but upsampled from the parent tile data. The corresponding bit values for each sub tile are as follows:
|
||||||||||||||||||||||||||||||||||||
options.structure |
Object |
optional
Describe objects with high data structures.
|
|||||||||||||||||||||||||||||||||||||
options.createdByUpsampling |
Boolean | false |
optional
If this instance was created by upsampling another instance, it is true; Otherwise, it is false. |
Example
var buffer = ...
var heightBuffer = new Uint16Array(buffer, 0, that._heightmapWidth * that._heightmapWidth);
var childTileMask = new Uint8Array(buffer, heightBuffer.byteLength, 1)[0];
var waterMask = new Uint8Array(buffer, heightBuffer.byteLength + 1, buffer.byteLength - heightBuffer.byteLength - 1);
var terrainData = new SuperMap3D.HeightmapTerrainData({
buffer : heightBuffer,
width : 65,
height : 65,
childTileMask : childTileMask,
waterMask : waterMask
});
Members
-
readonly creditsArray.<Credit>
-
The copyright statement for this tile.
-
readonly waterMaskUint8Array Image Canvas
-
The text water area mask contained in this terrain data. The water mask is a square Uint8Array or image with values between 0 and 255.
Methods
-
interpolateHeight(rectangle, longitude, latitude){Number}
-
Calculate the terrain height at the specified latitude and longitude.
Name Type Description rectangleRectangle The rectangular area covered by the terrain data.
longitudeNumber Longitude, measured in radians.
latitudeNumber Latitude measured in radians.
Returns:
Type Description Number The terrain height at the specified location. If the position is not within the rectangular range, this method will calculate the height, but for positions far outside the rectangular range, the calculated height is likely to be significantly larger than for positions far outside the rectangle, and the calculated height is likely to be vastly different. -
isChildAvailable(thisX, thisY, childX, childY){Boolean}
-
Determine whether the given sub terrain map is available based on HeightmapTerrainData.childTileMask. The given sub topographic map coordinates are assumed to be one of the four sub topographic maps of the topographic map. If non sub topographic map coordinates are given, the availability of sub topographic maps in the southeast direction will be returned.
Name Type Description thisXNumber The X coordinate of the tile (parent tile).
thisYNumber The Y coordinate of the tile (parent tile).
childXNumber Check the X coordinate of the available sub tiles.
childYNumber Check the Y coordinate of the available sub tiles.
Returns:
Type Description Boolean If sub tiles are available, then true; Otherwise, it is false. -
upsample(tilingScheme, thisX, thisY, thisLevel, descendantX, descendantY, descendantLevel){Promise.<HeightmapTerrainData>|undefined}
-
High sampling of terrain data for future tile use. The generated instance will contain a subset of the high samples in this instance, and interpolation will be performed if necessary.
Name Type Description tilingSchemeTilingScheme The slicing scheme for the terrain data.
thisXNumber The X-coordinate of the tile in the slicing scheme.
thisYNumber The Y coordinate of the tile in the slicing scheme.
thisLevelNumber The level of the tile in the tile slicing scheme.
descendantXNumber The X-coordinate of the sub tiles to be upsampled in the slicing scheme.
descendantYNumber The Y coordinate of the sub tiles that require high sampling in the slicing scheme.
descendantLevelNumber The level of the tile in the slicing scheme.
Returns:
Type Description Promise.<HeightmapTerrainData> | undefined Promise for high sampling terrain data of sub tiles; If there are too many asynchronous high sampling operations in progress and the request is delayed, it is undefined. -
wasCreatedByUpsampling(){Boolean}
-
Get a value indicating whether the terrain data was created by upsampling low resolution terrain data. If the value is false, it indicates that the data was obtained from another source, such as downloading from a remote server. For the instance returned by calling HeightmapTerrainData # upsample, this method should return true.
Returns:
Type Description Boolean If the instance was created through high sampling, it is true; Otherwise, it is false.