Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e): jscodeshift --transform ts.js src
This commit is contained in:
@@ -7,18 +7,18 @@ import {METERS_PER_UNIT} from '../proj/Units.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} code The SRS identifier code, e.g. `EPSG:4326`.
|
||||
* @property {module:ol/proj/Units|string} [units] Units. Required unless a
|
||||
* @property {import("./Units.js").default|string} [units] Units. Required unless a
|
||||
* proj4 projection is defined for `code`.
|
||||
* @property {module:ol/extent~Extent} [extent] The validity extent for the SRS.
|
||||
* @property {import("../extent.js").Extent} [extent] The validity extent for the SRS.
|
||||
* @property {string} [axisOrientation='enu'] The axis orientation as specified in Proj4.
|
||||
* @property {boolean} [global=false] Whether the projection is valid for the whole globe.
|
||||
* @property {number} [metersPerUnit] The meters per unit for the SRS.
|
||||
* If not provided, the `units` are used to get the meters per unit from the {@link module:ol/proj/Units~METERS_PER_UNIT}
|
||||
* lookup table.
|
||||
* @property {module:ol/extent~Extent} [worldExtent] The world extent for the SRS.
|
||||
* @property {function(number, module:ol/coordinate~Coordinate):number} [getPointResolution]
|
||||
* @property {import("../extent.js").Extent} [worldExtent] The world extent for the SRS.
|
||||
* @property {function(number, import("../coordinate.js").Coordinate):number} [getPointResolution]
|
||||
* Function to determine resolution at a point. The function is called with a
|
||||
* `{number}` view resolution and an `{module:ol/coordinate~Coordinate}` as arguments, and returns
|
||||
* `{number}` view resolution and an `{import("../coordinate.js").Coordinate}` as arguments, and returns
|
||||
* the `{number}` resolution at the passed coordinate. If this is `undefined`,
|
||||
* the default {@link module:ol/proj#getPointResolution} function will be used.
|
||||
*/
|
||||
@@ -54,7 +54,7 @@ import {METERS_PER_UNIT} from '../proj/Units.js';
|
||||
class Projection {
|
||||
|
||||
/**
|
||||
* @param {module:ol/proj/Projection~Options} options Projection options.
|
||||
* @param {Options} options Projection options.
|
||||
*/
|
||||
constructor(options) {
|
||||
/**
|
||||
@@ -68,16 +68,16 @@ class Projection {
|
||||
* `this.extent_` and `this.worldExtent_` must be configured properly for each
|
||||
* tile.
|
||||
* @private
|
||||
* @type {module:ol/proj/Units}
|
||||
* @type {import("./Units.js").default}
|
||||
*/
|
||||
this.units_ = /** @type {module:ol/proj/Units} */ (options.units);
|
||||
this.units_ = /** @type {import("./Units.js").default} */ (options.units);
|
||||
|
||||
/**
|
||||
* Validity extent of the projection in projected coordinates. For projections
|
||||
* with `TILE_PIXELS` units, this is the extent of the tile in
|
||||
* tile pixel space.
|
||||
* @private
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../extent.js").Extent}
|
||||
*/
|
||||
this.extent_ = options.extent !== undefined ? options.extent : null;
|
||||
|
||||
@@ -86,7 +86,7 @@ class Projection {
|
||||
* `TILE_PIXELS` units, this is the extent of the tile in
|
||||
* projected coordinate space.
|
||||
* @private
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../extent.js").Extent}
|
||||
*/
|
||||
this.worldExtent_ = options.worldExtent !== undefined ?
|
||||
options.worldExtent : null;
|
||||
@@ -112,13 +112,13 @@ class Projection {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {function(number, module:ol/coordinate~Coordinate):number|undefined}
|
||||
* @type {function(number, import("../coordinate.js").Coordinate):number|undefined}
|
||||
*/
|
||||
this.getPointResolutionFunc_ = options.getPointResolution;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/tilegrid/TileGrid}
|
||||
* @type {import("../tilegrid/TileGrid.js").default}
|
||||
*/
|
||||
this.defaultTileGrid_ = null;
|
||||
|
||||
@@ -147,7 +147,7 @@ class Projection {
|
||||
|
||||
/**
|
||||
* Get the validity extent for this projection.
|
||||
* @return {module:ol/extent~Extent} Extent.
|
||||
* @return {import("../extent.js").Extent} Extent.
|
||||
* @api
|
||||
*/
|
||||
getExtent() {
|
||||
@@ -156,7 +156,7 @@ class Projection {
|
||||
|
||||
/**
|
||||
* Get the units of this projection.
|
||||
* @return {module:ol/proj/Units} Units.
|
||||
* @return {import("./Units.js").default} Units.
|
||||
* @api
|
||||
*/
|
||||
getUnits() {
|
||||
@@ -176,7 +176,7 @@ class Projection {
|
||||
|
||||
/**
|
||||
* Get the world extent for this projection.
|
||||
* @return {module:ol/extent~Extent} Extent.
|
||||
* @return {import("../extent.js").Extent} Extent.
|
||||
* @api
|
||||
*/
|
||||
getWorldExtent() {
|
||||
@@ -218,14 +218,14 @@ class Projection {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {module:ol/tilegrid/TileGrid} The default tile grid.
|
||||
* @return {import("../tilegrid/TileGrid.js").default} The default tile grid.
|
||||
*/
|
||||
getDefaultTileGrid() {
|
||||
return this.defaultTileGrid_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/tilegrid/TileGrid} tileGrid The default tile grid.
|
||||
* @param {import("../tilegrid/TileGrid.js").default} tileGrid The default tile grid.
|
||||
*/
|
||||
setDefaultTileGrid(tileGrid) {
|
||||
this.defaultTileGrid_ = tileGrid;
|
||||
@@ -233,7 +233,7 @@ class Projection {
|
||||
|
||||
/**
|
||||
* Set the validity extent for this projection.
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @api
|
||||
*/
|
||||
setExtent(extent) {
|
||||
@@ -243,7 +243,7 @@ class Projection {
|
||||
|
||||
/**
|
||||
* Set the world extent for this projection.
|
||||
* @param {module:ol/extent~Extent} worldExtent World extent
|
||||
* @param {import("../extent.js").Extent} worldExtent World extent
|
||||
* [minlon, minlat, maxlon, maxlat].
|
||||
* @api
|
||||
*/
|
||||
@@ -254,7 +254,7 @@ class Projection {
|
||||
/**
|
||||
* Set the getPointResolution function (see {@link module:ol/proj~getPointResolution}
|
||||
* for this projection.
|
||||
* @param {function(number, module:ol/coordinate~Coordinate):number} func Function
|
||||
* @param {function(number, import("../coordinate.js").Coordinate):number} func Function
|
||||
* @api
|
||||
*/
|
||||
setGetPointResolution(func) {
|
||||
@@ -263,7 +263,7 @@ class Projection {
|
||||
|
||||
/**
|
||||
* Get the custom point resolution function for this projection (if set).
|
||||
* @return {function(number, module:ol/coordinate~Coordinate):number|undefined} The custom point
|
||||
* @return {function(number, import("../coordinate.js").Coordinate):number|undefined} The custom point
|
||||
* resolution function (if set).
|
||||
*/
|
||||
getPointResolutionFunc() {
|
||||
|
||||
@@ -20,7 +20,7 @@ const Units = {
|
||||
/**
|
||||
* Meters per unit lookup table.
|
||||
* @const
|
||||
* @type {Object<module:ol/proj/Units, number>}
|
||||
* @type {Object<import("./Units.js").default, number>}
|
||||
* @api
|
||||
*/
|
||||
export const METERS_PER_UNIT = {};
|
||||
|
||||
@@ -24,7 +24,7 @@ export const HALF_SIZE = Math.PI * RADIUS;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../extent.js").Extent}
|
||||
*/
|
||||
export const EXTENT = [
|
||||
-HALF_SIZE, -HALF_SIZE,
|
||||
@@ -34,7 +34,7 @@ export const EXTENT = [
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../extent.js").Extent}
|
||||
*/
|
||||
export const WORLD_EXTENT = [-180, -85, 180, 85];
|
||||
|
||||
@@ -69,7 +69,7 @@ class EPSG3857Projection extends Projection {
|
||||
* Projections equal to EPSG:3857.
|
||||
*
|
||||
* @const
|
||||
* @type {Array<module:ol/proj/Projection>}
|
||||
* @type {Array<import("./Projection.js").default>}
|
||||
*/
|
||||
export const PROJECTIONS = [
|
||||
new EPSG3857Projection('EPSG:3857'),
|
||||
|
||||
@@ -18,7 +18,7 @@ export const RADIUS = 6378137;
|
||||
* Extent of the EPSG:4326 projection which is the whole world.
|
||||
*
|
||||
* @const
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../extent.js").Extent}
|
||||
*/
|
||||
export const EXTENT = [-180, -90, 180, 90];
|
||||
|
||||
@@ -64,7 +64,7 @@ class EPSG4326Projection extends Projection {
|
||||
* Projections equal to EPSG:4326.
|
||||
*
|
||||
* @const
|
||||
* @type {Array<module:ol/proj/Projection>}
|
||||
* @type {Array<import("./Projection.js").default>}
|
||||
*/
|
||||
export const PROJECTIONS = [
|
||||
new EPSG4326Projection('CRS:84'),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* @type {Object<string, module:ol/proj/Projection>}
|
||||
* @type {Object<string, import("./Projection.js").default>}
|
||||
*/
|
||||
let cache = {};
|
||||
|
||||
@@ -20,7 +20,7 @@ export function clear() {
|
||||
/**
|
||||
* Get a cached projection by code.
|
||||
* @param {string} code The code for the projection.
|
||||
* @return {module:ol/proj/Projection} The projection (if cached).
|
||||
* @return {import("./Projection.js").default} The projection (if cached).
|
||||
*/
|
||||
export function get(code) {
|
||||
return cache[code] || null;
|
||||
@@ -30,7 +30,7 @@ export function get(code) {
|
||||
/**
|
||||
* Add a projection to the cache.
|
||||
* @param {string} code The projection code.
|
||||
* @param {module:ol/proj/Projection} projection The projection to cache.
|
||||
* @param {import("./Projection.js").default} projection The projection to cache.
|
||||
*/
|
||||
export function add(code, projection) {
|
||||
cache[code] = projection;
|
||||
|
||||
@@ -6,7 +6,7 @@ import {isEmpty} from '../obj.js';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Object<string, Object<string, module:ol/proj~TransformFunction>>}
|
||||
* @type {!Object<string, Object<string, import("../proj.js").TransformFunction>>}
|
||||
*/
|
||||
let transforms = {};
|
||||
|
||||
@@ -23,9 +23,9 @@ export function clear() {
|
||||
* Registers a conversion function to convert coordinates from the source
|
||||
* projection to the destination projection.
|
||||
*
|
||||
* @param {module:ol/proj/Projection} source Source.
|
||||
* @param {module:ol/proj/Projection} destination Destination.
|
||||
* @param {module:ol/proj~TransformFunction} transformFn Transform.
|
||||
* @param {import("./Projection.js").default} source Source.
|
||||
* @param {import("./Projection.js").default} destination Destination.
|
||||
* @param {import("../proj.js").TransformFunction} transformFn Transform.
|
||||
*/
|
||||
export function add(source, destination, transformFn) {
|
||||
const sourceCode = source.getCode();
|
||||
@@ -42,9 +42,9 @@ export function add(source, destination, transformFn) {
|
||||
* projection to the destination projection. This method is used to clean up
|
||||
* cached transforms during testing.
|
||||
*
|
||||
* @param {module:ol/proj/Projection} source Source projection.
|
||||
* @param {module:ol/proj/Projection} destination Destination projection.
|
||||
* @return {module:ol/proj~TransformFunction} transformFn The unregistered transform.
|
||||
* @param {import("./Projection.js").default} source Source projection.
|
||||
* @param {import("./Projection.js").default} destination Destination projection.
|
||||
* @return {import("../proj.js").TransformFunction} transformFn The unregistered transform.
|
||||
*/
|
||||
export function remove(source, destination) {
|
||||
const sourceCode = source.getCode();
|
||||
@@ -62,7 +62,7 @@ export function remove(source, destination) {
|
||||
* Get a transform given a source code and a destination code.
|
||||
* @param {string} sourceCode The code for the source projection.
|
||||
* @param {string} destinationCode The code for the destination projection.
|
||||
* @return {module:ol/proj~TransformFunction|undefined} The transform function (if found).
|
||||
* @return {import("../proj.js").TransformFunction|undefined} The transform function (if found).
|
||||
*/
|
||||
export function get(sourceCode, destinationCode) {
|
||||
let transform;
|
||||
|
||||
Reference in New Issue
Block a user