Merge pull request #9289 from sbrunner/vector-source-geom

Vector source geom
This commit is contained in:
Andreas Hocevar
2019-05-28 11:23:31 +02:00
committed by GitHub
9 changed files with 78 additions and 74 deletions

View File

@@ -5,6 +5,7 @@ import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
import {Circle as CircleStyle, Fill, Stroke, Style} from '../src/ol/style.js';
/** @type {VectorSource<import("../src/ol/geom/SimpleGeometry.js").default>} */
const source = new VectorSource({
url: 'data/geojson/switzerland.geojson',
format: new GeoJSON()
@@ -51,21 +52,21 @@ const zoomtoswitzerland =
document.getElementById('zoomtoswitzerland');
zoomtoswitzerland.addEventListener('click', function() {
const feature = source.getFeatures()[0];
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
const polygon = feature.getGeometry();
view.fit(polygon, {padding: [170, 50, 30, 150]});
}, false);
const zoomtolausanne = document.getElementById('zoomtolausanne');
zoomtolausanne.addEventListener('click', function() {
const feature = source.getFeatures()[1];
const point = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
const point = feature.getGeometry();
view.fit(point, {padding: [170, 50, 30, 150], minResolution: 50});
}, false);
const centerlausanne = document.getElementById('centerlausanne');
centerlausanne.addEventListener('click', function() {
const feature = source.getFeatures()[1];
const point = /** @type {import("../src/ol/geom/Point.js").default} */ (feature.getGeometry());
const point = feature.getGeometry();
const size = map.getSize();
view.centerOn(point.getCoordinates(), size, [570, 500]);
}, false);

View File

@@ -67,10 +67,10 @@ const routeFeature = new Feature({
type: 'route',
geometry: route
});
const geoMarker = new Feature({
const geoMarker = /** @type Feature<import("../src/ol/geom/Point").default> */(new Feature({
type: 'geoMarker',
geometry: new Point(routeCoords[0])
});
}));
const startMarker = new Feature({
type: 'icon',
geometry: new Point(routeCoords[0])
@@ -191,7 +191,7 @@ function stopAnimation(ended) {
// if animation cancelled set the marker at the beginning
const coord = ended ? routeCoords[routeLength - 1] : routeCoords[0];
const geometry = /** @type {import("../src/ol/geom/Point").default} */ (geoMarker.getGeometry());
const geometry = geoMarker.getGeometry();
geometry.setCoordinates(coord);
//remove listener
vectorLayer.un('postrender', moveFeature);

View File

@@ -57,10 +57,11 @@ import BaseObject, {getChangeEventType} from './Object.js';
* ```
*
* @api
* @template {import("./geom/Geometry.js").default} Geometry
*/
class Feature extends BaseObject {
/**
* @param {import("./geom/Geometry.js").default|Object<string, *>=} opt_geometryOrProperties
* @param {Geometry|Object<string, *>=} opt_geometryOrProperties
* You may pass a Geometry object directly, or an object literal containing
* properties. If you pass an object literal, you may include a Geometry
* associated with a `geometry` key.
@@ -106,7 +107,7 @@ class Feature extends BaseObject {
if (opt_geometryOrProperties) {
if (typeof /** @type {?} */ (opt_geometryOrProperties).getSimplifiedGeometry === 'function') {
const geometry = /** @type {import("./geom/Geometry.js").default} */ (opt_geometryOrProperties);
const geometry = /** @type {Geometry} */ (opt_geometryOrProperties);
this.setGeometry(geometry);
} else {
/** @type {Object<string, *>} */
@@ -140,13 +141,13 @@ class Feature extends BaseObject {
* Get the feature's default geometry. A feature may have any number of named
* geometries. The "default" geometry (the one that is rendered by default) is
* set when calling {@link module:ol/Feature~Feature#setGeometry}.
* @return {import("./geom/Geometry.js").default|undefined} The default geometry for the feature.
* @return {Geometry|undefined} The default geometry for the feature.
* @api
* @observable
*/
getGeometry() {
return (
/** @type {import("./geom/Geometry.js").default|undefined} */ (this.get(this.geometryName_))
/** @type {Geometry|undefined} */ (this.get(this.geometryName_))
);
}
@@ -218,7 +219,7 @@ class Feature extends BaseObject {
/**
* Set the default geometry for the feature. This will update the property
* with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.
* @param {import("./geom/Geometry.js").default|undefined} geometry The new geometry.
* @param {Geometry|undefined} geometry The new geometry.
* @api
* @observable
*/

View File

@@ -373,7 +373,7 @@ class Draw extends PointerInteraction {
/**
* Sketch point.
* @type {Feature}
* @type {Feature<Point>}
* @private
*/
this.sketchPoint_ = null;
@@ -387,7 +387,7 @@ class Draw extends PointerInteraction {
/**
* Sketch line. Used when drawing polygon.
* @type {Feature}
* @type {Feature<LineString>}
* @private
*/
this.sketchLine_ = null;
@@ -669,7 +669,7 @@ class Draw extends PointerInteraction {
this.sketchPoint_ = new Feature(new Point(coordinates));
this.updateSketchFeatures_();
} else {
const sketchPointGeom = /** @type {Point} */ (this.sketchPoint_.getGeometry());
const sketchPointGeom = this.sketchPoint_.getGeometry();
sketchPointGeom.setCoordinates(coordinates);
}
}
@@ -711,7 +711,7 @@ class Draw extends PointerInteraction {
*/
modifyDrawing_(event) {
let coordinate = event.coordinate;
const geometry = /** @type {import("../geom/SimpleGeometry.js").default} */ (this.sketchFeature_.getGeometry());
const geometry = this.sketchFeature_.getGeometry();
let coordinates, last;
if (this.mode_ === Mode.POINT) {
last = this.sketchCoords_;
@@ -730,7 +730,7 @@ class Draw extends PointerInteraction {
last[1] = coordinate[1];
this.geometryFunction_(/** @type {!LineCoordType} */ (this.sketchCoords_), geometry);
if (this.sketchPoint_) {
const sketchPointGeom = /** @type {Point} */ (this.sketchPoint_.getGeometry());
const sketchPointGeom = this.sketchPoint_.getGeometry();
sketchPointGeom.setCoordinates(coordinate);
}
/** @type {LineString} */
@@ -740,8 +740,8 @@ class Draw extends PointerInteraction {
if (!this.sketchLine_) {
this.sketchLine_ = new Feature();
}
const ring = /** @type {Polygon} */ (geometry).getLinearRing(0);
sketchLineGeom = /** @type {LineString} */ (this.sketchLine_.getGeometry());
const ring = geometry.getLinearRing(0);
sketchLineGeom = this.sketchLine_.getGeometry();
if (!sketchLineGeom) {
sketchLineGeom = new LineString(ring.getFlatCoordinates(), ring.getLayout());
this.sketchLine_.setGeometry(sketchLineGeom);
@@ -751,7 +751,7 @@ class Draw extends PointerInteraction {
sketchLineGeom.changed();
}
} else if (this.sketchLineCoords_) {
sketchLineGeom = /** @type {LineString} */ (this.sketchLine_.getGeometry());
sketchLineGeom = this.sketchLine_.getGeometry();
sketchLineGeom.setCoordinates(this.sketchLineCoords_);
}
this.updateSketchFeatures_();
@@ -764,7 +764,7 @@ class Draw extends PointerInteraction {
*/
addToDrawing_(event) {
const coordinate = event.coordinate;
const geometry = /** @type {import("../geom/SimpleGeometry.js").default} */ (this.sketchFeature_.getGeometry());
const geometry = this.sketchFeature_.getGeometry();
let done;
let coordinates;
if (this.mode_ === Mode.LINE_STRING) {
@@ -808,7 +808,7 @@ class Draw extends PointerInteraction {
if (!this.sketchFeature_) {
return;
}
const geometry = /** @type {import("../geom/SimpleGeometry.js").default} */ (this.sketchFeature_.getGeometry());
const geometry = this.sketchFeature_.getGeometry();
let coordinates;
/** @type {LineString} */
let sketchLineGeom;
@@ -822,7 +822,7 @@ class Draw extends PointerInteraction {
} else if (this.mode_ === Mode.POLYGON) {
coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];
coordinates.splice(-2, 1);
sketchLineGeom = /** @type {LineString} */ (this.sketchLine_.getGeometry());
sketchLineGeom = this.sketchLine_.getGeometry();
sketchLineGeom.setCoordinates(coordinates);
this.geometryFunction_(this.sketchCoords_, geometry);
}
@@ -846,7 +846,7 @@ class Draw extends PointerInteraction {
return;
}
let coordinates = this.sketchCoords_;
const geometry = /** @type {import("../geom/SimpleGeometry.js").default} */ (sketchFeature.getGeometry());
const geometry = sketchFeature.getGeometry();
if (this.mode_ === Mode.LINE_STRING) {
// remove the redundant last point
coordinates.pop();
@@ -900,12 +900,12 @@ class Draw extends PointerInteraction {
* Extend an existing geometry by adding additional points. This only works
* on features with `LineString` geometries, where the interaction will
* extend lines by adding points to the end of the coordinates array.
* @param {!Feature} feature Feature to be extended.
* @param {!Feature<LineString>} feature Feature to be extended.
* @api
*/
extend(feature) {
const geometry = feature.getGeometry();
const lineString = /** @type {LineString} */ (geometry);
const lineString = geometry;
this.sketchFeature_ = feature;
this.sketchCoords_ = lineString.getCoordinates();
const last = this.sketchCoords_[this.sketchCoords_.length - 1];

View File

@@ -126,7 +126,7 @@ class Extent extends PointerInteraction {
/**
* Feature for displaying the visible pointer
* @type {Feature}
* @type {Feature<Point>}
* @private
*/
this.vertexFeature_ = null;
@@ -265,7 +265,7 @@ class Extent extends PointerInteraction {
this.vertexFeature_ = vertexFeature;
this.vertexOverlay_.getSource().addFeature(vertexFeature);
} else {
const geometry = /** @type {Point} */ (vertexFeature.getGeometry());
const geometry = vertexFeature.getGeometry();
geometry.setCoordinates(vertex);
}
return vertexFeature;

View File

@@ -660,7 +660,7 @@ class Modify extends PointerInteraction {
this.vertexFeature_ = vertexFeature;
this.overlay_.getSource().addFeature(vertexFeature);
} else {
const geometry = /** @type {Point} */ (vertexFeature.getGeometry());
const geometry = vertexFeature.getGeometry();
geometry.setCoordinates(coordinates);
}
return vertexFeature;
@@ -785,7 +785,7 @@ class Modify extends PointerInteraction {
const vertexFeature = this.vertexFeature_;
if (vertexFeature) {
const insertVertices = [];
const geometry = /** @type {Point} */ (vertexFeature.getGeometry());
const geometry = vertexFeature.getGeometry();
const vertex = geometry.getCoordinates();
const vertexExtent = boundingExtent([vertex]);
const segmentDataMatches = this.rBush_.getInExtent(vertexExtent);

View File

@@ -25,15 +25,15 @@ const VERTEX_SHADER = `
attribute vec2 a_offsets;
attribute float a_opacity;
attribute vec4 a_color;
uniform mat4 u_projectionMatrix;
uniform mat4 u_offsetScaleMatrix;
uniform mat4 u_offsetRotateMatrix;
varying vec2 v_texCoord;
varying float v_opacity;
varying vec4 v_color;
void main(void) {
mat4 offsetMatrix = u_offsetScaleMatrix;
if (a_rotateWithView == 1.0) {
@@ -48,13 +48,13 @@ const VERTEX_SHADER = `
const FRAGMENT_SHADER = `
precision mediump float;
uniform sampler2D u_texture;
varying vec2 v_texCoord;
varying float v_opacity;
varying vec4 v_color;
void main(void) {
if (v_opacity == 0.0) {
discard;
@@ -222,7 +222,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
return 1;
};
this.coordCallback_ = options.coordCallback || function(feature, index) {
const geom = /** @type {import("../../geom/Point").default} */ (feature.getGeometry());
const geom = feature.getGeometry();
return geom.getCoordinates()[index];
};
this.opacityCallback_ = options.opacityCallback || function() {

View File

@@ -76,7 +76,7 @@ class Cluster extends VectorSource {
* @protected
*/
this.geometryFunction = options.geometryFunction || function(feature) {
const geometry = /** @type {Point} */ (feature.getGeometry());
const geometry = feature.getGeometry();
assert(geometry.getType() == GeometryType.POINT,
10); // The default `geometryFunction` can only handle `Point` geometries
return geometry;

View File

@@ -35,12 +35,13 @@ import RBush from '../structs/RBush.js';
* @classdesc
* Events emitted by {@link module:ol/source/Vector} instances are instances of this
* type.
* @template {import("../geom/Geometry.js").default} Geometry
*/
export class VectorSourceEvent extends Event {
/**
* @param {string} type Type.
* @param {import("../Feature.js").default=} opt_feature Feature.
* @param {import("../Feature.js").default<Geometry>=} opt_feature Feature.
*/
constructor(type, opt_feature) {
@@ -48,7 +49,7 @@ export class VectorSourceEvent extends Event {
/**
* The feature being added or removed.
* @type {import("../Feature.js").default|undefined}
* @type {import("../Feature.js").default<Geometry>|undefined}
* @api
*/
this.feature = opt_feature;
@@ -154,8 +155,9 @@ export class VectorSourceEvent extends Event {
* by this source are suitable for editing. See {@link module:ol/source/VectorTile~VectorTile} for
* vector data that is optimized for rendering.
*
* @fires VectorSourceEvent
* @fires VectorSourceEvent<Geometry>
* @api
* @template {import("../geom/Geometry.js").default} Geometry
*/
class VectorSource extends Source {
/**
@@ -215,7 +217,7 @@ class VectorSource extends Source {
/**
* @private
* @type {RBush<import("../Feature.js").default>}
* @type {RBush<import("../Feature.js").default<Geometry>>}
*/
this.featuresRtree_ = useSpatialIndex ? new RBush() : null;
@@ -227,21 +229,21 @@ class VectorSource extends Source {
/**
* @private
* @type {!Object<string, import("../Feature.js").default>}
* @type {!Object<string, import("../Feature.js").default<Geometry>>}
*/
this.nullGeometryFeatures_ = {};
/**
* A lookup of features by id (the return from feature.getId()).
* @private
* @type {!Object<string, import("../Feature.js").default>}
* @type {!Object<string, import("../Feature.js").default<Geometry>>}
*/
this.idIndex_ = {};
/**
* A lookup of features without id (keyed by getUid(feature)).
* @private
* @type {!Object<string, import("../Feature.js").default>}
* @type {!Object<string, import("../Feature.js").default<Geometry>>}
*/
this.undefIdIndex_ = {};
@@ -253,7 +255,7 @@ class VectorSource extends Source {
/**
* @private
* @type {Collection<import("../Feature.js").default>}
* @type {Collection<import("../Feature.js").default<Geometry>>}
*/
this.featuresCollection_ = null;
@@ -285,7 +287,7 @@ class VectorSource extends Source {
* Note: this also applies if an {@link module:ol/Collection} is used for features,
* meaning that if a feature with a duplicate id is added in the collection, it will
* be removed from it right away.
* @param {import("../Feature.js").default} feature Feature to add.
* @param {import("../Feature.js").default<Geometry>} feature Feature to add.
* @api
*/
addFeature(feature) {
@@ -296,7 +298,7 @@ class VectorSource extends Source {
/**
* Add a feature without firing a `change` event.
* @param {import("../Feature.js").default} feature Feature.
* @param {import("../Feature.js").default<Geometry>} feature Feature.
* @protected
*/
addFeatureInternal(feature) {
@@ -328,7 +330,7 @@ class VectorSource extends Source {
/**
* @param {string} featureKey Unique identifier for the feature.
* @param {import("../Feature.js").default} feature The feature.
* @param {import("../Feature.js").default<Geometry>} feature The feature.
* @private
*/
setupChangeEvents_(featureKey, feature) {
@@ -343,7 +345,7 @@ class VectorSource extends Source {
/**
* @param {string} featureKey Unique identifier for the feature.
* @param {import("../Feature.js").default} feature The feature.
* @param {import("../Feature.js").default<Geometry>} feature The feature.
* @return {boolean} The feature is "valid", in the sense that it is also a
* candidate for insertion into the Rtree.
* @private
@@ -368,7 +370,7 @@ class VectorSource extends Source {
/**
* Add a batch of features to the source.
* @param {Array<import("../Feature.js").default>} features Features to add.
* @param {Array<import("../Feature.js").default<Geometry>>} features Features to add.
* @api
*/
addFeatures(features) {
@@ -379,7 +381,7 @@ class VectorSource extends Source {
/**
* Add features without firing a `change` event.
* @param {Array<import("../Feature.js").default>} features Features.
* @param {Array<import("../Feature.js").default<Geometry>>} features Features.
* @protected
*/
addFeaturesInternal(features) {
@@ -420,14 +422,14 @@ class VectorSource extends Source {
/**
* @param {!Collection<import("../Feature.js").default>} collection Collection.
* @param {!Collection<import("../Feature.js").default<Geometry>>} collection Collection.
* @private
*/
bindFeaturesCollection_(collection) {
let modifyingCollection = false;
listen(this, VectorEventType.ADDFEATURE,
/**
* @param {VectorSourceEvent} evt The vector source event
* @param {VectorSourceEvent<Geometry>} evt The vector source event
*/
function(evt) {
if (!modifyingCollection) {
@@ -438,7 +440,7 @@ class VectorSource extends Source {
});
listen(this, VectorEventType.REMOVEFEATURE,
/**
* @param {VectorSourceEvent} evt The vector source event
* @param {VectorSourceEvent<Geometry>} evt The vector source event
*/
function(evt) {
if (!modifyingCollection) {
@@ -454,7 +456,7 @@ class VectorSource extends Source {
function(evt) {
if (!modifyingCollection) {
modifyingCollection = true;
this.addFeature(/** @type {import("../Feature.js").default} */ (evt.element));
this.addFeature(/** @type {import("../Feature.js").default<Geometry>} */ (evt.element));
modifyingCollection = false;
}
}, this);
@@ -465,7 +467,7 @@ class VectorSource extends Source {
function(evt) {
if (!modifyingCollection) {
modifyingCollection = true;
this.removeFeature(/** @type {import("../Feature.js").default} */ (evt.element));
this.removeFeature(/** @type {import("../Feature.js").default<Geometry>} */ (evt.element));
modifyingCollection = false;
}
}, this);
@@ -518,7 +520,7 @@ class VectorSource extends Source {
* stop and the function will return the same value.
* Note: this function only iterate through the feature that have a defined geometry.
*
* @param {function(import("../Feature.js").default): T} callback Called with each feature
* @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
* on the source. Return a truthy value to stop iteration.
* @return {T|undefined} The return value from the last call to the callback.
* @template T
@@ -540,7 +542,7 @@ class VectorSource extends Source {
* value.
*
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
* @param {function(import("../Feature.js").default): T} callback Called with each feature
* @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
* whose goemetry contains the provided coordinate.
* @return {T|undefined} The return value from the last call to the callback.
* @template T
@@ -571,7 +573,7 @@ class VectorSource extends Source {
* features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}.
*
* @param {import("../extent.js").Extent} extent Extent.
* @param {function(import("../Feature.js").default): T} callback Called with each feature
* @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
* whose bounding box intersects the provided extent.
* @return {T|undefined} The return value from the last call to the callback.
* @template T
@@ -595,7 +597,7 @@ class VectorSource extends Source {
* {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent()} method instead.
*
* @param {import("../extent.js").Extent} extent Extent.
* @param {function(import("../Feature.js").default): T} callback Called with each feature
* @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
* whose geometry intersects the provided extent.
* @return {T|undefined} The return value from the last call to the callback.
* @template T
@@ -604,7 +606,7 @@ class VectorSource extends Source {
forEachFeatureIntersectingExtent(extent, callback) {
return this.forEachFeatureInExtent(extent,
/**
* @param {import("../Feature.js").default} feature Feature.
* @param {import("../Feature.js").default<Geometry>} feature Feature.
* @return {T|undefined} The return value from the last call to the callback.
*/
function(feature) {
@@ -623,7 +625,7 @@ class VectorSource extends Source {
* Get the features collection associated with this source. Will be `null`
* unless the source was configured with `useSpatialIndex` set to `false`, or
* with an {@link module:ol/Collection} as `features`.
* @return {Collection<import("../Feature.js").default>} The collection of features.
* @return {Collection<import("../Feature.js").default<Geometry>>} The collection of features.
* @api
*/
getFeaturesCollection() {
@@ -633,7 +635,7 @@ class VectorSource extends Source {
/**
* Get all features on the source in random order.
* @return {Array<import("../Feature.js").default>} Features.
* @return {Array<import("../Feature.js").default<Geometry>>} Features.
* @api
*/
getFeatures() {
@@ -647,7 +649,7 @@ class VectorSource extends Source {
}
}
return (
/** @type {Array<import("../Feature.js").default>} */ (features)
/** @type {Array<import("../Feature.js").default<Geometry>>} */ (features)
);
}
@@ -655,7 +657,7 @@ class VectorSource extends Source {
/**
* Get all features whose geometry intersects the provided coordinate.
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
* @return {Array<import("../Feature.js").default>} Features.
* @return {Array<import("../Feature.js").default<Geometry>>} Features.
* @api
*/
getFeaturesAtCoordinate(coordinate) {
@@ -675,7 +677,7 @@ class VectorSource extends Source {
* This method is not available when the source is configured with
* `useSpatialIndex` set to `false`.
* @param {import("../extent.js").Extent} extent Extent.
* @return {Array<import("../Feature.js").default>} Features.
* @return {Array<import("../Feature.js").default<Geometry>>} Features.
* @api
*/
getFeaturesInExtent(extent) {
@@ -689,10 +691,10 @@ class VectorSource extends Source {
* This method is not available when the source is configured with
* `useSpatialIndex` set to `false`.
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
* @param {function(import("../Feature.js").default):boolean=} opt_filter Feature filter function.
* @param {function(import("../Feature.js").default<Geometry>):boolean=} opt_filter Feature filter function.
* The filter function will receive one argument, the {@link module:ol/Feature feature}
* and it should return a boolean value. By default, no filtering is made.
* @return {import("../Feature.js").default} Closest feature.
* @return {import("../Feature.js").default<Geometry>} Closest feature.
* @api
*/
getClosestFeatureToCoordinate(coordinate, opt_filter) {
@@ -712,7 +714,7 @@ class VectorSource extends Source {
const filter = opt_filter ? opt_filter : TRUE;
this.featuresRtree_.forEachInExtent(extent,
/**
* @param {import("../Feature.js").default} feature Feature.
* @param {import("../Feature.js").default<Geometry>} feature Feature.
*/
function(feature) {
if (filter(feature)) {
@@ -759,7 +761,7 @@ class VectorSource extends Source {
* `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.
*
* @param {string|number} id Feature identifier.
* @return {import("../Feature.js").default} The feature (or `null` if not found).
* @return {import("../Feature.js").default<Geometry>} The feature (or `null` if not found).
* @api
*/
getFeatureById(id) {
@@ -803,7 +805,7 @@ class VectorSource extends Source {
* @private
*/
handleFeatureChange_(event) {
const feature = /** @type {import("../Feature.js").default} */ (event.target);
const feature = /** @type {import("../Feature.js").default<Geometry>} */ (event.target);
const featureKey = getUid(feature);
const geometry = feature.getGeometry();
if (!geometry) {
@@ -851,7 +853,7 @@ class VectorSource extends Source {
/**
* Returns true if the feature is contained within the source.
* @param {import("../Feature.js").default} feature Feature.
* @param {import("../Feature.js").default<Geometry>} feature Feature.
* @return {boolean} Has feature.
* @api
*/
@@ -933,7 +935,7 @@ class VectorSource extends Source {
* Remove a single feature from the source. If you want to remove all features
* at once, use the {@link module:ol/source/Vector~VectorSource#clear #clear()} method
* instead.
* @param {import("../Feature.js").default} feature Feature to remove.
* @param {import("../Feature.js").default<Geometry>} feature Feature to remove.
* @api
*/
removeFeature(feature) {
@@ -952,7 +954,7 @@ class VectorSource extends Source {
/**
* Remove feature without firing a `change` event.
* @param {import("../Feature.js").default} feature Feature.
* @param {import("../Feature.js").default<Geometry>} feature Feature.
* @protected
*/
removeFeatureInternal(feature) {
@@ -973,7 +975,7 @@ class VectorSource extends Source {
/**
* Remove a feature from the id index. Called internally when the feature id
* may have changed.
* @param {import("../Feature.js").default} feature The feature.
* @param {import("../Feature.js").default<Geometry>} feature The feature.
* @return {boolean} Removed the feature from the index.
* @private
*/