From f7c392342e15ce0bb5025e385d83643f5cfe7121 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 4 Apr 2017 10:54:31 +0200 Subject: [PATCH 1/3] Use the optional extent in ol.structs.RBush#getExtent --- src/ol/structs/rbush.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ol/structs/rbush.js b/src/ol/structs/rbush.js index c49496e3a7..0828832452 100644 --- a/src/ol/structs/rbush.js +++ b/src/ol/structs/rbush.js @@ -213,5 +213,5 @@ ol.structs.RBush.prototype.clear = function() { ol.structs.RBush.prototype.getExtent = function(opt_extent) { // FIXME add getExtent() to rbush var data = this.rbush_.data; - return [data.minX, data.minY, data.maxX, data.maxY]; + return ol.extent.createOrUpdate(data.minX, data.minY, data.maxX, data.maxY, opt_extent); }; From 22ed575325287eba2796b1676471ea5216bbc876 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 4 Apr 2017 13:53:29 +0200 Subject: [PATCH 2/3] Add optional destination extent in ol.source.Vector#getExtent --- src/ol/source/vector.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ol/source/vector.js b/src/ol/source/vector.js index ee3c9ad205..78a0d5a338 100644 --- a/src/ol/source/vector.js +++ b/src/ol/source/vector.js @@ -610,11 +610,12 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate, * * This method is not available when the source is configured with * `useSpatialIndex` set to `false`. + * @param {ol.Extent=} opt_extent Destination extent. * @return {!ol.Extent} Extent. * @api */ -ol.source.Vector.prototype.getExtent = function() { - return this.featuresRtree_.getExtent(); +ol.source.Vector.prototype.getExtent = function(opt_extent) { + return this.featuresRtree_.getExtent(opt_extent); }; From c1a5a44dfcdfb918598b236e14c3789d2f15209b Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Wed, 5 Apr 2017 09:21:01 +0200 Subject: [PATCH 3/3] Improve documentation of opt_extent --- src/ol/source/vector.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ol/source/vector.js b/src/ol/source/vector.js index 78a0d5a338..e1e88b30cf 100644 --- a/src/ol/source/vector.js +++ b/src/ol/source/vector.js @@ -610,7 +610,8 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate, * * This method is not available when the source is configured with * `useSpatialIndex` set to `false`. - * @param {ol.Extent=} opt_extent Destination extent. + * @param {ol.Extent=} opt_extent Destination extent. If provided, no new extent + * will be created. Instead, that extent's coordinates will be overwritten. * @return {!ol.Extent} Extent. * @api */