TerrainData.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import DeveloperError from "./DeveloperError.js";
  2. /**
  3. * Terrain data for a single tile. This type describes an
  4. * interface and is not intended to be instantiated directly.
  5. *
  6. * @alias TerrainData
  7. * @constructor
  8. *
  9. * @see HeightmapTerrainData
  10. * @see QuantizedMeshTerrainData
  11. * @see GoogleEarthEnterpriseTerrainData
  12. */
  13. function TerrainData() {
  14. DeveloperError.throwInstantiationError();
  15. }
  16. Object.defineProperties(TerrainData.prototype, {
  17. /**
  18. * An array of credits for this tile.
  19. * @memberof TerrainData.prototype
  20. * @type {Credit[]}
  21. */
  22. credits: {
  23. get: DeveloperError.throwInstantiationError,
  24. },
  25. /**
  26. * The water mask included in this terrain data, if any. A water mask is a rectangular
  27. * Uint8Array or image where a value of 255 indicates water and a value of 0 indicates land.
  28. * Values in between 0 and 255 are allowed as well to smoothly blend between land and water.
  29. * @memberof TerrainData.prototype
  30. * @type {Uint8Array|HTMLImageElement|HTMLCanvasElement}
  31. */
  32. waterMask: {
  33. get: DeveloperError.throwInstantiationError,
  34. },
  35. });
  36. /**
  37. * Computes the terrain height at a specified longitude and latitude.
  38. * @function
  39. *
  40. * @param {Rectangle} rectangle The rectangle covered by this terrain data.
  41. * @param {Number} longitude The longitude in radians.
  42. * @param {Number} latitude The latitude in radians.
  43. * @returns {Number} The terrain height at the specified position. If the position
  44. * is outside the rectangle, this method will extrapolate the height, which is likely to be wildly
  45. * incorrect for positions far outside the rectangle.
  46. */
  47. TerrainData.prototype.interpolateHeight =
  48. DeveloperError.throwInstantiationError;
  49. /**
  50. * Determines if a given child tile is available, based on the
  51. * {@link TerrainData#childTileMask}. The given child tile coordinates are assumed
  52. * to be one of the four children of this tile. If non-child tile coordinates are
  53. * given, the availability of the southeast child tile is returned.
  54. * @function
  55. *
  56. * @param {Number} thisX The tile X coordinate of this (the parent) tile.
  57. * @param {Number} thisY The tile Y coordinate of this (the parent) tile.
  58. * @param {Number} childX The tile X coordinate of the child tile to check for availability.
  59. * @param {Number} childY The tile Y coordinate of the child tile to check for availability.
  60. * @returns {Boolean} True if the child tile is available; otherwise, false.
  61. */
  62. TerrainData.prototype.isChildAvailable = DeveloperError.throwInstantiationError;
  63. /**
  64. * Creates a {@link TerrainMesh} from this terrain data.
  65. * @function
  66. *
  67. * @private
  68. *
  69. * @param {TilingScheme} tilingScheme The tiling scheme to which this tile belongs.
  70. * @param {Number} x The X coordinate of the tile for which to create the terrain data.
  71. * @param {Number} y The Y coordinate of the tile for which to create the terrain data.
  72. * @param {Number} level The level of the tile for which to create the terrain data.
  73. * @returns {Promise.<TerrainMesh>|undefined} A promise for the terrain mesh, or undefined if too many
  74. * asynchronous mesh creations are already in progress and the operation should
  75. * be retried later.
  76. */
  77. TerrainData.prototype.createMesh = DeveloperError.throwInstantiationError;
  78. /**
  79. * Upsamples this terrain data for use by a descendant tile.
  80. * @function
  81. *
  82. * @param {TilingScheme} tilingScheme The tiling scheme of this terrain data.
  83. * @param {Number} thisX The X coordinate of this tile in the tiling scheme.
  84. * @param {Number} thisY The Y coordinate of this tile in the tiling scheme.
  85. * @param {Number} thisLevel The level of this tile in the tiling scheme.
  86. * @param {Number} descendantX The X coordinate within the tiling scheme of the descendant tile for which we are upsampling.
  87. * @param {Number} descendantY The Y coordinate within the tiling scheme of the descendant tile for which we are upsampling.
  88. * @param {Number} descendantLevel The level within the tiling scheme of the descendant tile for which we are upsampling.
  89. * @returns {Promise.<TerrainData>|undefined} A promise for upsampled terrain data for the descendant tile,
  90. * or undefined if too many asynchronous upsample operations are in progress and the request has been
  91. * deferred.
  92. */
  93. TerrainData.prototype.upsample = DeveloperError.throwInstantiationError;
  94. /**
  95. * Gets a value indicating whether or not this terrain data was created by upsampling lower resolution
  96. * terrain data. If this value is false, the data was obtained from some other source, such
  97. * as by downloading it from a remote server. This method should return true for instances
  98. * returned from a call to {@link TerrainData#upsample}.
  99. * @function
  100. *
  101. * @returns {Boolean} True if this instance was created by upsampling; otherwise, false.
  102. */
  103. TerrainData.prototype.wasCreatedByUpsampling =
  104. DeveloperError.throwInstantiationError;
  105. export default TerrainData;