TilingScheme.js 5.2 KB

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