Merge pull request #6666 from fredj/cleanup

Use the optional extent in ol.structs.RBush#getExtent
This commit is contained in:
Frédéric Junod
2017-04-05 09:53:12 +02:00
committed by GitHub
2 changed files with 5 additions and 3 deletions

View File

@@ -610,11 +610,13 @@ 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. If provided, no new extent
* will be created. Instead, that extent's coordinates will be overwritten.
* @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);
};

View File

@@ -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);
};