getFeaturesInExtent(extent, projection) {
    if (this.featuresRtree_) {
      const multiWorld = projection && projection.canWrapX() && this.getWrapX();

      if (!multiWorld) {
        return this.featuresRtree_.getInExtent(extent);
      }

      const extents = wrapAndSliceX(extent, projection);

      return [].concat(
        ...extents.map((anExtent) => this.featuresRtree_.getInExtent(anExtent)),
      );
    }
    if (this.featuresCollection_) {
      return this.featuresCollection_.getArray().slice(0);
    }
    return [];
  }
Get all features whose bounding box intersects the provided extent.  Note that this returns an array of
all features intersecting the given extent in random order (so it may include
features whose geometries do not intersect the extent).

When `useSpatialIndex` is set to false, this method will return all
features.

@param {import("../extent.js").Extent} extent Extent.
@param {import("../proj/Projection.js").default} [projection] Include features
where `extent` exceeds the x-axis bounds of `projection` and wraps around the world.
@return {Array<FeatureType>} Features.
@api