Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e): jscodeshift --transform ts.js src
This commit is contained in:
+31
-31
@@ -8,14 +8,14 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten
|
||||
|
||||
/**
|
||||
* @typedef {Object} ReadOptions
|
||||
* @property {module:ol/proj~ProjectionLike} [dataProjection] Projection of the data we are reading.
|
||||
* @property {import("../proj.js").ProjectionLike} [dataProjection] Projection of the data we are reading.
|
||||
* If not provided, the projection will be derived from the data (where possible) or
|
||||
* the `dataProjection` of the format is assigned (where set). If the projection
|
||||
* can not be derived from the data and if no `dataProjection` is set for a format,
|
||||
* the features will not be reprojected.
|
||||
* @property {module:ol/extent~Extent} [extent] Tile extent of the tile being read. This is only used and
|
||||
* @property {import("../extent.js").Extent} [extent] Tile extent of the tile being read. This is only used and
|
||||
* required for {@link module:ol/format/MVT}.
|
||||
* @property {module:ol/proj~ProjectionLike} [featureProjection] Projection of the feature geometries
|
||||
* @property {import("../proj.js").ProjectionLike} [featureProjection] Projection of the feature geometries
|
||||
* created by the format reader. If not provided, features will be returned in the
|
||||
* `dataProjection`.
|
||||
*/
|
||||
@@ -23,11 +23,11 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten
|
||||
|
||||
/**
|
||||
* @typedef {Object} WriteOptions
|
||||
* @property {module:ol/proj~ProjectionLike} [dataProjection] Projection of the data we are writing.
|
||||
* @property {import("../proj.js").ProjectionLike} [dataProjection] Projection of the data we are writing.
|
||||
* If not provided, the `dataProjection` of the format is assigned (where set).
|
||||
* If no `dataProjection` is set for a format, the features will be returned
|
||||
* in the `featureProjection`.
|
||||
* @property {module:ol/proj~ProjectionLike} [featureProjection] Projection of the feature geometries
|
||||
* @property {import("../proj.js").ProjectionLike} [featureProjection] Projection of the feature geometries
|
||||
* that will be serialized by the format writer. If not provided, geometries are assumed
|
||||
* to be in the `dataProjection` if that is set; in other words, they are not transformed.
|
||||
* @property {boolean} [rightHanded] When writing geometries, follow the right-hand
|
||||
@@ -52,7 +52,7 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten
|
||||
* Abstract base class; normally only used for creating subclasses and not
|
||||
* instantiated in apps.
|
||||
* Base class for feature formats.
|
||||
* {module:ol/format/Feature~FeatureFormat} subclasses provide the ability to decode and encode
|
||||
* {FeatureFormat} subclasses provide the ability to decode and encode
|
||||
* {@link module:ol/Feature~Feature} objects from a variety of commonly used geospatial
|
||||
* file formats. See the documentation for each format for more details.
|
||||
*
|
||||
@@ -64,13 +64,13 @@ class FeatureFormat {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {module:ol/proj/Projection}
|
||||
* @type {import("../proj/Projection.js").default}
|
||||
*/
|
||||
this.dataProjection = null;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {module:ol/proj/Projection}
|
||||
* @type {import("../proj/Projection.js").default}
|
||||
*/
|
||||
this.defaultFeatureProjection = null;
|
||||
|
||||
@@ -79,8 +79,8 @@ class FeatureFormat {
|
||||
/**
|
||||
* Adds the data projection to the read options.
|
||||
* @param {Document|Node|Object|string} source Source.
|
||||
* @param {module:ol/format/Feature~ReadOptions=} opt_options Options.
|
||||
* @return {module:ol/format/Feature~ReadOptions|undefined} Options.
|
||||
* @param {ReadOptions=} opt_options Options.
|
||||
* @return {ReadOptions|undefined} Options.
|
||||
* @protected
|
||||
*/
|
||||
getReadOptions(source, opt_options) {
|
||||
@@ -98,10 +98,10 @@ class FeatureFormat {
|
||||
/**
|
||||
* Sets the `dataProjection` on the options, if no `dataProjection`
|
||||
* is set.
|
||||
* @param {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined} options
|
||||
* @param {WriteOptions|ReadOptions|undefined} options
|
||||
* Options.
|
||||
* @protected
|
||||
* @return {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined}
|
||||
* @return {WriteOptions|ReadOptions|undefined}
|
||||
* Updated options.
|
||||
*/
|
||||
adaptOptions(options) {
|
||||
@@ -113,7 +113,7 @@ class FeatureFormat {
|
||||
|
||||
/**
|
||||
* Get the extent from the source of the last {@link readFeatures} call.
|
||||
* @return {module:ol/extent~Extent} Tile extent.
|
||||
* @return {import("../extent.js").Extent} Tile extent.
|
||||
*/
|
||||
getLastExtent() {
|
||||
return null;
|
||||
@@ -121,7 +121,7 @@ class FeatureFormat {
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @return {module:ol/format/FormatType} Format.
|
||||
* @return {import("./FormatType.js").default} Format.
|
||||
*/
|
||||
getType() {}
|
||||
|
||||
@@ -130,8 +130,8 @@ class FeatureFormat {
|
||||
*
|
||||
* @abstract
|
||||
* @param {Document|Node|Object|string} source Source.
|
||||
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
|
||||
* @return {module:ol/Feature} Feature.
|
||||
* @param {ReadOptions=} opt_options Read options.
|
||||
* @return {import("../Feature.js").default} Feature.
|
||||
*/
|
||||
readFeature(source, opt_options) {}
|
||||
|
||||
@@ -140,8 +140,8 @@ class FeatureFormat {
|
||||
*
|
||||
* @abstract
|
||||
* @param {Document|Node|ArrayBuffer|Object|string} source Source.
|
||||
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
|
||||
* @return {Array<module:ol/Feature>} Features.
|
||||
* @param {ReadOptions=} opt_options Read options.
|
||||
* @return {Array<import("../Feature.js").default>} Features.
|
||||
*/
|
||||
readFeatures(source, opt_options) {}
|
||||
|
||||
@@ -150,8 +150,8 @@ class FeatureFormat {
|
||||
*
|
||||
* @abstract
|
||||
* @param {Document|Node|Object|string} source Source.
|
||||
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
|
||||
* @return {module:ol/geom/Geometry} Geometry.
|
||||
* @param {ReadOptions=} opt_options Read options.
|
||||
* @return {import("../geom/Geometry.js").default} Geometry.
|
||||
*/
|
||||
readGeometry(source, opt_options) {}
|
||||
|
||||
@@ -160,7 +160,7 @@ class FeatureFormat {
|
||||
*
|
||||
* @abstract
|
||||
* @param {Document|Node|Object|string} source Source.
|
||||
* @return {module:ol/proj/Projection} Projection.
|
||||
* @return {import("../proj/Projection.js").default} Projection.
|
||||
*/
|
||||
readProjection(source) {}
|
||||
|
||||
@@ -168,8 +168,8 @@ class FeatureFormat {
|
||||
* Encode a feature in this format.
|
||||
*
|
||||
* @abstract
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @param {WriteOptions=} opt_options Write options.
|
||||
* @return {string} Result.
|
||||
*/
|
||||
writeFeature(feature, opt_options) {}
|
||||
@@ -178,8 +178,8 @@ class FeatureFormat {
|
||||
* Encode an array of features in this format.
|
||||
*
|
||||
* @abstract
|
||||
* @param {Array<module:ol/Feature>} features Features.
|
||||
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
|
||||
* @param {Array<import("../Feature.js").default>} features Features.
|
||||
* @param {WriteOptions=} opt_options Write options.
|
||||
* @return {string} Result.
|
||||
*/
|
||||
writeFeatures(features, opt_options) {}
|
||||
@@ -188,8 +188,8 @@ class FeatureFormat {
|
||||
* Write a single geometry in this format.
|
||||
*
|
||||
* @abstract
|
||||
* @param {module:ol/geom/Geometry} geometry Geometry.
|
||||
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
|
||||
* @param {import("../geom/Geometry.js").default} geometry Geometry.
|
||||
* @param {WriteOptions=} opt_options Write options.
|
||||
* @return {string} Result.
|
||||
*/
|
||||
writeGeometry(geometry, opt_options) {}
|
||||
@@ -198,11 +198,11 @@ class FeatureFormat {
|
||||
export default FeatureFormat;
|
||||
|
||||
/**
|
||||
* @param {module:ol/geom/Geometry|module:ol/extent~Extent} geometry Geometry.
|
||||
* @param {import("../geom/Geometry.js").default|import("../extent.js").Extent} geometry Geometry.
|
||||
* @param {boolean} write Set to true for writing, false for reading.
|
||||
* @param {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined} opt_options
|
||||
* @param {WriteOptions|ReadOptions|undefined} opt_options
|
||||
* Options.
|
||||
* @return {module:ol/geom/Geometry|module:ol/extent~Extent} Transformed geometry.
|
||||
* @return {import("../geom/Geometry.js").default|import("../extent.js").Extent} Transformed geometry.
|
||||
*/
|
||||
export function transformWithOptions(geometry, write, opt_options) {
|
||||
const featureProjection = opt_options ?
|
||||
@@ -210,7 +210,7 @@ export function transformWithOptions(geometry, write, opt_options) {
|
||||
const dataProjection = opt_options ?
|
||||
getProjection(opt_options.dataProjection) : null;
|
||||
/**
|
||||
* @type {module:ol/geom/Geometry|module:ol/extent~Extent}
|
||||
* @type {import("../geom/Geometry.js").default|import("../extent.js").Extent}
|
||||
*/
|
||||
let transformed;
|
||||
if (featureProjection && dataProjection &&
|
||||
|
||||
Reference in New Issue
Block a user