TerrainData.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import defineProperties from './defineProperties.js';
  2. import DeveloperError from './DeveloperError.js';
  3. /**
  4. * Terrain data for a single tile. This type describes an
  5. * interface and is not intended to be instantiated directly.
  6. *
  7. * @alias TerrainData
  8. * @constructor
  9. *
  10. * @see HeightmapTerrainData
  11. * @see QuantizedMeshTerrainData
  12. */
  13. function TerrainData() {
  14. DeveloperError.throwInstantiationError();
  15. }
  16. 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|Image|Canvas}
  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 = DeveloperError.throwInstantiationError;
  48. /**
  49. * Determines if a given child tile is available, based on the
  50. * {@link TerrainData#childTileMask}. The given child tile coordinates are assumed
  51. * to be one of the four children of this tile. If non-child tile coordinates are
  52. * given, the availability of the southeast child tile is returned.
  53. * @function
  54. *
  55. * @param {Number} thisX The tile X coordinate of this (the parent) tile.
  56. * @param {Number} thisY The tile Y coordinate of this (the parent) tile.
  57. * @param {Number} childX The tile X coordinate of the child tile to check for availability.
  58. * @param {Number} childY The tile Y coordinate of the child tile to check for availability.
  59. * @returns {Boolean} True if the child tile is available; otherwise, false.
  60. */
  61. TerrainData.prototype.isChildAvailable = DeveloperError.throwInstantiationError;
  62. /**
  63. * Creates a {@link TerrainMesh} from this terrain data.
  64. * @function
  65. *
  66. * @private
  67. *
  68. * @param {TilingScheme} tilingScheme The tiling scheme to which this tile belongs.
  69. * @param {Number} x The X coordinate of the tile for which to create the terrain data.
  70. * @param {Number} y The Y coordinate of the tile for which to create the terrain data.
  71. * @param {Number} level The level of the tile for which to create the terrain data.
  72. * @returns {Promise.<TerrainMesh>|undefined} A promise for the terrain mesh, or undefined if too many
  73. * asynchronous mesh creations are already in progress and the operation should
  74. * be retried later.
  75. */
  76. TerrainData.prototype.createMesh = DeveloperError.throwInstantiationError;
  77. /**
  78. * Upsamples this terrain data for use by a descendant tile.
  79. * @function
  80. *
  81. * @param {TilingScheme} tilingScheme The tiling scheme of this terrain data.
  82. * @param {Number} thisX The X coordinate of this tile in the tiling scheme.
  83. * @param {Number} thisY The Y coordinate of this tile in the tiling scheme.
  84. * @param {Number} thisLevel The level of this tile in the tiling scheme.
  85. * @param {Number} descendantX The X coordinate within the tiling scheme of the descendant tile for which we are upsampling.
  86. * @param {Number} descendantY The Y coordinate within the tiling scheme of the descendant tile for which we are upsampling.
  87. * @param {Number} descendantLevel The level within the tiling scheme of the descendant tile for which we are upsampling.
  88. * @returns {Promise.<TerrainData>|undefined} A promise for upsampled terrain data for the descendant tile,
  89. * or undefined if too many asynchronous upsample operations are in progress and the request has been
  90. * deferred.
  91. */
  92. TerrainData.prototype.upsample = DeveloperError.throwInstantiationError;
  93. /**
  94. * Gets a value indicating whether or not this terrain data was created by upsampling lower resolution
  95. * terrain data. If this value is false, the data was obtained from some other source, such
  96. * as by downloading it from a remote server. This method should return true for instances
  97. * returned from a call to {@link TerrainData#upsample}.
  98. * @function
  99. *
  100. * @returns {Boolean} True if this instance was created by upsampling; otherwise, false.
  101. */
  102. TerrainData.prototype.wasCreatedByUpsampling = DeveloperError.throwInstantiationError;
  103. export default TerrainData;