Remove all inheritDoc tags from src/ol/format

This commit is contained in:
Frederic Junod
2020-03-25 08:43:52 +01:00
parent f392f6b6bb
commit d7c83e4651
23 changed files with 211 additions and 105 deletions

View File

@@ -102,7 +102,10 @@ class EsriJSON extends JSONFeature {
}
/**
* @inheritDoc
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromObject(object, opt_options) {
const esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
@@ -123,7 +126,10 @@ class EsriJSON extends JSONFeature {
}
/**
* @inheritDoc
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromObject(object, opt_options) {
const options = opt_options ? opt_options : {};
@@ -143,14 +149,19 @@ class EsriJSON extends JSONFeature {
}
/**
* @inheritDoc
* @param {EsriJSONGeometry} object Object.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromObject(object, opt_options) {
return readGeometry(/** @type {EsriJSONGeometry} */(object), opt_options);
return readGeometry(object, opt_options);
}
/**
* @inheritDoc
* @param {Object} object Object.
* @protected
* @return {import("../proj/Projection.js").default} Projection.
*/
readProjectionFromObject(object) {
if (object['spatialReference'] && object['spatialReference']['wkid'] !== undefined) {
@@ -168,7 +179,6 @@ class EsriJSON extends JSONFeature {
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {EsriJSONGeometry} Object.
* @override
* @api
*/
writeGeometryObject(geometry, opt_options) {
@@ -181,7 +191,6 @@ class EsriJSON extends JSONFeature {
* @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {Object} Object.
* @override
* @api
*/
writeFeatureObject(feature, opt_options) {
@@ -212,7 +221,6 @@ class EsriJSON extends JSONFeature {
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {EsriJSONFeatureSet} EsriJSON Object.
* @override
* @api
*/
writeFeaturesObject(features, opt_options) {

View File

@@ -81,7 +81,7 @@ class FeatureFormat {
/**
* Adds the data projection to the read options.
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @param {ReadOptions=} opt_options Options.
* @return {ReadOptions|undefined} Options.
* @protected
@@ -132,7 +132,7 @@ class FeatureFormat {
* Read a single feature from a source.
*
* @abstract
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @param {ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").FeatureLike} Feature.
*/
@@ -144,7 +144,7 @@ class FeatureFormat {
* Read all features from a source.
*
* @abstract
* @param {Document|Node|ArrayBuffer|Object|string} source Source.
* @param {Document|Element|ArrayBuffer|Object|string} source Source.
* @param {ReadOptions=} opt_options Read options.
* @return {Array<import("../Feature.js").FeatureLike>} Features.
*/
@@ -156,7 +156,7 @@ class FeatureFormat {
* Read a single geometry from a source.
*
* @abstract
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @param {ReadOptions=} opt_options Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
*/
@@ -168,7 +168,7 @@ class FeatureFormat {
* Read the projection from a source.
*
* @abstract
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @return {import("../proj/Projection.js").default} Projection.
*/
readProjection(source) {

View File

@@ -53,7 +53,7 @@ class GML2 extends GMLBase {
makeArrayPusher(this.readFeaturesInternal);
/**
* @inheritDoc
* @type {string}
*/
this.schemaLocation = options.schemaLocation ?
options.schemaLocation : schemaLocation;

View File

@@ -86,7 +86,7 @@ class GML3 extends GMLBase {
options.multiSurface : true;
/**
* @inheritDoc
* @type {string}
*/
this.schemaLocation = options.schemaLocation ?
options.schemaLocation : schemaLocation;
@@ -866,7 +866,6 @@ class GML3 extends GMLBase {
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions=} opt_options Options.
* @return {Node} Node.
* @override
* @api
*/
writeGeometryNode(geometry, opt_options) {
@@ -888,7 +887,6 @@ class GML3 extends GMLBase {
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Options.
* @return {Element} Node.
* @override
* @api
*/
writeFeaturesNode(features, opt_options) {

View File

@@ -22,7 +22,7 @@ class GML32 extends GML3 {
super(options);
/**
* @inheritDoc
* @type {string}
*/
this.schemaLocation = options.schemaLocation ?
options.schemaLocation : this.namespace + ' http://schemas.opengis.net/gml/3.2.1/gml.xsd';

View File

@@ -470,7 +470,10 @@ class GMLBase extends XMLFeature {
}
/**
* @inheritDoc
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @protected
* @return {import("../geom/Geometry.js").default|import("../extent.js").Extent} Geometry.
*/
//@ts-ignore
readGeometryFromNode(node, opt_options) {
@@ -480,7 +483,9 @@ class GMLBase extends XMLFeature {
}
/**
* @inheritDoc
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
const options = {
@@ -495,7 +500,8 @@ class GMLBase extends XMLFeature {
}
/**
* @inheritDoc
* @param {Element} node Node.
* @return {import("../proj/Projection.js").default} Projection.
*/
readProjectionFromNode(node) {
return getProjection(this.srsName ? this.srsName : node.firstElementChild.getAttribute('srsName'));

View File

@@ -130,7 +130,7 @@ class GPX extends XMLFeature {
/**
* @inheritDoc
* @type {import("../proj/Projection.js").default}
*/
this.dataProjection = getProjection('EPSG:4326');
@@ -160,7 +160,9 @@ class GPX extends XMLFeature {
}
/**
* @inheritDoc
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromNode(node, opt_options) {
if (!includes(NAMESPACE_URIS, node.namespaceURI)) {
@@ -179,7 +181,9 @@ class GPX extends XMLFeature {
}
/**
* @inheritDoc
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
if (!includes(NAMESPACE_URIS, node.namespaceURI)) {
@@ -207,7 +211,6 @@ class GPX extends XMLFeature {
* @param {Array<Feature>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Options.
* @return {Node} Node.
* @override
* @api
*/
writeFeaturesNode(features, opt_options) {

View File

@@ -63,7 +63,7 @@ class GeoJSON extends JSONFeature {
super();
/**
* @inheritDoc
* @type {import("../proj/Projection.js").default}
*/
this.dataProjection = getProjection(
options.dataProjection ?
@@ -90,7 +90,10 @@ class GeoJSON extends JSONFeature {
}
/**
* @inheritDoc
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromObject(object, opt_options) {
/**
@@ -127,7 +130,10 @@ class GeoJSON extends JSONFeature {
}
/**
* @inheritDoc
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromObject(object, opt_options) {
const geoJSONObject = /** @type {GeoJSONObject} */ (object);
@@ -147,14 +153,19 @@ class GeoJSON extends JSONFeature {
}
/**
* @inheritDoc
* @param {GeoJSONGeometry} object Object.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromObject(object, opt_options) {
return readGeometry(/** @type {GeoJSONGeometry} */ (object), opt_options);
return readGeometry(object, opt_options);
}
/**
* @inheritDoc
* @param {Object} object Object.
* @protected
* @return {import("../proj/Projection.js").default} Projection.
*/
readProjectionFromObject(object) {
const crs = object['crs'];
@@ -181,7 +192,6 @@ class GeoJSON extends JSONFeature {
* @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {GeoJSONFeature} Object.
* @override
* @api
*/
writeFeatureObject(feature, opt_options) {
@@ -218,7 +228,6 @@ class GeoJSON extends JSONFeature {
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {GeoJSONFeatureCollection} GeoJSON Object.
* @override
* @api
*/
writeFeaturesObject(features, opt_options) {
@@ -239,7 +248,6 @@ class GeoJSON extends JSONFeature {
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object.
* @override
* @api
*/
writeGeometryObject(geometry, opt_options) {

View File

@@ -77,7 +77,7 @@ class IGC extends TextFeature {
const options = opt_options ? opt_options : {};
/**
* @inheritDoc
* @type {import("../proj/Projection.js").default}
*/
this.dataProjection = getProjection('EPSG:4326');
@@ -89,7 +89,10 @@ class IGC extends TextFeature {
}
/**
* @inheritDoc
* @protected
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromText(text, opt_options) {
const altitudeMode = this.altitudeMode_;
@@ -164,7 +167,10 @@ class IGC extends TextFeature {
}
/**
* @inheritDoc
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromText(text, opt_options) {
const feature = this.readFeatureFromText(text, opt_options);

View File

@@ -19,7 +19,7 @@ class JSONFeature extends FeatureFormat {
}
/**
* @inheritDoc
* @return {import("./FormatType.js").default} Format.
*/
getType() {
return FormatType.JSON;
@@ -29,7 +29,7 @@ class JSONFeature extends FeatureFormat {
* Read a feature. Only works for a single feature. Use `readFeatures` to
* read a feature collection.
*
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @param {ArrayBuffer|Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").default} Feature.
* @api
@@ -43,7 +43,7 @@ class JSONFeature extends FeatureFormat {
* Read all features. Works with both a single feature and a feature
* collection.
*
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @param {ArrayBuffer|Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {Array<import("../Feature.js").default>} Features.
* @api
@@ -78,7 +78,7 @@ class JSONFeature extends FeatureFormat {
/**
* Read a geometry.
*
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @param {ArrayBuffer|Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
* @api
@@ -102,7 +102,7 @@ class JSONFeature extends FeatureFormat {
/**
* Read the projection.
*
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @param {ArrayBuffer|Document|Element|Object|string} source Source.
* @return {import("../proj/Projection.js").default} Projection.
* @api
*/
@@ -189,7 +189,7 @@ class JSONFeature extends FeatureFormat {
/**
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @return {Object} Object.
*/
function getObject(source) {

View File

@@ -427,7 +427,7 @@ class KML extends XMLFeature {
}
/**
* @inheritDoc
* @type {import("../proj/Projection.js").default}
*/
this.dataProjection = getProjection('EPSG:4326');
@@ -598,7 +598,9 @@ class KML extends XMLFeature {
}
/**
* @inheritDoc
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromNode(node, opt_options) {
if (!includes(NAMESPACE_URIS, node.namespaceURI)) {
@@ -614,7 +616,10 @@ class KML extends XMLFeature {
}
/**
* @inheritDoc
* @protected
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
if (!includes(NAMESPACE_URIS, node.namespaceURI)) {
@@ -847,7 +852,6 @@ class KML extends XMLFeature {
* @param {Array<Feature>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Options.
* @return {Node} Node.
* @override
* @api
*/
writeFeaturesNode(features, opt_options) {

View File

@@ -234,7 +234,7 @@ class MVT extends FeatureFormat {
}
/**
* @inheritDoc
* @return {import("./FormatType.js").default} Format.
*/
getType() {
return FormatType.ARRAY_BUFFER;
@@ -277,7 +277,10 @@ class MVT extends FeatureFormat {
}
/**
* @inheritDoc
* Read the projection from the source.
*
* @param {Document|Element|Object|string} source Source.
* @return {import("../proj/Projection.js").default} Projection.
* @api
*/
readProjection(source) {

View File

@@ -58,13 +58,16 @@ class OSMXML extends XMLFeature {
super();
/**
* @inheritDoc
* @type {import("../proj/Projection.js").default}
*/
this.dataProjection = getProjection('EPSG:4326');
}
/**
* @inheritDoc
* @protected
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
const options = this.getReadOptions(node, opt_options);

View File

@@ -33,19 +33,21 @@ class OWS extends XML {
}
/**
* @inheritDoc
* @param {Document} doc Document.
* @return {Object} Object
*/
readFromDocument(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n);
return this.readFromNode(/** @type {Element} */ (n));
}
}
return null;
}
/**
* @inheritDoc
* @param {Element} node Node.
* @return {Object} Object
*/
readFromNode(node) {
const owsObject = pushParseAndPop({},

View File

@@ -47,7 +47,7 @@ class Polyline extends TextFeature {
/**
* @inheritDoc
* @type {import("../proj/Projection.js").default}
*/
this.dataProjection = getProjection('EPSG:4326');
@@ -66,7 +66,10 @@ class Polyline extends TextFeature {
}
/**
* @inheritDoc
* @protected
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromText(text, opt_options) {
const geometry = this.readGeometryFromText(text, opt_options);
@@ -74,7 +77,10 @@ class Polyline extends TextFeature {
}
/**
* @inheritDoc
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromText(text, opt_options) {
const feature = this.readFeatureFromText(text, opt_options);
@@ -82,7 +88,10 @@ class Polyline extends TextFeature {
}
/**
* @inheritDoc
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromText(text, opt_options) {
const stride = getStrideForLayout(this.geometryLayout_);
@@ -95,7 +104,10 @@ class Polyline extends TextFeature {
}
/**
* @inheritDoc
* @param {import("../Feature.js").default} feature Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @protected
* @return {string} Text.
*/
writeFeatureText(feature, opt_options) {
const geometry = feature.getGeometry();
@@ -108,14 +120,20 @@ class Polyline extends TextFeature {
}
/**
* @inheritDoc
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @protected
* @return {string} Text.
*/
writeFeaturesText(features, opt_options) {
return this.writeFeatureText(features[0], opt_options);
}
/**
* @inheritDoc
* @param {LineString} geometry Geometry.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @protected
* @return {string} Text.
*/
writeGeometryText(geometry, opt_options) {
geometry = /** @type {LineString} */

View File

@@ -19,7 +19,7 @@ class TextFeature extends FeatureFormat {
}
/**
* @inheritDoc
* @return {import("./FormatType.js").default} Format.
*/
getType() {
return FormatType.TEXT;
@@ -28,7 +28,7 @@ class TextFeature extends FeatureFormat {
/**
* Read the feature from the source.
*
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").default} Feature.
* @api
@@ -51,7 +51,7 @@ class TextFeature extends FeatureFormat {
/**
* Read the features from the source.
*
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {Array<import("../Feature.js").default>} Features.
* @api
@@ -74,7 +74,7 @@ class TextFeature extends FeatureFormat {
/**
* Read the geometry from the source.
*
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
* @api
@@ -97,7 +97,7 @@ class TextFeature extends FeatureFormat {
/**
* Read the projection from the source.
*
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @return {import("../proj/Projection.js").default} Projection.
* @api
*/
@@ -186,7 +186,7 @@ class TextFeature extends FeatureFormat {
/**
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @return {string} Text.
*/
function getText(source) {

View File

@@ -78,7 +78,7 @@ class TopoJSON extends JSONFeature {
this.layers_ = options.layers ? options.layers : null;
/**
* @inheritDoc
* @type {import("../proj/Projection.js").default}
*/
this.dataProjection = getProjection(
options.dataProjection ?
@@ -87,7 +87,10 @@ class TopoJSON extends JSONFeature {
}
/**
* @inheritDoc
* @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromObject(object, opt_options) {
if (object.type == 'Topology') {
@@ -128,7 +131,9 @@ class TopoJSON extends JSONFeature {
}
/**
* @inheritDoc
* @param {Object} object Object.
* @protected
* @return {import("../proj/Projection.js").default} Projection.
*/
readProjectionFromObject(object) {
return this.dataProjection;

View File

@@ -254,7 +254,10 @@ class WFS extends XMLFeature {
}
/**
* @inheritDoc
* @protected
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
/** @type {import("../xml.js").NodeStackItem} */
@@ -513,19 +516,21 @@ class WFS extends XMLFeature {
}
/**
* @inheritDoc
* @param {Document} doc Document.
* @return {import("../proj/Projection.js").default} Projection.
*/
readProjectionFromDocument(doc) {
for (let n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readProjectionFromNode(n);
return this.readProjectionFromNode(/** @type {Element} */ (n));
}
}
return null;
}
/**
* @inheritDoc
* @param {Element} node Node.
* @return {import("../proj/Projection.js").default} Projection.
*/
readProjectionFromNode(node) {
if (node.firstElementChild &&

View File

@@ -642,7 +642,10 @@ class WKT extends TextFeature {
}
/**
* @inheritDoc
* @protected
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromText(text, opt_options) {
const geom = this.readGeometryFromText(text, opt_options);
@@ -655,7 +658,10 @@ class WKT extends TextFeature {
}
/**
* @inheritDoc
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {Array<Feature>} Features.
*/
readFeaturesFromText(text, opt_options) {
let geometries = [];
@@ -677,7 +683,10 @@ class WKT extends TextFeature {
}
/**
* @inheritDoc
* @param {string} text Text.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromText(text, opt_options) {
const geometry = this.parse_(text);
@@ -689,7 +698,10 @@ class WKT extends TextFeature {
}
/**
* @inheritDoc
* @param {import("../Feature.js").default} feature Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @protected
* @return {string} Text.
*/
writeFeatureText(feature, opt_options) {
const geometry = feature.getGeometry();
@@ -700,7 +712,10 @@ class WKT extends TextFeature {
}
/**
* @inheritDoc
* @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @protected
* @return {string} Text.
*/
writeFeaturesText(features, opt_options) {
if (features.length == 1) {
@@ -715,7 +730,10 @@ class WKT extends TextFeature {
}
/**
* @inheritDoc
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @protected
* @return {string} Text.
*/
writeGeometryText(geometry, opt_options) {
return encode(transformGeometryWithOptions(geometry, true, opt_options));

View File

@@ -60,19 +60,21 @@ class WMSCapabilities extends XML {
}
/**
* @inheritDoc
* @param {Document} doc Document.
* @return {Object} Object
*/
readFromDocument(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n);
return this.readFromNode(/** @type {Element} */ (n));
}
}
return null;
}
/**
* @inheritDoc
* @param {Element} node Node.
* @return {Object} Object
*/
readFromNode(node) {
this.version = node.getAttribute('version').trim();

View File

@@ -144,7 +144,10 @@ class WMSGetFeatureInfo extends XMLFeature {
}
/**
* @inheritDoc
* @protected
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {
const options = {};

View File

@@ -59,19 +59,21 @@ class WMTSCapabilities extends XML {
}
/**
* @inheritDoc
* @param {Document} doc Document.
* @return {Object} Object
*/
readFromDocument(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n);
return this.readFromNode(/** @type {Element} */ (n));
}
}
return null;
}
/**
* @inheritDoc
* @param {Element} node Node.
* @return {Object} Object
*/
readFromNode(node) {
let version = node.getAttribute('version');

View File

@@ -27,7 +27,7 @@ class XMLFeature extends FeatureFormat {
}
/**
* @inheritDoc
* @return {import("./FormatType.js").default} Format.
*/
getType() {
return FormatType.XML;
@@ -36,7 +36,7 @@ class XMLFeature extends FeatureFormat {
/**
* Read a single feature.
*
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").default} Feature.
* @api
@@ -50,7 +50,7 @@ class XMLFeature extends FeatureFormat {
} else if (isDocument(source)) {
return this.readFeatureFromDocument(/** @type {Document} */ (source), opt_options);
} else {
return this.readFeatureFromNode(/** @type {Node} */ (source), opt_options);
return this.readFeatureFromNode(/** @type {Element} */ (source), opt_options);
}
}
@@ -69,7 +69,7 @@ class XMLFeature extends FeatureFormat {
}
/**
* @param {Node} node Node.
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {import("../Feature.js").default} Feature.
*/
@@ -80,7 +80,7 @@ class XMLFeature extends FeatureFormat {
/**
* Read all features from a feature collection.
*
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {Array<import("../Feature.js").default>} Features.
* @api
@@ -95,7 +95,7 @@ class XMLFeature extends FeatureFormat {
return this.readFeaturesFromDocument(
/** @type {Document} */ (source), opt_options);
} else {
return this.readFeaturesFromNode(/** @type {Node} */ (source), opt_options);
return this.readFeaturesFromNode(/** @type {Element} */ (source), opt_options);
}
}
@@ -108,9 +108,9 @@ class XMLFeature extends FeatureFormat {
readFeaturesFromDocument(doc, opt_options) {
/** @type {Array<import("../Feature.js").default>} */
const features = [];
for (let n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
extend(features, this.readFeaturesFromNode(n, opt_options));
extend(features, this.readFeaturesFromNode(/** @type {Element} */ (n), opt_options));
}
}
return features;
@@ -118,7 +118,7 @@ class XMLFeature extends FeatureFormat {
/**
* @abstract
* @param {Node} node Node.
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @protected
* @return {Array<import("../Feature.js").default>} Features.
@@ -128,7 +128,11 @@ class XMLFeature extends FeatureFormat {
}
/**
* @inheritDoc
* Read a single geometry from a source.
*
* @param {Document|Element|Object|string} source Source.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometry(source, opt_options) {
if (!source) {
@@ -140,7 +144,7 @@ class XMLFeature extends FeatureFormat {
return this.readGeometryFromDocument(
/** @type {Document} */ (source), opt_options);
} else {
return this.readGeometryFromNode(/** @type {Node} */ (source), opt_options);
return this.readGeometryFromNode(/** @type {Element} */ (source), opt_options);
}
}
@@ -155,7 +159,7 @@ class XMLFeature extends FeatureFormat {
}
/**
* @param {Node} node Node.
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
@@ -167,7 +171,7 @@ class XMLFeature extends FeatureFormat {
/**
* Read the projection from the source.
*
* @param {Document|Node|Object|string} source Source.
* @param {Document|Element|Object|string} source Source.
* @return {import("../proj/Projection.js").default} Projection.
* @api
*/
@@ -180,7 +184,7 @@ class XMLFeature extends FeatureFormat {
} else if (isDocument(source)) {
return this.readProjectionFromDocument(/** @type {Document} */ (source));
} else {
return this.readProjectionFromNode(/** @type {Node} */ (source));
return this.readProjectionFromNode(/** @type {Element} */ (source));
}
}
@@ -194,7 +198,7 @@ class XMLFeature extends FeatureFormat {
}
/**
* @param {Node} node Node.
* @param {Element} node Node.
* @protected
* @return {import("../proj/Projection.js").default} Projection.
*/
@@ -203,7 +207,11 @@ class XMLFeature extends FeatureFormat {
}
/**
* @inheritDoc
* Encode a feature as string.
*
* @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {string} Encoded feature.
*/
writeFeature(feature, opt_options) {
const node = this.writeFeatureNode(feature, opt_options);
@@ -243,7 +251,11 @@ class XMLFeature extends FeatureFormat {
}
/**
* @inheritDoc
* Encode a geometry as string.
*
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {string} Encoded geometry.
*/
writeGeometry(geometry, opt_options) {
const node = this.writeGeometryNode(geometry, opt_options);