Merge pull request #10840 from fredj/remove_inheritDoc
Remove inherit doc
This commit is contained in:
@@ -129,7 +129,7 @@ class Geolocation extends BaseObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
this.setTracking(false);
|
||||
|
||||
@@ -78,7 +78,7 @@ class ImageWrapper extends ImageBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
|
||||
* @api
|
||||
*/
|
||||
getImage() {
|
||||
@@ -114,7 +114,6 @@ class ImageWrapper extends ImageBase {
|
||||
* Load the image or retry if loading previously failed.
|
||||
* Loading is taken care of by the tile queue, and calling this method is
|
||||
* only needed for preloading or for reloading in case of an error.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
load() {
|
||||
|
||||
@@ -76,7 +76,7 @@ class ImageCanvas extends ImageBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Load not yet loaded URI.
|
||||
*/
|
||||
load() {
|
||||
if (this.state == ImageState.IDLE) {
|
||||
|
||||
@@ -68,7 +68,7 @@ class ImageTile extends Tile {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {string} Key.
|
||||
*/
|
||||
getKey() {
|
||||
return this.src_;
|
||||
@@ -103,7 +103,7 @@ class ImageTile extends Tile {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Load not yet loaded URI.
|
||||
* @api
|
||||
*/
|
||||
load() {
|
||||
|
||||
@@ -86,7 +86,6 @@ class MapBrowserEvent extends MapEvent {
|
||||
/**
|
||||
* Prevents the default browser action.
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
preventDefault() {
|
||||
@@ -97,7 +96,6 @@ class MapBrowserEvent extends MapEvent {
|
||||
/**
|
||||
* Prevents further propagation of the current event.
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
stopPropagation() {
|
||||
|
||||
@@ -295,7 +295,7 @@ class MapBrowserEventHandler extends EventTarget {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
if (this.relayedListenerKey_) {
|
||||
|
||||
@@ -498,7 +498,7 @@ class PluggableMap extends BaseObject {
|
||||
|
||||
/**
|
||||
*
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
this.mapBrowserEventHandler_.dispose();
|
||||
|
||||
@@ -59,7 +59,8 @@ class TileQueue extends PriorityQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {Array} element Element.
|
||||
* @return {boolean} The element was added to the queue.
|
||||
*/
|
||||
enqueue(element) {
|
||||
const added = super.enqueue(element);
|
||||
|
||||
@@ -155,14 +155,14 @@ class VectorRenderTile extends Tile {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Load the tile.
|
||||
*/
|
||||
load() {
|
||||
this.getSourceTiles();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Remove from the cache due to expiry
|
||||
*/
|
||||
release() {
|
||||
for (const key in this.context_) {
|
||||
|
||||
@@ -87,14 +87,14 @@ class VectorTile extends Tile {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {string} Key.
|
||||
*/
|
||||
getKey() {
|
||||
return this.url_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Load not yet loaded URI.
|
||||
*/
|
||||
load() {
|
||||
if (this.state == TileState.IDLE) {
|
||||
|
||||
@@ -91,7 +91,7 @@ class Control extends BaseObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
removeNode(this.element);
|
||||
|
||||
@@ -213,7 +213,10 @@ class FullScreen extends Control {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Remove the control from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @api
|
||||
*/
|
||||
setMap(map) {
|
||||
|
||||
@@ -162,7 +162,10 @@ class MousePosition extends Control {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Remove the control from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @api
|
||||
*/
|
||||
setMap(map) {
|
||||
|
||||
@@ -255,7 +255,10 @@ class OverviewMap extends Control {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Remove the control from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @api
|
||||
*/
|
||||
setMap(map) {
|
||||
|
||||
@@ -148,7 +148,11 @@ class ZoomSlider extends Control {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Remove the control from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @api
|
||||
*/
|
||||
setMap(map) {
|
||||
super.setMap(map);
|
||||
|
||||
@@ -130,7 +130,7 @@ class Target extends Disposable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
clear(this.listeners_);
|
||||
|
||||
@@ -102,9 +102,13 @@ class EsriJSON extends JSONFeature {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {Object} object Object.
|
||||
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
|
||||
* @param {string=} opt_idField Name of the field where to get the id from.
|
||||
* @protected
|
||||
* @return {import("../Feature.js").default} Feature.
|
||||
*/
|
||||
readFeatureFromObject(object, opt_options) {
|
||||
readFeatureFromObject(object, opt_options, opt_idField) {
|
||||
const esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
|
||||
const geometry = readGeometry(esriJSONFeature.geometry, opt_options);
|
||||
const feature = new Feature();
|
||||
@@ -112,18 +116,21 @@ class EsriJSON extends JSONFeature {
|
||||
feature.setGeometryName(this.geometryName_);
|
||||
}
|
||||
feature.setGeometry(geometry);
|
||||
if (opt_options && opt_options.idField &&
|
||||
esriJSONFeature.attributes[opt_options.idField]) {
|
||||
feature.setId(/** @type {number} */(esriJSONFeature.attributes[opt_options.idField]));
|
||||
}
|
||||
if (esriJSONFeature.attributes) {
|
||||
feature.setProperties(esriJSONFeature.attributes, true);
|
||||
const id = esriJSONFeature.attributes[opt_idField];
|
||||
if (id !== undefined) {
|
||||
feature.setId(/** @type {number} */(id));
|
||||
}
|
||||
}
|
||||
return feature;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 : {};
|
||||
@@ -132,9 +139,8 @@ class EsriJSON extends JSONFeature {
|
||||
/** @type {Array<import("../Feature.js").default>} */
|
||||
const features = [];
|
||||
const esriJSONFeatures = esriJSONFeatureSet.features;
|
||||
options.idField = object.objectIdFieldName;
|
||||
for (let i = 0, ii = esriJSONFeatures.length; i < ii; ++i) {
|
||||
features.push(this.readFeatureFromObject(esriJSONFeatures[i], options));
|
||||
features.push(this.readFeatureFromObject(esriJSONFeatures[i], options, object.objectIdFieldName));
|
||||
}
|
||||
return features;
|
||||
} else {
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -53,7 +53,7 @@ class GML2 extends GMLBase {
|
||||
makeArrayPusher(this.readFeaturesInternal);
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @type {string}
|
||||
*/
|
||||
this.schemaLocation = options.schemaLocation ?
|
||||
options.schemaLocation : schemaLocation;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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({},
|
||||
|
||||
@@ -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} */
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 = {};
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -36,7 +36,6 @@ class Circle extends SimpleGeometry {
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @return {!Circle} Clone.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -44,7 +43,11 @@ class Circle extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
||||
* @param {number} minSquaredDistance Minimum squared distance.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
closestPointXY(x, y, closestPoint, minSquaredDistance) {
|
||||
const flatCoordinates = this.flatCoordinates;
|
||||
@@ -72,7 +75,9 @@ class Circle extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
containsXY(x, y) {
|
||||
const flatCoordinates = this.flatCoordinates;
|
||||
@@ -91,7 +96,9 @@ class Circle extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @protected
|
||||
* @return {import("../extent.js").Extent} extent Extent.
|
||||
*/
|
||||
computeExtent(extent) {
|
||||
const flatCoordinates = this.flatCoordinates;
|
||||
@@ -122,7 +129,8 @@ class Circle extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Get the type of this geometry.
|
||||
* @return {import("./GeometryType.js").default} Geometry type.
|
||||
* @api
|
||||
*/
|
||||
getType() {
|
||||
@@ -130,7 +138,9 @@ class Circle extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @return {boolean} `true` if the geometry and the extent intersect.
|
||||
* @api
|
||||
*/
|
||||
intersectsExtent(extent) {
|
||||
@@ -193,16 +203,10 @@ class Circle extends SimpleGeometry {
|
||||
this.changed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
getCoordinates() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
setCoordinates(coordinates, opt_layout) {}
|
||||
|
||||
/**
|
||||
@@ -216,7 +220,10 @@ class Circle extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Rotate the geometry around a given coordinate. This modifies the geometry
|
||||
* coordinates in place.
|
||||
* @param {number} angle Rotation angle in radians.
|
||||
* @param {import("../coordinate.js").Coordinate} anchor The rotation center.
|
||||
* @api
|
||||
*/
|
||||
rotate(angle, anchor) {
|
||||
@@ -227,7 +234,10 @@ class Circle extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Translate the geometry. This modifies the geometry coordinates in place. If
|
||||
* instead you want a new geometry, first `clone()` this geometry.
|
||||
* @param {number} deltaX Delta X.
|
||||
* @param {number} deltaY Delta Y.
|
||||
* @api
|
||||
*/
|
||||
translate(deltaX, deltaY) {
|
||||
|
||||
@@ -184,8 +184,7 @@ class Geometry extends BaseObject {
|
||||
* coordinates in place.
|
||||
* @abstract
|
||||
* @param {number} sx The scaling factor in the x-direction.
|
||||
* @param {number=} opt_sy The scaling factor in the y-direction (defaults to
|
||||
* sx).
|
||||
* @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx).
|
||||
* @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center
|
||||
* of the geometry extent).
|
||||
* @api
|
||||
|
||||
@@ -61,7 +61,6 @@ class GeometryCollection extends Geometry {
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @return {!GeometryCollection} Clone.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -71,7 +70,11 @@ class GeometryCollection extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
||||
* @param {number} minSquaredDistance Minimum squared distance.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
closestPointXY(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
@@ -86,7 +89,9 @@ class GeometryCollection extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
containsXY(x, y) {
|
||||
const geometries = this.geometries_;
|
||||
@@ -99,7 +104,9 @@ class GeometryCollection extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @protected
|
||||
* @return {import("../extent.js").Extent} extent Extent.
|
||||
*/
|
||||
computeExtent(extent) {
|
||||
createOrUpdateEmpty(extent);
|
||||
@@ -144,7 +151,9 @@ class GeometryCollection extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Create a simplified version of this geometry using the Douglas Peucker algorithm.
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {GeometryCollection} Simplified GeometryCollection.
|
||||
*/
|
||||
getSimplifiedGeometry(squaredTolerance) {
|
||||
if (this.simplifiedGeometryRevision !== this.getRevision()) {
|
||||
@@ -179,7 +188,8 @@ class GeometryCollection extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Get the type of this geometry.
|
||||
* @return {import("./GeometryType.js").default} Geometry type.
|
||||
* @api
|
||||
*/
|
||||
getType() {
|
||||
@@ -187,7 +197,9 @@ class GeometryCollection extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @return {boolean} `true` if the geometry and the extent intersect.
|
||||
* @api
|
||||
*/
|
||||
intersectsExtent(extent) {
|
||||
@@ -208,7 +220,10 @@ class GeometryCollection extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Rotate the geometry around a given coordinate. This modifies the geometry
|
||||
* coordinates in place.
|
||||
* @param {number} angle Rotation angle in radians.
|
||||
* @param {import("../coordinate.js").Coordinate} anchor The rotation center.
|
||||
* @api
|
||||
*/
|
||||
rotate(angle, anchor) {
|
||||
@@ -220,7 +235,13 @@ class GeometryCollection extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Scale the geometry (with an optional origin). This modifies the geometry
|
||||
* coordinates in place.
|
||||
* @abstract
|
||||
* @param {number} sx The scaling factor in the x-direction.
|
||||
* @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx).
|
||||
* @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center
|
||||
* of the geometry extent).
|
||||
* @api
|
||||
*/
|
||||
scale(sx, opt_sy, opt_anchor) {
|
||||
@@ -255,7 +276,12 @@ class GeometryCollection extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Apply a transform function to the coordinates of the geometry.
|
||||
* The geometry is modified in place.
|
||||
* If you do not want the geometry modified in place, first `clone()` it and
|
||||
* then use this function on the clone.
|
||||
* @param {import("../proj.js").TransformFunction} transformFn Transform function.
|
||||
* Called with a flat array of geometry coordinates.
|
||||
* @api
|
||||
*/
|
||||
applyTransform(transformFn) {
|
||||
@@ -267,7 +293,10 @@ class GeometryCollection extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Translate the geometry. This modifies the geometry coordinates in place. If
|
||||
* instead you want a new geometry, first `clone()` this geometry.
|
||||
* @param {number} deltaX Delta X.
|
||||
* @param {number} deltaY Delta Y.
|
||||
* @api
|
||||
*/
|
||||
translate(deltaX, deltaY) {
|
||||
@@ -279,7 +308,7 @@ class GeometryCollection extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
this.unlistenGeometriesChange_();
|
||||
|
||||
@@ -81,7 +81,6 @@ class LineString extends SimpleGeometry {
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @return {!LineString} Clone.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -89,7 +88,11 @@ class LineString extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
||||
* @param {number} minSquaredDistance Minimum squared distance.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
closestPointXY(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
@@ -147,7 +150,6 @@ class LineString extends SimpleGeometry {
|
||||
/**
|
||||
* Return the coordinates of the linestring.
|
||||
* @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
getCoordinates() {
|
||||
@@ -193,7 +195,9 @@ class LineString extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {LineString} Simplified LineString.
|
||||
* @protected
|
||||
*/
|
||||
getSimplifiedGeometryInternal(squaredTolerance) {
|
||||
const simplifiedFlatCoordinates = [];
|
||||
@@ -204,7 +208,8 @@ class LineString extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Get the type of this geometry.
|
||||
* @return {import("./GeometryType.js").default} Geometry type.
|
||||
* @api
|
||||
*/
|
||||
getType() {
|
||||
@@ -212,7 +217,9 @@ class LineString extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @return {boolean} `true` if the geometry and the extent intersect.
|
||||
* @api
|
||||
*/
|
||||
intersectsExtent(extent) {
|
||||
@@ -225,7 +232,6 @@ class LineString extends SimpleGeometry {
|
||||
* Set the coordinates of the linestring.
|
||||
* @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
|
||||
* @param {GeometryLayout=} opt_layout Layout.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
setCoordinates(coordinates, opt_layout) {
|
||||
|
||||
@@ -52,7 +52,6 @@ class LinearRing extends SimpleGeometry {
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @return {!LinearRing} Clone.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -60,7 +59,11 @@ class LinearRing extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
||||
* @param {number} minSquaredDistance Minimum squared distance.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
closestPointXY(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
@@ -88,7 +91,6 @@ class LinearRing extends SimpleGeometry {
|
||||
/**
|
||||
* Return the coordinates of the linear ring.
|
||||
* @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
getCoordinates() {
|
||||
@@ -97,7 +99,9 @@ class LinearRing extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {LinearRing} Simplified LinearRing.
|
||||
* @protected
|
||||
*/
|
||||
getSimplifiedGeometryInternal(squaredTolerance) {
|
||||
const simplifiedFlatCoordinates = [];
|
||||
@@ -108,7 +112,8 @@ class LinearRing extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Get the type of this geometry.
|
||||
* @return {import("./GeometryType.js").default} Geometry type.
|
||||
* @api
|
||||
*/
|
||||
getType() {
|
||||
@@ -116,7 +121,10 @@ class LinearRing extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @return {boolean} `true` if the geometry and the extent intersect.
|
||||
* @api
|
||||
*/
|
||||
intersectsExtent(extent) {
|
||||
return false;
|
||||
@@ -126,7 +134,6 @@ class LinearRing extends SimpleGeometry {
|
||||
* Set the coordinates of the linear ring.
|
||||
* @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
|
||||
* @param {GeometryLayout=} opt_layout Layout.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
setCoordinates(coordinates, opt_layout) {
|
||||
|
||||
@@ -93,7 +93,6 @@ class MultiLineString extends SimpleGeometry {
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @return {!MultiLineString} Clone.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -101,7 +100,11 @@ class MultiLineString extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
||||
* @param {number} minSquaredDistance Minimum squared distance.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
closestPointXY(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
@@ -154,7 +157,6 @@ class MultiLineString extends SimpleGeometry {
|
||||
/**
|
||||
* Return the coordinates of the multilinestring.
|
||||
* @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
getCoordinates() {
|
||||
@@ -224,7 +226,9 @@ class MultiLineString extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {MultiLineString} Simplified MultiLineString.
|
||||
* @protected
|
||||
*/
|
||||
getSimplifiedGeometryInternal(squaredTolerance) {
|
||||
const simplifiedFlatCoordinates = [];
|
||||
@@ -236,7 +240,8 @@ class MultiLineString extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Get the type of this geometry.
|
||||
* @return {import("./GeometryType.js").default} Geometry type.
|
||||
* @api
|
||||
*/
|
||||
getType() {
|
||||
@@ -244,7 +249,9 @@ class MultiLineString extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @return {boolean} `true` if the geometry and the extent intersect.
|
||||
* @api
|
||||
*/
|
||||
intersectsExtent(extent) {
|
||||
@@ -256,7 +263,6 @@ class MultiLineString extends SimpleGeometry {
|
||||
* Set the coordinates of the multilinestring.
|
||||
* @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
|
||||
* @param {GeometryLayout=} opt_layout Layout.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
setCoordinates(coordinates, opt_layout) {
|
||||
|
||||
@@ -49,7 +49,6 @@ class MultiPoint extends SimpleGeometry {
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @return {!MultiPoint} Clone.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -58,7 +57,11 @@ class MultiPoint extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
||||
* @param {number} minSquaredDistance Minimum squared distance.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
closestPointXY(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
@@ -83,7 +86,6 @@ class MultiPoint extends SimpleGeometry {
|
||||
/**
|
||||
* Return the coordinates of the multipoint.
|
||||
* @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
getCoordinates() {
|
||||
@@ -125,7 +127,8 @@ class MultiPoint extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Get the type of this geometry.
|
||||
* @return {import("./GeometryType.js").default} Geometry type.
|
||||
* @api
|
||||
*/
|
||||
getType() {
|
||||
@@ -133,7 +136,9 @@ class MultiPoint extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @return {boolean} `true` if the geometry and the extent intersect.
|
||||
* @api
|
||||
*/
|
||||
intersectsExtent(extent) {
|
||||
@@ -153,7 +158,6 @@ class MultiPoint extends SimpleGeometry {
|
||||
* Set the coordinates of the multipoint.
|
||||
* @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
|
||||
* @param {import("./GeometryLayout.js").default=} opt_layout Layout.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
setCoordinates(coordinates, opt_layout) {
|
||||
|
||||
@@ -138,7 +138,6 @@ class MultiPolygon extends SimpleGeometry {
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @return {!MultiPolygon} Clone.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -153,7 +152,11 @@ class MultiPolygon extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
||||
* @param {number} minSquaredDistance Minimum squared distance.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
closestPointXY(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
@@ -170,7 +173,9 @@ class MultiPolygon extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
containsXY(x, y) {
|
||||
return linearRingssContainsXY(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, x, y);
|
||||
@@ -196,7 +201,6 @@ class MultiPolygon extends SimpleGeometry {
|
||||
* By default, coordinate orientation will depend on how the geometry was
|
||||
* constructed.
|
||||
* @return {Array<Array<Array<import("../coordinate.js").Coordinate>>>} Coordinates.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
getCoordinates(opt_right) {
|
||||
@@ -266,7 +270,9 @@ class MultiPolygon extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {MultiPolygon} Simplified MultiPolygon.
|
||||
* @protected
|
||||
*/
|
||||
getSimplifiedGeometryInternal(squaredTolerance) {
|
||||
const simplifiedFlatCoordinates = [];
|
||||
@@ -332,7 +338,8 @@ class MultiPolygon extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Get the type of this geometry.
|
||||
* @return {import("./GeometryType.js").default} Geometry type.
|
||||
* @api
|
||||
*/
|
||||
getType() {
|
||||
@@ -340,7 +347,9 @@ class MultiPolygon extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @return {boolean} `true` if the geometry and the extent intersect.
|
||||
* @api
|
||||
*/
|
||||
intersectsExtent(extent) {
|
||||
@@ -352,7 +361,6 @@ class MultiPolygon extends SimpleGeometry {
|
||||
* Set the coordinates of the multipolygon.
|
||||
* @param {!Array<Array<Array<import("../coordinate.js").Coordinate>>>} coordinates Coordinates.
|
||||
* @param {GeometryLayout=} opt_layout Layout.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
setCoordinates(coordinates, opt_layout) {
|
||||
|
||||
@@ -27,7 +27,6 @@ class Point extends SimpleGeometry {
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @return {!Point} Clone.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -36,7 +35,11 @@ class Point extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
||||
* @param {number} minSquaredDistance Minimum squared distance.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
closestPointXY(x, y, closestPoint, minSquaredDistance) {
|
||||
const flatCoordinates = this.flatCoordinates;
|
||||
@@ -56,7 +59,6 @@ class Point extends SimpleGeometry {
|
||||
/**
|
||||
* Return the coordinate of the point.
|
||||
* @return {import("../coordinate.js").Coordinate} Coordinates.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
getCoordinates() {
|
||||
@@ -64,14 +66,17 @@ class Point extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @protected
|
||||
* @return {import("../extent.js").Extent} extent Extent.
|
||||
*/
|
||||
computeExtent(extent) {
|
||||
return createOrUpdateFromCoordinate(this.flatCoordinates, extent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Get the type of this geometry.
|
||||
* @return {import("./GeometryType.js").default} Geometry type.
|
||||
* @api
|
||||
*/
|
||||
getType() {
|
||||
@@ -79,7 +84,9 @@ class Point extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @return {boolean} `true` if the geometry and the extent intersect.
|
||||
* @api
|
||||
*/
|
||||
intersectsExtent(extent) {
|
||||
@@ -87,7 +94,8 @@ class Point extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {!Array<*>} coordinates Coordinates.
|
||||
* @param {import("./GeometryLayout.js").default=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
setCoordinates(coordinates, opt_layout) {
|
||||
|
||||
@@ -112,7 +112,6 @@ class Polygon extends SimpleGeometry {
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @return {!Polygon} Clone.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -120,7 +119,11 @@ class Polygon extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
|
||||
* @param {number} minSquaredDistance Minimum squared distance.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
closestPointXY(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
@@ -137,7 +140,9 @@ class Polygon extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
containsXY(x, y) {
|
||||
return linearRingsContainsXY(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y);
|
||||
@@ -163,7 +168,6 @@ class Polygon extends SimpleGeometry {
|
||||
* By default, coordinate orientation will depend on how the geometry was
|
||||
* constructed.
|
||||
* @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
getCoordinates(opt_right) {
|
||||
@@ -281,7 +285,9 @@ class Polygon extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {Polygon} Simplified Polygon.
|
||||
* @protected
|
||||
*/
|
||||
getSimplifiedGeometryInternal(squaredTolerance) {
|
||||
const simplifiedFlatCoordinates = [];
|
||||
@@ -294,7 +300,8 @@ class Polygon extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Get the type of this geometry.
|
||||
* @return {import("./GeometryType.js").default} Geometry type.
|
||||
* @api
|
||||
*/
|
||||
getType() {
|
||||
@@ -302,7 +309,9 @@ class Polygon extends SimpleGeometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @return {boolean} `true` if the geometry and the extent intersect.
|
||||
* @api
|
||||
*/
|
||||
intersectsExtent(extent) {
|
||||
@@ -314,7 +323,6 @@ class Polygon extends SimpleGeometry {
|
||||
* Set the coordinates of the polygon.
|
||||
* @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
|
||||
* @param {GeometryLayout=} opt_layout Layout.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
setCoordinates(coordinates, opt_layout) {
|
||||
|
||||
@@ -41,7 +41,9 @@ class SimpleGeometry extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @protected
|
||||
* @return {import("../extent.js").Extent} extent Extent.
|
||||
*/
|
||||
computeExtent(extent) {
|
||||
return createOrUpdateFromFlatCoordinates(this.flatCoordinates,
|
||||
@@ -91,7 +93,9 @@ class SimpleGeometry extends Geometry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Create a simplified version of this geometry using the Douglas Peucker algorithm.
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {SimpleGeometry} Simplified geometry.
|
||||
*/
|
||||
getSimplifiedGeometry(squaredTolerance) {
|
||||
if (this.simplifiedGeometryRevision !== this.getRevision()) {
|
||||
@@ -224,8 +228,7 @@ class SimpleGeometry extends Geometry {
|
||||
* Scale the geometry (with an optional origin). This modifies the geometry
|
||||
* coordinates in place.
|
||||
* @param {number} sx The scaling factor in the x-direction.
|
||||
* @param {number=} opt_sy The scaling factor in the y-direction (defaults to
|
||||
* sx).
|
||||
* @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx).
|
||||
* @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center
|
||||
* of the geometry extent).
|
||||
* @api
|
||||
|
||||
@@ -185,7 +185,10 @@ class DragAndDrop extends Interaction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Activate or deactivate the interaction.
|
||||
* @param {boolean} active Active.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
setActive(active) {
|
||||
if (!this.getActive() && active) {
|
||||
@@ -198,7 +201,10 @@ class DragAndDrop extends Interaction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map) {
|
||||
this.unregisterListeners_();
|
||||
|
||||
@@ -181,7 +181,8 @@ class DragBox extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
handleDragEvent(mapBrowserEvent) {
|
||||
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
|
||||
@@ -191,7 +192,9 @@ class DragBox extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleUpEvent(mapBrowserEvent) {
|
||||
this.box_.setMap(null);
|
||||
@@ -205,7 +208,9 @@ class DragBox extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleDownEvent(mapBrowserEvent) {
|
||||
if (this.condition_(mapBrowserEvent)) {
|
||||
|
||||
@@ -86,7 +86,8 @@ class DragPan extends PointerInteraction {
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
handleDragEvent(mapBrowserEvent) {
|
||||
if (!this.panning_) {
|
||||
@@ -121,7 +122,9 @@ class DragPan extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleUpEvent(mapBrowserEvent) {
|
||||
const map = mapBrowserEvent.map;
|
||||
@@ -159,7 +162,9 @@ class DragPan extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleDownEvent(mapBrowserEvent) {
|
||||
if (this.targetPointers.length > 0 && this.conditionInternal_(mapBrowserEvent)) {
|
||||
|
||||
@@ -60,7 +60,8 @@ class DragRotate extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
handleDragEvent(mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
@@ -85,7 +86,9 @@ class DragRotate extends PointerInteraction {
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleUpEvent(mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
@@ -100,7 +103,9 @@ class DragRotate extends PointerInteraction {
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleDownEvent(mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
|
||||
@@ -70,7 +70,8 @@ class DragRotateAndZoom extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
handleDragEvent(mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
@@ -100,7 +101,9 @@ class DragRotateAndZoom extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleUpEvent(mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
@@ -116,7 +119,9 @@ class DragRotateAndZoom extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleDownEvent(mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
|
||||
@@ -465,7 +465,10 @@ class Draw extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map) {
|
||||
super.setMap(map);
|
||||
@@ -483,7 +486,8 @@ class Draw extends PointerInteraction {
|
||||
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may actually draw or finish the drawing.
|
||||
* @override
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} event Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
* @api
|
||||
*/
|
||||
handleEvent(event) {
|
||||
@@ -520,7 +524,7 @@ class Draw extends PointerInteraction {
|
||||
pass = event.type === MapBrowserEventType.POINTERMOVE;
|
||||
if (pass && this.freehand_) {
|
||||
pass = this.handlePointerMove_(event);
|
||||
} else if (/** @type {MapBrowserPointerEvent} */ (event).pointerEvent.pointerType == 'mouse' ||
|
||||
} else if (event.pointerEvent.pointerType == 'mouse' ||
|
||||
(event.type === MapBrowserEventType.POINTERDRAG && this.downTimeout_ === undefined)) {
|
||||
this.handlePointerMove_(event);
|
||||
}
|
||||
@@ -532,7 +536,9 @@ class Draw extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleDownEvent(event) {
|
||||
this.shouldHandle_ = !this.freehand_;
|
||||
@@ -559,7 +565,9 @@ class Draw extends PointerInteraction {
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleUpEvent(event) {
|
||||
let pass = true;
|
||||
|
||||
@@ -273,10 +273,11 @@ class Extent extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
*/
|
||||
handleEvent(mapBrowserEvent) {
|
||||
if (!(/** @type {import("../MapBrowserPointerEvent.js").default} */ (mapBrowserEvent).pointerEvent)) {
|
||||
if (!mapBrowserEvent.pointerEvent) {
|
||||
return true;
|
||||
}
|
||||
//display pointer (if not dragging)
|
||||
@@ -290,7 +291,9 @@ class Extent extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleDownEvent(mapBrowserEvent) {
|
||||
const pixel = mapBrowserEvent.pixel;
|
||||
@@ -347,7 +350,8 @@ class Extent extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
handleDragEvent(mapBrowserEvent) {
|
||||
if (this.pointerHandler_) {
|
||||
@@ -355,11 +359,12 @@ class Extent extends PointerInteraction {
|
||||
this.setExtent(this.pointerHandler_(pixelCoordinate));
|
||||
this.createOrUpdatePointerFeature_(pixelCoordinate);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleUpEvent(mapBrowserEvent) {
|
||||
this.pointerHandler_ = null;
|
||||
@@ -372,7 +377,10 @@ class Extent extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map) {
|
||||
this.extentOverlay_.setMap(map);
|
||||
|
||||
@@ -404,7 +404,10 @@ class Modify extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Activate or deactivate the interaction.
|
||||
* @param {boolean} active Active.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
setActive(active) {
|
||||
if (this.vertexFeature_ && !active) {
|
||||
@@ -415,7 +418,10 @@ class Modify extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map) {
|
||||
this.overlay_.setMap(map);
|
||||
@@ -702,10 +708,11 @@ class Modify extends PointerInteraction {
|
||||
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may modify the geometry.
|
||||
* @override
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
*/
|
||||
handleEvent(mapBrowserEvent) {
|
||||
if (!(/** @type {import("../MapBrowserPointerEvent.js").default} */ (mapBrowserEvent).pointerEvent)) {
|
||||
if (!mapBrowserEvent.pointerEvent) {
|
||||
return true;
|
||||
}
|
||||
this.lastPointerEvent_ = mapBrowserEvent;
|
||||
@@ -732,7 +739,8 @@ class Modify extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
|
||||
*/
|
||||
handleDragEvent(evt) {
|
||||
this.ignoreNextSingleClick_ = false;
|
||||
@@ -818,7 +826,9 @@ class Modify extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleDownEvent(evt) {
|
||||
if (!this.condition_(evt)) {
|
||||
@@ -899,7 +909,9 @@ class Modify extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleUpEvent(evt) {
|
||||
for (let i = this.dragSegments_.length - 1; i >= 0; --i) {
|
||||
|
||||
@@ -162,7 +162,8 @@ class MouseWheelZoom extends Interaction {
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually
|
||||
* zooms the map.
|
||||
* @override
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
*/
|
||||
handleEvent(mapBrowserEvent) {
|
||||
if (!this.conditionInternal_(mapBrowserEvent)) {
|
||||
|
||||
@@ -75,7 +75,8 @@ class PinchRotate extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
handleDragEvent(mapBrowserEvent) {
|
||||
let rotationDelta = 0.0;
|
||||
@@ -122,7 +123,9 @@ class PinchRotate extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleUpEvent(mapBrowserEvent) {
|
||||
if (this.targetPointers.length < 2) {
|
||||
@@ -136,7 +139,9 @@ class PinchRotate extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleDownEvent(mapBrowserEvent) {
|
||||
if (this.targetPointers.length >= 2) {
|
||||
|
||||
@@ -60,7 +60,8 @@ class PinchZoom extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
handleDragEvent(mapBrowserEvent) {
|
||||
let scaleDelta = 1.0;
|
||||
@@ -99,7 +100,9 @@ class PinchZoom extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleUpEvent(mapBrowserEvent) {
|
||||
if (this.targetPointers.length < 2) {
|
||||
@@ -114,7 +117,9 @@ class PinchZoom extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleDownEvent(mapBrowserEvent) {
|
||||
if (this.targetPointers.length >= 2) {
|
||||
|
||||
@@ -126,11 +126,12 @@ class PointerInteraction extends Interaction {
|
||||
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may call into
|
||||
* other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are
|
||||
* detected.
|
||||
* @override
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
* @api
|
||||
*/
|
||||
handleEvent(mapBrowserEvent) {
|
||||
if (!(/** @type {import("../MapBrowserPointerEvent.js").default} */ (mapBrowserEvent).pointerEvent)) {
|
||||
if (!mapBrowserEvent.pointerEvent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,6 @@ class Select extends Interaction {
|
||||
* Remove the interaction from its current map, if any, and attach it to a new
|
||||
* map, if any. Pass `null` to just remove the interaction from the current map.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
setMap(map) {
|
||||
|
||||
@@ -243,7 +243,8 @@ class Snap extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} evt Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
*/
|
||||
handleEvent(evt) {
|
||||
const result = this.snapTo(evt.pixel, evt.coordinate, evt.map);
|
||||
@@ -289,7 +290,9 @@ class Snap extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleUpEvent(evt) {
|
||||
const featuresToUpdate = getValues(this.pendingFeatures_);
|
||||
@@ -331,7 +334,10 @@ class Snap extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map) {
|
||||
const currentMap = this.getMap();
|
||||
|
||||
@@ -193,7 +193,9 @@ class Translate extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleDownEvent(event) {
|
||||
this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);
|
||||
@@ -214,7 +216,9 @@ class Translate extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
handleUpEvent(event) {
|
||||
if (this.lastCoordinate_) {
|
||||
@@ -235,7 +239,8 @@ class Translate extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
||||
*/
|
||||
handleDragEvent(event) {
|
||||
if (this.lastCoordinate_) {
|
||||
@@ -260,7 +265,8 @@ class Translate extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Handle pointer move events.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
||||
*/
|
||||
handleMoveEvent(event) {
|
||||
const elem = event.map.getViewport();
|
||||
@@ -318,7 +324,10 @@ class Translate extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map) {
|
||||
const oldMap = this.getMap();
|
||||
|
||||
@@ -322,7 +322,7 @@ class BaseLayer extends BaseObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
if (this.state_) {
|
||||
|
||||
@@ -190,7 +190,8 @@ class LayerGroup extends BaseLayer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {Array<import("./Layer.js").default>=} opt_array Array of layers (to be modified in place).
|
||||
* @return {Array<import("./Layer.js").default>} Array of layers.
|
||||
*/
|
||||
getLayersArray(opt_array) {
|
||||
const array = opt_array !== undefined ? opt_array : [];
|
||||
@@ -201,7 +202,8 @@ class LayerGroup extends BaseLayer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {Array<import("./Layer.js").State>=} opt_states Optional list of layer states (to be modified in place).
|
||||
* @return {Array<import("./Layer.js").State>} List of layer states.
|
||||
*/
|
||||
getLayerStatesArray(opt_states) {
|
||||
const states = opt_states !== undefined ? opt_states : [];
|
||||
@@ -238,7 +240,7 @@ class LayerGroup extends BaseLayer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {import("../source/State.js").default} Source state.
|
||||
*/
|
||||
getSourceState() {
|
||||
return SourceState.READY;
|
||||
|
||||
@@ -178,7 +178,8 @@ class Heatmap extends VectorLayer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Create a renderer for this layer.
|
||||
* @return {WebGLPointsLayerRenderer} A layer renderer.
|
||||
*/
|
||||
createRenderer() {
|
||||
return new WebGLPointsLayerRenderer(this, {
|
||||
|
||||
@@ -46,7 +46,7 @@ import {assert} from '../asserts.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} State
|
||||
* @property {import("./Base.js").default} layer
|
||||
* @property {import("./Layer.js").default} layer
|
||||
* @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point.
|
||||
* @property {SourceState} sourceState
|
||||
* @property {boolean} visible
|
||||
@@ -138,7 +138,8 @@ class Layer extends BaseLayer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {Array<import("./Layer.js").default>=} opt_array Array of layers (to be modified in place).
|
||||
* @return {Array<import("./Layer.js").default>} Array of layers.
|
||||
*/
|
||||
getLayersArray(opt_array) {
|
||||
const array = opt_array ? opt_array : [];
|
||||
@@ -147,7 +148,8 @@ class Layer extends BaseLayer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {Array<import("./Layer.js").State>=} opt_states Optional list of layer states (to be modified in place).
|
||||
* @return {Array<import("./Layer.js").State>} List of layer states.
|
||||
*/
|
||||
getLayerStatesArray(opt_states) {
|
||||
const states = opt_states ? opt_states : [];
|
||||
@@ -166,8 +168,8 @@ class Layer extends BaseLayer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
* @return {import("../source/State.js").default} Source state.
|
||||
*/
|
||||
getSourceState() {
|
||||
const source = this.getSource();
|
||||
return !source ? SourceState.UNDEFINED : source.getState();
|
||||
@@ -299,7 +301,7 @@ class Layer extends BaseLayer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
this.setSource(null);
|
||||
|
||||
@@ -93,7 +93,8 @@ class WebGLPointsLayer extends Layer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Create a renderer for this layer.
|
||||
* @return {WebGLPointsLayerRenderer} A layer renderer.
|
||||
*/
|
||||
createRenderer() {
|
||||
return new WebGLPointsLayerRenderer(this, {
|
||||
@@ -109,8 +110,7 @@ class WebGLPointsLayer extends Layer {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
this.renderer_.dispose();
|
||||
|
||||
@@ -47,7 +47,7 @@ class RenderBox extends Disposable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
this.setMap(null);
|
||||
|
||||
@@ -87,7 +87,7 @@ class VectorContext {
|
||||
drawPolygon(polygonGeometry, feature) {}
|
||||
|
||||
/**
|
||||
* @param {import("../geom/Geometry.js").default|import("./Feature.js").default} geometry Geometry.
|
||||
* @param {import("../geom/SimpleGeometry.js").default|import("./Feature.js").default} geometry Geometry.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
drawText(geometry, feature) {}
|
||||
|
||||
@@ -203,7 +203,9 @@ class CanvasBuilder extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc.
|
||||
* @param {import("../../geom/SimpleGeometry.js").default} geometry Geometry.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {Function} renderer Renderer.
|
||||
*/
|
||||
drawCustom(geometry, feature, renderer) {
|
||||
this.beginGeometry(geometry, feature);
|
||||
@@ -213,10 +215,9 @@ class CanvasBuilder extends VectorContext {
|
||||
let flatCoordinates, builderEnd, builderEnds, builderEndss;
|
||||
let offset;
|
||||
if (type == GeometryType.MULTI_POLYGON) {
|
||||
geometry = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry);
|
||||
flatCoordinates = geometry.getOrientedFlatCoordinates();
|
||||
flatCoordinates = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getOrientedFlatCoordinates();
|
||||
builderEndss = [];
|
||||
const endss = geometry.getEndss();
|
||||
const endss = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getEndss();
|
||||
offset = 0;
|
||||
for (let i = 0, ii = endss.length; i < ii; ++i) {
|
||||
const myEnds = [];
|
||||
@@ -302,7 +303,8 @@ class CanvasBuilder extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../style/Fill.js").default} fillStyle Fill style.
|
||||
* @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
|
||||
*/
|
||||
setFillStrokeStyle(fillStyle, strokeStyle) {
|
||||
const state = this.state;
|
||||
|
||||
@@ -107,7 +107,8 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../geom/Point.js").default|import("../Feature.js").default} pointGeometry Point geometry.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
drawPoint(pointGeometry, feature) {
|
||||
if (!this.image_) {
|
||||
@@ -136,7 +137,8 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} multiPointGeometry MultiPoint geometry.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
drawMultiPoint(multiPointGeometry, feature) {
|
||||
if (!this.image_) {
|
||||
@@ -166,7 +168,7 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {import("./Builder.js").SerializableInstructions} the serializable instructions.
|
||||
*/
|
||||
finish() {
|
||||
this.reverseHitDetectionInstructions();
|
||||
@@ -187,7 +189,8 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../style/Image.js").default} imageStyle Image style.
|
||||
* @param {import("../canvas.js").DeclutterGroup} declutterGroups Declutter.
|
||||
*/
|
||||
setImageStyle(imageStyle, declutterGroups) {
|
||||
const anchor = imageStyle.getAnchor();
|
||||
@@ -197,7 +200,7 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
const origin = imageStyle.getOrigin();
|
||||
this.anchorX_ = anchor[0];
|
||||
this.anchorY_ = anchor[1];
|
||||
this.declutterGroups_ = /** @type {import("../canvas.js").DeclutterGroups} */ (declutterGroups);
|
||||
this.declutterGroups_ = declutterGroups;
|
||||
this.hitDetectionImage_ = hitDetectionImage;
|
||||
this.image_ = image;
|
||||
this.height_ = size[1];
|
||||
|
||||
@@ -390,7 +390,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* the current fill and stroke styles.
|
||||
*
|
||||
* @param {import("../../geom/Circle.js").default} geometry Circle geometry.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
drawCircle(geometry) {
|
||||
@@ -430,7 +429,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* any `zIndex` on the provided style will be ignored.
|
||||
*
|
||||
* @param {import("../../style/Style.js").default} style The rendering style.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
setStyle(style) {
|
||||
@@ -451,7 +449,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* {@link module:ol/render/canvas/Immediate#setStyle} first to set the rendering style.
|
||||
*
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry The geometry to render.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
drawGeometry(geometry) {
|
||||
@@ -493,7 +490,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
*
|
||||
* @param {import("../../Feature.js").default} feature Feature.
|
||||
* @param {import("../../style/Style.js").default} style Style.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
drawFeature(feature, style) {
|
||||
@@ -510,7 +506,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* uses the current styles appropriate for each geometry in the collection.
|
||||
*
|
||||
* @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection.
|
||||
* @override
|
||||
*/
|
||||
drawGeometryCollection(geometry) {
|
||||
const geometries = geometry.getGeometriesArray();
|
||||
@@ -524,7 +519,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* the current style.
|
||||
*
|
||||
* @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry.
|
||||
* @override
|
||||
*/
|
||||
drawPoint(geometry) {
|
||||
if (this.squaredTolerance_) {
|
||||
@@ -545,7 +539,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* uses the current style.
|
||||
*
|
||||
* @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry.
|
||||
* @override
|
||||
*/
|
||||
drawMultiPoint(geometry) {
|
||||
if (this.squaredTolerance_) {
|
||||
@@ -566,7 +559,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* the current style.
|
||||
*
|
||||
* @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry.
|
||||
* @override
|
||||
*/
|
||||
drawLineString(geometry) {
|
||||
if (this.squaredTolerance_) {
|
||||
@@ -595,7 +587,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* and uses the current style.
|
||||
*
|
||||
* @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry.
|
||||
* @override
|
||||
*/
|
||||
drawMultiLineString(geometry) {
|
||||
if (this.squaredTolerance_) {
|
||||
@@ -629,7 +620,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* the current style.
|
||||
*
|
||||
* @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry.
|
||||
* @override
|
||||
*/
|
||||
drawPolygon(geometry) {
|
||||
if (this.squaredTolerance_) {
|
||||
@@ -666,7 +656,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Render MultiPolygon geometry into the canvas. Rendering is immediate and
|
||||
* uses the current style.
|
||||
* @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry.
|
||||
* @override
|
||||
*/
|
||||
drawMultiPolygon(geometry) {
|
||||
if (this.squaredTolerance_) {
|
||||
@@ -824,7 +813,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
*
|
||||
* @param {import("../../style/Fill.js").default} fillStyle Fill style.
|
||||
* @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
|
||||
* @override
|
||||
*/
|
||||
setFillStrokeStyle(fillStyle, strokeStyle) {
|
||||
if (!fillStyle) {
|
||||
@@ -870,7 +858,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* the image style.
|
||||
*
|
||||
* @param {import("../../style/Image.js").default} imageStyle Image style.
|
||||
* @override
|
||||
*/
|
||||
setImageStyle(imageStyle) {
|
||||
if (!imageStyle) {
|
||||
@@ -900,7 +887,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* remove the text style.
|
||||
*
|
||||
* @param {import("../../style/Text.js").default} textStyle Text style.
|
||||
* @override
|
||||
*/
|
||||
setTextStyle(textStyle) {
|
||||
if (!textStyle) {
|
||||
|
||||
@@ -34,7 +34,8 @@ class CanvasLineStringBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../geom/LineString.js").default|import("../Feature.js").default} lineStringGeometry Line string geometry.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
drawLineString(lineStringGeometry, feature) {
|
||||
const state = this.state;
|
||||
@@ -58,7 +59,8 @@ class CanvasLineStringBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} multiLineStringGeometry MultiLineString geometry.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
drawMultiLineString(multiLineStringGeometry, feature) {
|
||||
const state = this.state;
|
||||
@@ -79,14 +81,14 @@ class CanvasLineStringBuilder extends CanvasBuilder {
|
||||
const stride = multiLineStringGeometry.getStride();
|
||||
let offset = 0;
|
||||
for (let i = 0, ii = ends.length; i < ii; ++i) {
|
||||
offset = this.drawFlatCoordinates_(flatCoordinates, offset, ends[i], stride);
|
||||
offset = this.drawFlatCoordinates_(flatCoordinates, offset, /** @type {number} */ (ends[i]), stride);
|
||||
}
|
||||
this.hitDetectionInstructions.push(strokeInstruction);
|
||||
this.endGeometry(feature);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {import("./Builder.js").SerializableInstructions} the serializable instructions.
|
||||
*/
|
||||
finish() {
|
||||
const state = this.state;
|
||||
@@ -99,7 +101,7 @@ class CanvasLineStringBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc.
|
||||
* @param {import("../canvas.js").FillStrokeState} state State.
|
||||
*/
|
||||
applyStroke(state) {
|
||||
if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) {
|
||||
|
||||
@@ -62,7 +62,8 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../geom/Circle.js").default} circleGeometry Circle geometry.
|
||||
* @param {import("../../Feature.js").default} feature Feature.
|
||||
*/
|
||||
drawCircle(circleGeometry, feature) {
|
||||
const state = this.state;
|
||||
@@ -106,7 +107,8 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} polygonGeometry Polygon geometry.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
drawPolygon(polygonGeometry, feature) {
|
||||
const state = this.state;
|
||||
@@ -133,12 +135,13 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
||||
const ends = polygonGeometry.getEnds();
|
||||
const flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();
|
||||
const stride = polygonGeometry.getStride();
|
||||
this.drawFlatCoordinatess_(flatCoordinates, 0, ends, stride);
|
||||
this.drawFlatCoordinatess_(flatCoordinates, 0, /** @type {Array<number>} */ (ends), stride);
|
||||
this.endGeometry(feature);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
drawMultiPolygon(multiPolygonGeometry, feature) {
|
||||
const state = this.state;
|
||||
@@ -173,7 +176,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {import("./Builder.js").SerializableInstructions} the serializable instructions.
|
||||
*/
|
||||
finish() {
|
||||
this.reverseHitDetectionInstructions();
|
||||
|
||||
@@ -134,7 +134,7 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {import("./Builder.js").SerializableInstructions} the serializable instructions.
|
||||
*/
|
||||
finish() {
|
||||
const instructions = super.finish();
|
||||
@@ -145,7 +145,8 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../geom/SimpleGeometry.js").default|import("../Feature.js").default} geometry Geometry.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
drawText(geometry, feature) {
|
||||
const fillState = this.textFillState_;
|
||||
@@ -173,11 +174,11 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
if (geometryType == GeometryType.LINE_STRING) {
|
||||
ends = [flatCoordinates.length];
|
||||
} else if (geometryType == GeometryType.MULTI_LINE_STRING) {
|
||||
ends = geometry.getEnds();
|
||||
ends = /** @type {import("../../geom/MultiLineString.js").default} */ (geometry).getEnds();
|
||||
} else if (geometryType == GeometryType.POLYGON) {
|
||||
ends = geometry.getEnds().slice(0, 1);
|
||||
ends = /** @type {import("../../geom/Polygon.js").default} */ (geometry).getEnds().slice(0, 1);
|
||||
} else if (geometryType == GeometryType.MULTI_POLYGON) {
|
||||
const endss = geometry.getEndss();
|
||||
const endss = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getEndss();
|
||||
ends = [];
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
ends.push(endss[i][0]);
|
||||
@@ -217,7 +218,7 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
switch (geometryType) {
|
||||
case GeometryType.POINT:
|
||||
case GeometryType.MULTI_POINT:
|
||||
flatCoordinates = geometry.getFlatCoordinates();
|
||||
flatCoordinates = /** @type {import("../../geom/MultiPoint.js").default} */ (geometry).getFlatCoordinates();
|
||||
end = flatCoordinates.length;
|
||||
break;
|
||||
case GeometryType.LINE_STRING:
|
||||
@@ -379,14 +380,15 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../style/Text.js").default} textStyle Text style.
|
||||
* @param {import("../canvas.js").DeclutterGroups} declutterGroups Declutter.
|
||||
*/
|
||||
setTextStyle(textStyle, declutterGroups) {
|
||||
let textState, fillState, strokeState;
|
||||
if (!textStyle) {
|
||||
this.text_ = '';
|
||||
} else {
|
||||
this.declutterGroups_ = /** @type {import("../canvas.js").DeclutterGroups} */ (declutterGroups);
|
||||
this.declutterGroups_ = declutterGroups;
|
||||
|
||||
const textFillStyle = textStyle.getFill();
|
||||
if (!textFillStyle) {
|
||||
|
||||
@@ -79,7 +79,8 @@ class CompositeMapRenderer extends MapRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Render.
|
||||
* @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
*/
|
||||
renderFrame(frameState) {
|
||||
if (!frameState) {
|
||||
@@ -133,7 +134,17 @@ class CompositeMapRenderer extends MapRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../pixel.js").Pixel} pixel Pixel.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState FrameState.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {function(import("../layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer
|
||||
* callback.
|
||||
* @param {function(import("../layer/Layer.js").default): boolean} layerFilter Layer filter
|
||||
* function, only layers which are visible and for which this function
|
||||
* returns `true` will be tested for features. By default, all visible
|
||||
* layers will be tested.
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
forEachLayerAtPixel(pixel, frameState, hitTolerance, callback, layerFilter) {
|
||||
const viewState = frameState.viewState;
|
||||
|
||||
@@ -23,7 +23,7 @@ class LayerRenderer extends Observable {
|
||||
this.boundHandleImageChange_ = this.handleImageChange_.bind(this);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @protected
|
||||
* @type {LayerType}
|
||||
*/
|
||||
this.layer_ = layer;
|
||||
@@ -65,12 +65,14 @@ class LayerRenderer extends Observable {
|
||||
* @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
|
||||
* @param {number} zoom Zoom level.
|
||||
* @param {import("../Tile.js").default} tile Tile.
|
||||
* @return {boolean|void} If `false`, the tile will not be considered loaded.
|
||||
*/
|
||||
loadedTileCallback(tiles, zoom, tile) {
|
||||
if (!tiles[zoom]) {
|
||||
tiles[zoom] = {};
|
||||
}
|
||||
tiles[zoom][tile.tileCoord.toString()] = tile;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -151,14 +151,14 @@ class MapRenderer extends Disposable {
|
||||
* @param {import("../pixel.js").Pixel} pixel Pixel.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState FrameState.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {function(this: S, import("../layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer
|
||||
* @param {function(import("../layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer
|
||||
* callback.
|
||||
* @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter
|
||||
* @param {function(import("../layer/Layer.js").default): boolean} layerFilter Layer filter
|
||||
* function, only layers which are visible and for which this function
|
||||
* returns `true` will be tested for features. By default, all visible
|
||||
* layers will be tested.
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template S,T,U
|
||||
* @template T
|
||||
*/
|
||||
forEachLayerAtPixel(pixel, frameState, hitTolerance, callback, layerFilter) {
|
||||
return abstract();
|
||||
|
||||
@@ -31,14 +31,16 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
|
||||
*/
|
||||
getImage() {
|
||||
return !this.image_ ? null : this.image_.getImage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Determine whether render should be called.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {boolean} Layer is ready to be rendered.
|
||||
*/
|
||||
prepareFrame(frameState) {
|
||||
const layerState = frameState.layerStatesArray[frameState.layerIndex];
|
||||
@@ -77,7 +79,10 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Render the layer.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {HTMLElement} target Target that may be used to render content to.
|
||||
* @return {HTMLElement} The rendered element.
|
||||
*/
|
||||
renderFrame(frameState, target) {
|
||||
const image = this.image_;
|
||||
|
||||
@@ -123,7 +123,10 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {Object<number, Object<string, import("../../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
|
||||
* @param {number} zoom Zoom level.
|
||||
* @param {import("../../Tile.js").default} tile Tile.
|
||||
* @return {boolean|void} If `false`, the tile will not be considered loaded.
|
||||
*/
|
||||
loadedTileCallback(tiles, zoom, tile) {
|
||||
if (this.isDrawableTile(tile)) {
|
||||
@@ -133,19 +136,19 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Determine whether render should be called.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {boolean} Layer is ready to be rendered.
|
||||
*/
|
||||
prepareFrame(frameState) {
|
||||
return !!this.getLayer().getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: File a TypeScript issue about inheritDoc not being followed
|
||||
* all the way. Without this explicit return type, the VectorTileLayer
|
||||
* renderFrame function does not pass.
|
||||
*
|
||||
* @inheritDoc
|
||||
* @returns {HTMLElement} The rendered element.
|
||||
* Render the layer.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {HTMLElement} target Target that may be used to render content to.
|
||||
* @return {HTMLElement} The rendered element.
|
||||
*/
|
||||
renderFrame(frameState, target) {
|
||||
const layerState = frameState.layerStatesArray[frameState.layerIndex];
|
||||
@@ -418,7 +421,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {HTMLCanvasElement} Image
|
||||
*/
|
||||
getImage() {
|
||||
const context = this.context;
|
||||
|
||||
@@ -52,7 +52,7 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
this.vectorRenderer_.dispose();
|
||||
@@ -60,7 +60,9 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Asynchronous layer level hit detection.
|
||||
* @param {import("../../pixel.js").Pixel} pixel Pixel.
|
||||
* @return {Promise<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
|
||||
*/
|
||||
getFeatures(pixel) {
|
||||
if (this.vectorRenderer_) {
|
||||
@@ -76,14 +78,16 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Perform action necessary to get the layer rendered after new fonts have loaded
|
||||
*/
|
||||
handleFontsChanged() {
|
||||
this.vectorRenderer_.handleFontsChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Determine whether render should be called.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {boolean} Layer is ready to be rendered.
|
||||
*/
|
||||
prepareFrame(frameState) {
|
||||
const pixelRatio = frameState.pixelRatio;
|
||||
@@ -145,17 +149,21 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
preRender() {}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
postRender() {}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {function(import("../../Feature.js").FeatureLike, import("../../layer/Layer.js").default): T} callback Feature callback.
|
||||
* @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
|
||||
* @return {T|void} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
|
||||
if (this.vectorRenderer_) {
|
||||
|
||||
@@ -107,7 +107,10 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Get a rendering container from an existing target, if compatible.
|
||||
* @param {HTMLElement} target Potential render target.
|
||||
* @param {string} transform CSS Transform.
|
||||
* @param {number} opacity Opacity.
|
||||
*/
|
||||
useContainer(target, transform, opacity) {
|
||||
if (opacity < 1) {
|
||||
@@ -117,7 +120,10 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Render the layer.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {HTMLElement} target Target that may be used to render content to.
|
||||
* @return {HTMLElement} The rendered element.
|
||||
*/
|
||||
renderFrame(frameState, target) {
|
||||
|
||||
@@ -221,14 +227,16 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
||||
const opacity = layerState.opacity;
|
||||
const container = this.container;
|
||||
if (opacity !== parseFloat(container.style.opacity)) {
|
||||
container.style.opacity = opacity === 1 ? '' : opacity;
|
||||
container.style.opacity = opacity === 1 ? '' : String(opacity);
|
||||
}
|
||||
|
||||
return this.container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Asynchronous layer level hit detection.
|
||||
* @param {import("../../pixel.js").Pixel} pixel Pixel.
|
||||
* @return {Promise<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
|
||||
*/
|
||||
getFeatures(pixel) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
@@ -276,7 +284,13 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {function(import("../../Feature.js").FeatureLike, import("../../layer/Layer.js").default): T} callback Feature callback.
|
||||
* @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
|
||||
* @return {T|void} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
|
||||
if (!this.replayGroup_) {
|
||||
@@ -306,7 +320,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Perform action necessary to get the layer rendered after new fonts have loaded
|
||||
*/
|
||||
handleFontsChanged() {
|
||||
const layer = this.getLayer();
|
||||
@@ -325,7 +339,9 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Determine whether render should be called.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {boolean} Layer is ready to be rendered.
|
||||
*/
|
||||
prepareFrame(frameState) {
|
||||
const vectorLayer = this.getLayer();
|
||||
|
||||
@@ -136,7 +136,11 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {number} z Tile coordinate z.
|
||||
* @param {number} x Tile coordinate x.
|
||||
* @param {number} y Tile coordinate y.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {!import("../../Tile.js").default} Tile.
|
||||
*/
|
||||
getTile(z, x, y, frameState) {
|
||||
const pixelRatio = frameState.pixelRatio;
|
||||
@@ -167,7 +171,8 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @param {import("../../VectorRenderTile.js").default} tile Tile.
|
||||
* @return {boolean} Tile is drawable.
|
||||
*/
|
||||
isDrawableTile(tile) {
|
||||
const layer = this.getLayer();
|
||||
@@ -182,7 +187,9 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Determine whether render should be called.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {boolean} Layer is ready to be rendered.
|
||||
*/
|
||||
prepareFrame(frameState) {
|
||||
const layerRevision = this.getLayer().getRevision();
|
||||
@@ -279,13 +286,19 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {function(import("../../Feature.js").FeatureLike, import("../../layer/Layer.js").default): T} callback Feature callback.
|
||||
* @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
|
||||
* @return {T|void} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
|
||||
const resolution = frameState.viewState.resolution;
|
||||
const rotation = frameState.viewState.rotation;
|
||||
hitTolerance = hitTolerance == undefined ? 0 : hitTolerance;
|
||||
const layer = /** @type {import("../../layer/VectorTile.js").default} */ (this.getLayer());
|
||||
const layer = this.getLayer();
|
||||
const declutter = layer.getDeclutter();
|
||||
const source = layer.getSource();
|
||||
const tileGrid = source.getTileGridForProjection(frameState.viewState.projection);
|
||||
@@ -334,7 +347,9 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Asynchronous layer level hit detection.
|
||||
* @param {import("../../pixel.js").Pixel} pixel Pixel.
|
||||
* @return {Promise<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
|
||||
*/
|
||||
getFeatures(pixel) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
@@ -394,7 +409,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Perform action necessary to get the layer rendered after new fonts have loaded
|
||||
*/
|
||||
handleFontsChanged() {
|
||||
clear(this.renderTileImageQueue_);
|
||||
@@ -414,7 +429,10 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Render the layer.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {HTMLElement} target Target that may be used to render content to.
|
||||
* @return {HTMLElement} The rendered element.
|
||||
*/
|
||||
renderFrame(frameState, target) {
|
||||
const viewHints = frameState.viewHints;
|
||||
|
||||
@@ -68,7 +68,7 @@ class WebGLLayerRenderer extends LayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
this.helper.dispose();
|
||||
|
||||
@@ -349,7 +349,9 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Render the layer.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {HTMLElement} The rendered element.
|
||||
*/
|
||||
renderFrame(frameState) {
|
||||
const renderCount = this.indicesBuffer_.getSize();
|
||||
@@ -360,7 +362,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
||||
const layerState = frameState.layerStatesArray[frameState.layerIndex];
|
||||
const opacity = layerState.opacity;
|
||||
if (opacity !== parseFloat(canvas.style.opacity)) {
|
||||
canvas.style.opacity = opacity;
|
||||
canvas.style.opacity = String(opacity);
|
||||
}
|
||||
|
||||
if (this.hitDetectionEnabled_) {
|
||||
@@ -372,7 +374,9 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Determine whether render should be called.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {boolean} Layer is ready to be rendered.
|
||||
*/
|
||||
prepareFrame(frameState) {
|
||||
const layer = this.getLayer();
|
||||
@@ -511,7 +515,13 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {function(import("../../Feature.js").FeatureLike, import("../../layer/Layer.js").default): T} callback Feature callback.
|
||||
* @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
|
||||
* @return {T|void} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
|
||||
assert(this.hitDetectionEnabled_, 66);
|
||||
@@ -567,7 +577,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
this.worker_.terminate();
|
||||
|
||||
@@ -112,7 +112,7 @@ class ReprojImage extends ImageBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Clean up.
|
||||
*/
|
||||
disposeInternal() {
|
||||
if (this.state == ImageState.LOADING) {
|
||||
@@ -122,7 +122,7 @@ class ReprojImage extends ImageBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {HTMLCanvasElement} Image.
|
||||
*/
|
||||
getImage() {
|
||||
return this.canvas_;
|
||||
@@ -156,7 +156,7 @@ class ReprojImage extends ImageBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Load not yet loaded URI.
|
||||
*/
|
||||
load() {
|
||||
if (this.state == ImageState.IDLE) {
|
||||
|
||||
@@ -256,7 +256,7 @@ class ReprojTile extends Tile {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Load not yet loaded URI.
|
||||
*/
|
||||
load() {
|
||||
if (this.state == TileState.IDLE) {
|
||||
|
||||
@@ -91,7 +91,9 @@ class Cluster extends VectorSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
* Remove all features from the source.
|
||||
* @param {boolean=} opt_fast Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#removefeature} events.
|
||||
* @api
|
||||
*/
|
||||
clear(opt_fast) {
|
||||
this.features.length = 0;
|
||||
@@ -117,7 +119,9 @@ class Cluster extends VectorSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
*/
|
||||
loadFeatures(extent, resolution, projection) {
|
||||
this.source.loadFeatures(extent, resolution, projection);
|
||||
@@ -157,7 +161,6 @@ class Cluster extends VectorSource {
|
||||
|
||||
/**
|
||||
* Handle the source changing.
|
||||
* @override
|
||||
*/
|
||||
refresh() {
|
||||
this.clear();
|
||||
|
||||
@@ -288,7 +288,7 @@ class IIIF extends TileImage {
|
||||
});
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @type {number}
|
||||
*/
|
||||
this.zDirection = options.zDirection;
|
||||
|
||||
|
||||
@@ -120,7 +120,6 @@ class ImageSource extends Source {
|
||||
|
||||
/**
|
||||
* @return {Array<number>} Resolutions.
|
||||
* @override
|
||||
*/
|
||||
getResolutions() {
|
||||
return this.resolutions_;
|
||||
|
||||
@@ -134,7 +134,11 @@ class ImageArcGISRest extends ImageSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {import("../Image.js").default} Single image.
|
||||
*/
|
||||
getImageInternal(extent, resolution, pixelRatio, projection) {
|
||||
|
||||
|
||||
@@ -90,8 +90,12 @@ class ImageCanvasSource extends ImageSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {import("../ImageCanvas.js").default} Single image.
|
||||
*/
|
||||
getImageInternal(extent, resolution, pixelRatio, projection) {
|
||||
resolution = this.findNearestResolution(resolution);
|
||||
|
||||
|
||||
@@ -132,7 +132,11 @@ class ImageMapGuide extends ImageSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {import("../Image.js").default} Single image.
|
||||
*/
|
||||
getImageInternal(extent, resolution, pixelRatio, projection) {
|
||||
resolution = this.findNearestResolution(resolution);
|
||||
|
||||
@@ -86,7 +86,11 @@ class Static extends ImageSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {import("../Image.js").default} Single image.
|
||||
*/
|
||||
getImageInternal(extent, resolution, pixelRatio, projection) {
|
||||
if (intersects(extent, this.image_.getExtent())) {
|
||||
@@ -105,7 +109,7 @@ class Static extends ImageSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../events/Event.js").default} evt Event.
|
||||
*/
|
||||
handleImageChange(evt) {
|
||||
if (this.image_.getState() == ImageState.LOADED) {
|
||||
|
||||
@@ -248,7 +248,11 @@ class ImageWMS extends ImageSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {import("../Image.js").default} Single image.
|
||||
*/
|
||||
getImageInternal(extent, resolution, pixelRatio, projection) {
|
||||
|
||||
|
||||
@@ -315,7 +315,11 @@ class RasterSource extends ImageSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {import("../ImageCanvas.js").default} Single image.
|
||||
*/
|
||||
getImage(extent, resolution, pixelRatio, projection) {
|
||||
if (!this.allSourcesReady_()) {
|
||||
@@ -409,7 +413,7 @@ class RasterSource extends ImageSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
* @return {null} not implemented
|
||||
*/
|
||||
getImageInternal() {
|
||||
return null; // not implemented
|
||||
|
||||
@@ -212,7 +212,7 @@ class TileSource extends Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {Array<number>} Resolutions.
|
||||
*/
|
||||
getResolutions() {
|
||||
return this.tileGrid.getResolutions();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user