Use extends and super for format/IGC
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/format/IGC
|
* @module ol/format/IGC
|
||||||
*/
|
*/
|
||||||
import {inherits} from '../util.js';
|
|
||||||
import Feature from '../Feature.js';
|
import Feature from '../Feature.js';
|
||||||
import {transformWithOptions} from '../format/Feature.js';
|
import {transformWithOptions} from '../format/Feature.js';
|
||||||
import TextFeature from '../format/TextFeature.js';
|
import TextFeature from '../format/TextFeature.js';
|
||||||
@@ -61,20 +60,22 @@ const NEWLINE_RE = /\r\n|\r|\n/;
|
|||||||
* @classdesc
|
* @classdesc
|
||||||
* Feature format for `*.igc` flight recording files.
|
* Feature format for `*.igc` flight recording files.
|
||||||
*
|
*
|
||||||
* @extends {module:ol/format/TextFeature}
|
* As IGC sources contain a single feature,
|
||||||
|
* {@link module:ol/format/IGC~IGC#readFeatures} will return the feature in an
|
||||||
|
* array
|
||||||
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
class IGC {
|
class IGC extends TextFeature {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {module:ol/format/IGC~Options=} opt_options Options.
|
* @param {module:ol/format/IGC~Options=} opt_options Options.
|
||||||
*/
|
*/
|
||||||
constructor(opt_options) {
|
constructor(opt_options) {
|
||||||
|
super();
|
||||||
|
|
||||||
const options = opt_options ? opt_options : {};
|
const options = opt_options ? opt_options : {};
|
||||||
|
|
||||||
TextFeature.call(this);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@@ -199,43 +200,4 @@ class IGC {
|
|||||||
readGeometryFromText(text, opt_options) {}
|
readGeometryFromText(text, opt_options) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
inherits(IGC, TextFeature);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read the feature from the IGC source.
|
|
||||||
*
|
|
||||||
* @function
|
|
||||||
* @param {Document|Node|Object|string} source Source.
|
|
||||||
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
|
|
||||||
* @return {module:ol/Feature} Feature.
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
IGC.prototype.readFeature;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read the feature from the source. As IGC sources contain a single
|
|
||||||
* feature, this will return the feature in an array.
|
|
||||||
*
|
|
||||||
* @function
|
|
||||||
* @param {Document|Node|Object|string} source Source.
|
|
||||||
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
|
|
||||||
* @return {Array.<module:ol/Feature>} Features.
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
IGC.prototype.readFeatures;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read the projection from the IGC source.
|
|
||||||
*
|
|
||||||
* @function
|
|
||||||
* @param {Document|Node|Object|string} source Source.
|
|
||||||
* @return {module:ol/proj/Projection} Projection.
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
IGC.prototype.readProjection;
|
|
||||||
|
|
||||||
|
|
||||||
export default IGC;
|
export default IGC;
|
||||||
|
|||||||
@@ -27,7 +27,12 @@ class TextFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Read the feature from the source.
|
||||||
|
*
|
||||||
|
* @param {Document|Node|Object|string} source Source.
|
||||||
|
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
|
||||||
|
* @return {module:ol/Feature} Feature.
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
readFeature(source, opt_options) {
|
readFeature(source, opt_options) {
|
||||||
return this.readFeatureFromText(getText(source), this.adaptOptions(opt_options));
|
return this.readFeatureFromText(getText(source), this.adaptOptions(opt_options));
|
||||||
@@ -43,7 +48,12 @@ class TextFeature {
|
|||||||
readFeatureFromText(text, opt_options) {}
|
readFeatureFromText(text, opt_options) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Read the features from the source.
|
||||||
|
*
|
||||||
|
* @param {Document|Node|Object|string} source Source.
|
||||||
|
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
|
||||||
|
* @return {Array.<module:ol/Feature>} Features.
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
readFeatures(source, opt_options) {
|
readFeatures(source, opt_options) {
|
||||||
return this.readFeaturesFromText(getText(source), this.adaptOptions(opt_options));
|
return this.readFeaturesFromText(getText(source), this.adaptOptions(opt_options));
|
||||||
@@ -75,7 +85,12 @@ class TextFeature {
|
|||||||
readGeometryFromText(text, opt_options) {}
|
readGeometryFromText(text, opt_options) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Read the projection from the source.
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
* @param {Document|Node|Object|string} source Source.
|
||||||
|
* @return {module:ol/proj/Projection} Projection.
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
readProjection(source) {
|
readProjection(source) {
|
||||||
return this.readProjectionFromText(getText(source));
|
return this.readProjectionFromText(getText(source));
|
||||||
|
|||||||
Reference in New Issue
Block a user