UNPKG

@yandex/ymaps3-types

Version:

Types for ymaps3 maps library

51 lines (50 loc) 1.74 kB
import type { Projection, LngLat, WorldCoordinates } from "../../common/types"; /** * Creates a projection of a rectangular coordinate area into world coordinates. * The area size in pixels is always 2*2. * * @name Cartesian * @class Cartesian projection of a rectangular area. * @augments Projection * @param {[[Number, Number], [Number, Number]]} bounds An array of two points - * coordinates of the lower left and upper right corners of the rectangular coordinate area. * @param {Boolean[]} [cycled=[false, false]] An array of signs of map looping by x and y. * @example * ```js * ymaps3.ready(async () => { * const {YMaps} = ymaps3; * // Calculate the size of all tiles at the maximum zoom. * const worldSize = Math.pow(2, MAX_ZOOM) * 256; * const PIC_WIDTH = 2526; * const PIC_HEIGHT = 1642; * * const {Cartesian} = await ymaps3.import('@yandex/ymaps3-cartesian-projection@0.0.1'); * // We set as a projection Cartesian. With this calculation, the center of the image will lie in the coordinates [0, 0]. * const projection = new Cartesian([ * [-PIC_WIDTH / 2, PIC_HEIGHT / 2 - worldSize], * [worldSize - PIC_WIDTH / 2, PIC_HEIGHT / 2], * ]); * * const map = new YMaps({ * //..., * projection: projection * }); * }); * ``` */ export declare class Cartesian implements Projection { private _bounds; private _cycled; private _xRange; private _yRange; readonly type = "cartesian"; constructor(bounds: [ LngLat, LngLat ], cycled?: [ boolean, boolean ]); toWorldCoordinates(point: LngLat): WorldCoordinates; fromWorldCoordinates(point: WorldCoordinates): LngLat; }