@itwin/core-frontend
Version:
iTwin.js frontend components
130 lines • 8.41 kB
TypeScript
/** @packageDocumentation
* @module Tiles
*/
import { Point2d, Transform } from "@itwin/core-geometry";
import { Cartographic } from "@itwin/core-common";
import { IModelConnection } from "../../IModelConnection";
import { MapCartoRectangle } from "../internal";
/** A scheme for converting between two representations of the surface of the Earth: an ellipsoid and a rectangular [tiled map](https://en.wikipedia.org/wiki/Tiled_web_map).
* Positions on the surface of the ellipsoid are expressed in [Cartographic]($common) coordinates.
* Rectangular [[MapTile]]s are projected onto this ellipsoid by the tiling scheme. Tile coordinates are represented by [[QuadId]]s.
*
* The tiling scheme represents the (x,y) coordinates of its tiles as fractions in [0,1] along the X and Y axes.
* An X fraction of 0 corresponds to the easternmost longitude and an X fraction of 1 to the westernmost longitude.
* The scheme can choose to correlate a Y fraction of 0 with either the north or south pole, as specified by [[rowZeroAtNorthPole]].
* Implementing a tiling scheme only requires implementing the abstract method [[yFractionToLatitude]] and its inverse, [[latitudeToYFraction]].
* @public
*/
export declare abstract class MapTilingScheme {
/** If true, the fractional Y coordinate 0 corresponds to the north pole and 1 to the south pole; otherwise,
* 0 corresponds to the south pole and 1 to the north.
*/
readonly rowZeroAtNorthPole: boolean;
/** The number of tiles in the X direction at level 0 of the quad tree. */
readonly numberOfLevelZeroTilesX: number;
/** The number of tiles in the Y direction at level 0 of the quad tree. */
readonly numberOfLevelZeroTilesY: number;
private readonly _scratchFraction;
private readonly _scratchPoint2d;
/** Convert a longitude in [-pi, pi] radisn to a fraction in [0, 1] along the X axis. */
longitudeToXFraction(longitude: number): number;
/** Convert a fraction in [0, 1] along the X axis into a longitude in [-pi, pi] radians. */
xFractionToLongitude(xFraction: number): number;
/** Convert a fraction in [0, 1] along the Y axis into a latitude in [-pi/2, pi/2] radians. */
abstract yFractionToLatitude(yFraction: number): number;
/** Convert a latitude in [-pi/2, pi/2] radians into a fraction in [0, 1] along the Y axis. */
abstract latitudeToYFraction(latitude: number): number;
protected constructor(numberOfLevelZeroTilesX: number, numberOfLevelZeroTilesY: number, rowZeroAtNorthPole: boolean);
/** The total number of tiles in the X direction at the specified level of detail.
* @param level The level of detail, with 0 corresponding to the root tile.
*/
getNumberOfXTilesAtLevel(level: number): number;
/** The total number of tiles in the Y direction at the specified level of detail.
* @param level The level of detail, with 0 corresponding to the root tile.
*/
getNumberOfYTilesAtLevel(level: number): number;
/** @alpha */
get rootLevel(): 0 | -1;
/** @alpha */
getNumberOfXChildrenAtLevel(level: number): number;
/** @alpha */
getNumberOfYChildrenAtLevel(level: number): number;
/** Given the X component and level of a [[QuadId]], convert it to a fractional distance along the X axis. */
tileXToFraction(x: number, level: number): number;
/** Given the Y component and level of a [[QuadId]], convert it to a fractional distance along the Y axis. */
tileYToFraction(y: number, level: number): number;
/** Given a fractional distance along the X axis and a level of the quad tree, compute the X component of the corresponding [[QuadId]]. */
xFractionToTileX(xFraction: number, level: number): number;
/** Given a fractional distance along the Y axis and a level of the quad tree, compute the Y component of the corresponding [[QuadId]]. */
yFractionToTileY(yFraction: number, level: number): number;
/** Given the X component and level of a [[QuadId]], compute its longitude in [-pi, pi] radians. */
tileXToLongitude(x: number, level: number): number;
/** Given the Y component and level of a [[QuadId]], compute its latitude in [-pi/2, pi/2] radians. */
tileYToLatitude(y: number, level: number): number;
/** Given the components of a [[QuadId]], compute its fractional coordinates in the XY plane. */
tileXYToFraction(x: number, y: number, level: number, result?: Point2d): Point2d;
/** Given the components of a [[QuadId]] and an elevation, compute the corresponding [Cartographic]($common) position.
* @param x The X component of the QuadId.
* @param y The Y component of the QuadId.
* @param level The level component of the QuadId.
* @param height The elevation above the ellipsoid.
* @returns the corresponding cartographic position.
*/
tileXYToCartographic(x: number, y: number, level: number, result: Cartographic, height?: number): Cartographic;
/** Given the components of a [[QuadId]], compute the corresponding region of the Earth's surface. */
tileXYToRectangle(x: number, y: number, level: number, result?: MapCartoRectangle): MapCartoRectangle;
/** Returns true if the tile at the specified X coordinate and level is adjacent to the north pole. */
tileBordersNorthPole(row: number, level: number): boolean;
/** Returns true if the tile at the specified X coordinate and level is adjacent to the south pole. */
tileBordersSouthPole(row: number, level: number): boolean;
/** Given a cartographic position, compute the corresponding position on the surface of the Earth as fractional distances along the
* X and Y axes.
*/
cartographicToTileXY(carto: Cartographic, level: number, result?: Point2d): Point2d;
/** Given fractional coordinates in the XY plane and an elevation, compute the corresponding cartographic position. */
fractionToCartographic(xFraction: number, yFraction: number, result: Cartographic, height?: number): Cartographic;
/** Given a cartographic location on the surface of the Earth, convert it to fractional coordinates in the XY plane. */
cartographicToFraction(latitudeRadians: number, longitudeRadians: number, result: Point2d): Point2d;
/** @alpha */
private ecefToPixelFraction;
/** @alpha */
computeMercatorFractionToDb(ecefToDb: Transform, bimElevationOffset: number, iModel: IModelConnection, applyTerrain: boolean): Transform;
/** @alpha */
protected yFractionFlip(fraction: number): number;
}
/** A [[MapTilingScheme]] using a simple geographic projection by which longitude and latitude are mapped directly to X and Y.
* This projection is commonly known as "geographic", "equirectangular", "equidistant cylindrical", or "plate carrée".
* @beta
*/
export declare class GeographicTilingScheme extends MapTilingScheme {
constructor(numberOfLevelZeroTilesX?: number, numberOfLevelZeroTilesY?: number, rowZeroAtNorthPole?: boolean);
/** Implements [[MapTilingScheme.yFractionToLatitude]]. */
yFractionToLatitude(yFraction: number): number;
/** Implements [[MapTilingScheme.latitudeToYFraction]]. */
latitudeToYFraction(latitude: number): number;
}
/** @alpha */
export declare class WebMercatorProjection {
/**
* Converts a Mercator angle, in the range -PI to PI, to a geodetic latitude
* in the range -PI/2 to PI/2.
*
* @param {Number} mercatorAngle The angle to convert.
* @returns {Number} The geodetic latitude in radians.
*/
static mercatorAngleToGeodeticLatitude(mercatorAngle: number): number;
static maximumLatitude: number;
static geodeticLatitudeToMercatorAngle(latitude: number): number;
}
/** A [[MapTilingScheme]] using the [EPSG:3857](https://en.wikipedia.org/wiki/Web_Mercator_projection) projection.
* This scheme is used by most [tiled web maps](https://en.wikipedia.org/wiki/Tiled_web_map), including Bing Maps and Google Maps.
* @beta
*/
export declare class WebMercatorTilingScheme extends MapTilingScheme {
constructor(numberOfLevelZeroTilesX?: number, numberOfLevelZeroTilesY?: number, rowZeroAtNorthPole?: boolean);
/** Implements [[MapTilingScheme.yFractionToLatitude]]. */
yFractionToLatitude(yFraction: number): number;
/** Implements [[MapTilingScheme.latitudeToYFraction. */
latitudeToYFraction(latitude: number): number;
}
//# sourceMappingURL=MapTilingScheme.d.ts.map