Automated class transform

npx lebab --replace src --transform class
This commit is contained in:
Tim Schaub
2018-07-16 16:18:16 -06:00
parent 60e85e7d89
commit 7b4a73f3b9
145 changed files with 32887 additions and 33714 deletions

View File

@@ -60,150 +60,141 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten
* @abstract
* @api
*/
const FeatureFormat = function() {
class FeatureFormat {
constructor() {
/**
* @protected
* @type {module:ol/proj/Projection}
*/
this.dataProjection = null;
/**
* @protected
* @type {module:ol/proj/Projection}
*/
this.dataProjection = null;
/**
* @protected
* @type {module:ol/proj/Projection}
*/
this.defaultFeatureProjection = null;
/**
* @protected
* @type {module:ol/proj/Projection}
*/
this.defaultFeatureProjection = null;
};
}
/**
* 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.
* @protected
*/
getReadOptions(source, opt_options) {
let options;
if (opt_options) {
options = {
dataProjection: opt_options.dataProjection ?
opt_options.dataProjection : this.readProjection(source),
featureProjection: opt_options.featureProjection
};
}
return this.adaptOptions(options);
}
/**
* 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.
* @protected
*/
FeatureFormat.prototype.getReadOptions = function(source, opt_options) {
let options;
if (opt_options) {
options = {
dataProjection: opt_options.dataProjection ?
opt_options.dataProjection : this.readProjection(source),
featureProjection: opt_options.featureProjection
};
}
return this.adaptOptions(options);
};
/**
* Sets the `dataProjection` on the options, if no `dataProjection`
* is set.
* @param {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined} options
* Options.
* @protected
* @return {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined}
* Updated options.
*/
adaptOptions(options) {
return assign({
dataProjection: this.dataProjection,
featureProjection: this.defaultFeatureProjection
}, options);
}
/**
* Get the extent from the source of the last {@link readFeatures} call.
* @return {module:ol/extent~Extent} Tile extent.
*/
getLastExtent() {
return null;
}
/**
* Sets the `dataProjection` on the options, if no `dataProjection`
* is set.
* @param {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined} options
* Options.
* @protected
* @return {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined}
* Updated options.
*/
FeatureFormat.prototype.adaptOptions = function(options) {
return assign({
dataProjection: this.dataProjection,
featureProjection: this.defaultFeatureProjection
}, options);
};
/**
* @abstract
* @return {module:ol/format/FormatType} Format.
*/
getType() {}
/**
* Read a single feature from a source.
*
* @abstract
* @param {Document|Node|Object|string} source Source.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @return {module:ol/Feature} Feature.
*/
readFeature(source, opt_options) {}
/**
* Get the extent from the source of the last {@link readFeatures} call.
* @return {module:ol/extent~Extent} Tile extent.
*/
FeatureFormat.prototype.getLastExtent = function() {
return null;
};
/**
* Read all features from a source.
*
* @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.
*/
readFeatures(source, opt_options) {}
/**
* Read a single geometry from a source.
*
* @abstract
* @param {Document|Node|Object|string} source Source.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @return {module:ol/geom/Geometry} Geometry.
*/
readGeometry(source, opt_options) {}
/**
* @abstract
* @return {module:ol/format/FormatType} Format.
*/
FeatureFormat.prototype.getType = function() {};
/**
* Read the projection from a source.
*
* @abstract
* @param {Document|Node|Object|string} source Source.
* @return {module:ol/proj/Projection} Projection.
*/
readProjection(source) {}
/**
* Encode a feature in this format.
*
* @abstract
* @param {module:ol/Feature} feature Feature.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
writeFeature(feature, opt_options) {}
/**
* Read a single feature from a source.
*
* @abstract
* @param {Document|Node|Object|string} source Source.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @return {module:ol/Feature} Feature.
*/
FeatureFormat.prototype.readFeature = function(source, opt_options) {};
/**
* 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.
* @return {string} Result.
*/
writeFeatures(features, opt_options) {}
/**
* Read all features from a source.
*
* @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.
*/
FeatureFormat.prototype.readFeatures = function(source, opt_options) {};
/**
* Read a single geometry from a source.
*
* @abstract
* @param {Document|Node|Object|string} source Source.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @return {module:ol/geom/Geometry} Geometry.
*/
FeatureFormat.prototype.readGeometry = function(source, opt_options) {};
/**
* Read the projection from a source.
*
* @abstract
* @param {Document|Node|Object|string} source Source.
* @return {module:ol/proj/Projection} Projection.
*/
FeatureFormat.prototype.readProjection = function(source) {};
/**
* Encode a feature in this format.
*
* @abstract
* @param {module:ol/Feature} feature Feature.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
FeatureFormat.prototype.writeFeature = function(feature, opt_options) {};
/**
* 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.
* @return {string} Result.
*/
FeatureFormat.prototype.writeFeatures = function(features, opt_options) {};
/**
* 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.
* @return {string} Result.
*/
FeatureFormat.prototype.writeGeometry = function(geometry, opt_options) {};
/**
* 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.
* @return {string} Result.
*/
writeGeometry(geometry, opt_options) {}
}
export default FeatureFormat;