All files / engine/Source/Core TilingScheme.js

87.5% Statements 7/8
100% Branches 0/0
0% Functions 0/1
87.5% Lines 7/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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