TilingScheme.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import DeveloperError from "./DeveloperError.js";
  2. /**
  3. * A tiling scheme for geometry or imagery on the surface of an ellipsoid. At level-of-detail zero,
  4. * the coarsest, least-detailed level, the number of tiles is configurable.
  5. * At level of detail one, each of the level zero tiles has four children, two in each direction.
  6. * At level of detail two, each of the level one tiles has four children, two in each direction.
  7. * This continues for as many levels as are present in the geometry or imagery source.
  8. *
  9. * @alias TilingScheme
  10. * @constructor
  11. *
  12. * @see WebMercatorTilingScheme
  13. * @see GeographicTilingScheme
  14. */
  15. function TilingScheme(options) {
  16. //>>includeStart('debug', pragmas.debug);
  17. throw new DeveloperError(
  18. "This type should not be instantiated directly. Instead, use WebMercatorTilingScheme or GeographicTilingScheme."
  19. );
  20. //>>includeEnd('debug');
  21. }
  22. Object.defineProperties(TilingScheme.prototype, {
  23. /**
  24. * Gets the ellipsoid that is tiled by the tiling scheme.
  25. * @memberof TilingScheme.prototype
  26. * @type {Ellipsoid}
  27. */
  28. ellipsoid: {
  29. get: DeveloperError.throwInstantiationError,
  30. },
  31. /**
  32. * Gets the rectangle, in radians, covered by this tiling scheme.
  33. * @memberof TilingScheme.prototype
  34. * @type {Rectangle}
  35. */
  36. rectangle: {
  37. get: DeveloperError.throwInstantiationError,
  38. },
  39. /**
  40. * Gets the map projection used by the tiling scheme.
  41. * @memberof TilingScheme.prototype
  42. * @type {MapProjection}
  43. */
  44. projection: {
  45. get: DeveloperError.throwInstantiationError,
  46. },
  47. });
  48. /**
  49. * Gets the total number of tiles in the X direction at a specified level-of-detail.
  50. * @function
  51. *
  52. * @param {Number} level The level-of-detail.
  53. * @returns {Number} The number of tiles in the X direction at the given level.
  54. */
  55. TilingScheme.prototype.getNumberOfXTilesAtLevel =
  56. DeveloperError.throwInstantiationError;
  57. /**
  58. * Gets the total number of tiles in the Y direction at a specified level-of-detail.
  59. * @function
  60. *
  61. * @param {Number} level The level-of-detail.
  62. * @returns {Number} The number of tiles in the Y direction at the given level.
  63. */
  64. TilingScheme.prototype.getNumberOfYTilesAtLevel =
  65. DeveloperError.throwInstantiationError;
  66. /**
  67. * Transforms a rectangle specified in geodetic radians to the native coordinate system
  68. * of this tiling scheme.
  69. * @function
  70. *
  71. * @param {Rectangle} rectangle The rectangle to transform.
  72. * @param {Rectangle} [result] The instance to which to copy the result, or undefined if a new instance
  73. * should be created.
  74. * @returns {Rectangle} The specified 'result', or a new object containing the native rectangle if 'result'
  75. * is undefined.
  76. */
  77. TilingScheme.prototype.rectangleToNativeRectangle =
  78. DeveloperError.throwInstantiationError;
  79. /**
  80. * Converts tile x, y coordinates and level to a rectangle expressed in the native coordinates
  81. * of the tiling scheme.
  82. * @function
  83. *
  84. * @param {Number} x The integer x coordinate of the tile.
  85. * @param {Number} y The integer y coordinate of the tile.
  86. * @param {Number} level The tile level-of-detail. Zero is the least detailed.
  87. * @param {Object} [result] The instance to which to copy the result, or undefined if a new instance
  88. * should be created.
  89. * @returns {Rectangle} The specified 'result', or a new object containing the rectangle
  90. * if 'result' is undefined.
  91. */
  92. TilingScheme.prototype.tileXYToNativeRectangle =
  93. DeveloperError.throwInstantiationError;
  94. /**
  95. * Converts tile x, y coordinates and level to a cartographic rectangle in radians.
  96. * @function
  97. *
  98. * @param {Number} x The integer x coordinate of the tile.
  99. * @param {Number} y The integer y coordinate of the tile.
  100. * @param {Number} level The tile level-of-detail. Zero is the least detailed.
  101. * @param {Object} [result] The instance to which to copy the result, or undefined if a new instance
  102. * should be created.
  103. * @returns {Rectangle} The specified 'result', or a new object containing the rectangle
  104. * if 'result' is undefined.
  105. */
  106. TilingScheme.prototype.tileXYToRectangle =
  107. DeveloperError.throwInstantiationError;
  108. /**
  109. * Calculates the tile x, y coordinates of the tile containing
  110. * a given cartographic position.
  111. * @function
  112. *
  113. * @param {Cartographic} position The position.
  114. * @param {Number} level The tile level-of-detail. Zero is the least detailed.
  115. * @param {Cartesian2} [result] The instance to which to copy the result, or undefined if a new instance
  116. * should be created.
  117. * @returns {Cartesian2} The specified 'result', or a new object containing the tile x, y coordinates
  118. * if 'result' is undefined.
  119. */
  120. TilingScheme.prototype.positionToTileXY =
  121. DeveloperError.throwInstantiationError;
  122. export default TilingScheme;