diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index 5981678cba..4189888192 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -1,7 +1,6 @@ /** * @module ol/format/GPX */ -import {inherits} from '../util.js'; import Feature from '../Feature.js'; import {includes} from '../array.js'; import {transformWithOptions} from '../format/Feature.js'; @@ -103,19 +102,28 @@ const GPX_SERIALIZERS = makeStructureNS( * @classdesc * Feature format for reading and writing data in the GPX format. * - * @extends {module:ol/format/XMLFeature} + * Note that {@link module:ol/format/GPX~GPX#readFeature} only reads the first + * feature of the source. + * + * When reading, routes (``) are converted into LineString geometries, and + * tracks (``) into MultiLineString. Any properties on route and track + * waypoints are ignored. + * + * When writing, LineString geometries are output as routes (``), and + * MultiLineString as tracks (``). + * * @api */ -class GPX { +class GPX extends XMLFeature { /** * @param {module:ol/format/GPX~Options=} opt_options Options. */ constructor(opt_options) { + super(); const options = opt_options ? opt_options : {}; - XMLFeature.call(this); /** * @inheritDoc @@ -214,8 +222,6 @@ class GPX { } } -inherits(GPX, XMLFeature); - /** * @const @@ -702,45 +708,6 @@ function readWpt(node, objectStack) { } -/** - * Read the first feature from a GPX source. - * Routes (``) are converted into LineString geometries, and tracks (``) - * into MultiLineString. Any properties on route and track waypoints are ignored. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. - * @return {module:ol/Feature} Feature. - * @api - */ -GPX.prototype.readFeature; - - -/** - * Read all features from a GPX source. - * Routes (``) are converted into LineString geometries, and tracks (``) - * into MultiLineString. Any properties on route and track waypoints are ignored. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. - * @return {Array.} Features. - * @api - */ -GPX.prototype.readFeatures; - - -/** - * Read the projection from a GPX source. - * - * @function - * @param {Document|Node|Object|string} source Source. - * @return {module:ol/proj/Projection} Projection. - * @api - */ -GPX.prototype.readProjection; - - /** * @param {Node} node Node. * @param {string} value Value for the link's `href` attribute. @@ -887,18 +854,4 @@ function writeWpt(node, feature, objectStack) { } -/** - * Encode an array of features in the GPX format. - * LineString geometries are output as routes (``), and MultiLineString - * as tracks (``). - * - * @function - * @param {Array.} features Features. - * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. - * @return {string} Result. - * @api - */ -GPX.prototype.writeFeatures; - - export default GPX; diff --git a/src/ol/format/XMLFeature.js b/src/ol/format/XMLFeature.js index ae873faec6..db23e96d0f 100644 --- a/src/ol/format/XMLFeature.js +++ b/src/ol/format/XMLFeature.js @@ -36,7 +36,12 @@ class XMLFeature { } /** - * @inheritDoc + * Read a single feature. + * + * @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) { if (isDocument(source)) { @@ -161,7 +166,11 @@ class XMLFeature { } /** - * @inheritDoc + * Read the projection from the source. + * + * @param {Document|Node|Object|string} source Source. + * @return {module:ol/proj/Projection} Projection. + * @api */ readProjection(source) { if (isDocument(source)) { @@ -213,7 +222,12 @@ class XMLFeature { } /** - * @inheritDoc + * Encode an array of features as string. + * + * @param {Array.} features Features. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. + * @return {string} Result. + * @api */ writeFeatures(features, opt_options) { const node = this.writeFeaturesNode(features, opt_options);