Use extends and super for format/Polyline

This commit is contained in:
ahocevar
2018-07-17 17:13:13 +02:00
parent 092441017d
commit 9b2b921f7b
2 changed files with 22 additions and 69 deletions

View File

@@ -1,7 +1,6 @@
/**
* @module ol/format/Polyline
*/
import {inherits} from '../util.js';
import {assert} from '../asserts.js';
import Feature from '../Feature.js';
import {transformWithOptions} from '../format/Feature.js';
@@ -27,19 +26,25 @@ import {get as getProjection} from '../proj.js';
* Feature format for reading and writing data in the Encoded
* Polyline Algorithm Format.
*
* @extends {module:ol/format/TextFeature}
* When reading features, the coordinates are assumed to be in two dimensions
* and in [latitude, longitude] order.
*
* As Polyline sources contain a single feature,
* {@link module:ol/format/Polyline~Polyline#readFeatures} will return the
* feature in an array.
*
* @api
*/
class Polyline {
class Polyline extends TextFeature {
/**
* @param {module:ol/format/Polyline~Options=} opt_options Optional configuration object.
*/
constructor(opt_options) {
super();
const options = opt_options ? opt_options : {};
TextFeature.call(this);
/**
* @inheritDoc
@@ -127,8 +132,6 @@ class Polyline {
}
}
inherits(Polyline, TextFeature);
/**
* Encode a list of n-dimensional points and return an encoded string
@@ -334,65 +337,4 @@ export function encodeUnsignedInteger(num) {
}
/**
* Read the feature from the Polyline source. The coordinates are assumed to be
* in two dimensions and in latitude, longitude order.
*
* @function
* @param {Document|Node|Object|string} source Source.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @return {module:ol/Feature} Feature.
* @api
*/
Polyline.prototype.readFeature;
/**
* Read the feature from the source. As Polyline 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
*/
Polyline.prototype.readFeatures;
/**
* Read the geometry from the source.
*
* @function
* @param {Document|Node|Object|string} source Source.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @return {module:ol/geom/Geometry} Geometry.
* @api
*/
Polyline.prototype.readGeometry;
/**
* Read the projection from a Polyline source.
*
* @function
* @param {Document|Node|Object|string} source Source.
* @return {module:ol/proj/Projection} Projection.
* @api
*/
Polyline.prototype.readProjection;
/**
* Write a single geometry in Polyline format.
*
* @function
* @param {module:ol/geom/Geometry} geometry Geometry.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Geometry.
* @api
*/
Polyline.prototype.writeGeometry;
export default Polyline;