VectorSource#getFeaturesInExtent projection renamed to opt_projection and amended jsdoc #13690

This commit is contained in:
Tomas Burleigh
2022-05-24 09:46:07 +12:00
parent 78274befb8
commit 68e604e3be

View File

@@ -736,19 +736,21 @@ class VectorSource extends Source {
* features. * features.
* *
* @param {import("../extent.js").Extent} extent Extent. * @param {import("../extent.js").Extent} extent Extent.
* @param {import("../proj/Projection.js").default} [projection] Projection. * @param {import("../proj/Projection.js").default} [opt_projection] Include features
* where `extent` exceeds the x-axis bounds of `projection` and wraps around the world.
* @return {Array<import("../Feature.js").default<Geometry>>} Features. * @return {Array<import("../Feature.js").default<Geometry>>} Features.
* @api * @api
*/ */
getFeaturesInExtent(extent, projection) { getFeaturesInExtent(extent, opt_projection) {
if (this.featuresRtree_) { if (this.featuresRtree_) {
const multiWorld = projection && projection.canWrapX() && this.getWrapX(); const multiWorld =
opt_projection && opt_projection.canWrapX() && this.getWrapX();
if (!multiWorld) { if (!multiWorld) {
return this.featuresRtree_.getInExtent(extent); return this.featuresRtree_.getInExtent(extent);
} }
const extents = wrapAndSliceX(extent, projection); const extents = wrapAndSliceX(extent, opt_projection);
return [].concat( return [].concat(
...extents.map((anExtent) => this.featuresRtree_.getInExtent(anExtent)) ...extents.map((anExtent) => this.featuresRtree_.getInExtent(anExtent))