diff --git a/src/ol/format/Polyline.js b/src/ol/format/Polyline.js index 5cdfbee7a9..206d46a03f 100644 --- a/src/ol/format/Polyline.js +++ b/src/ol/format/Polyline.js @@ -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.} 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; diff --git a/src/ol/format/TextFeature.js b/src/ol/format/TextFeature.js index 3769ea3845..953763ecf1 100644 --- a/src/ol/format/TextFeature.js +++ b/src/ol/format/TextFeature.js @@ -69,7 +69,12 @@ class TextFeature { readFeaturesFromText(text, opt_options) {} /** - * @inheritDoc + * Read the geometry from the source. + * + * @param {Document|Node|Object|string} source Source. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. + * @return {module:ol/geom/Geometry} Geometry. + * @api */ readGeometry(source, opt_options) { return this.readGeometryFromText(getText(source), this.adaptOptions(opt_options)); @@ -138,7 +143,13 @@ class TextFeature { writeFeaturesText(features, opt_options) {} /** - * @inheritDoc + * 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 */ writeGeometry(geometry, opt_options) { return this.writeGeometryText(geometry, this.adaptOptions(opt_options));