diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js
index 6159469584..90ed5b3208 100644
--- a/src/ol/interaction/Modify.js
+++ b/src/ol/interaction/Modify.js
@@ -21,7 +21,7 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
import _ol_layer_Vector_ from '../layer/Vector.js';
import _ol_source_Vector_ from '../source/Vector.js';
import _ol_source_VectorEventType_ from '../source/VectorEventType.js';
-import _ol_structs_RBush_ from '../structs/RBush.js';
+import RBush from '../structs/RBush.js';
import _ol_style_Style_ from '../style/Style.js';
/**
@@ -123,7 +123,7 @@ var _ol_interaction_Modify_ = function(options) {
* @type {ol.structs.RBush.
}
* @private
*/
- this.rBush_ = new _ol_structs_RBush_();
+ this.rBush_ = new RBush();
/**
* @type {number}
diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js
index d96b8dd41b..d099e62fcd 100644
--- a/src/ol/interaction/Snap.js
+++ b/src/ol/interaction/Snap.js
@@ -15,7 +15,7 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
import _ol_obj_ from '../obj.js';
import _ol_source_Vector_ from '../source/Vector.js';
import _ol_source_VectorEventType_ from '../source/VectorEventType.js';
-import _ol_structs_RBush_ from '../structs/RBush.js';
+import RBush from '../structs/RBush.js';
/**
* @classdesc
@@ -128,7 +128,7 @@ var _ol_interaction_Snap_ = function(opt_options) {
* @type {ol.structs.RBush.}
* @private
*/
- this.rBush_ = new _ol_structs_RBush_();
+ this.rBush_ = new RBush();
/**
diff --git a/src/ol/render/webgl/PolygonReplay.js b/src/ol/render/webgl/PolygonReplay.js
index 4137cf5778..0b18ee0e1f 100644
--- a/src/ol/render/webgl/PolygonReplay.js
+++ b/src/ol/render/webgl/PolygonReplay.js
@@ -16,7 +16,7 @@ import _ol_render_webgl_Replay_ from '../webgl/Replay.js';
import _ol_render_webgl_ from '../webgl.js';
import _ol_style_Stroke_ from '../../style/Stroke.js';
import _ol_structs_LinkedList_ from '../../structs/LinkedList.js';
-import _ol_structs_RBush_ from '../../structs/RBush.js';
+import RBush from '../../structs/RBush.js';
import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js';
@@ -77,7 +77,7 @@ _ol_render_webgl_PolygonReplay_.prototype.drawCoordinates_ = function(
flatCoordinates, holeFlatCoordinates, stride) {
// Triangulate the polygon
var outerRing = new _ol_structs_LinkedList_();
- var rtree = new _ol_structs_RBush_();
+ var rtree = new RBush();
// Initialize the outer ring
this.processFlatCoordinates_(flatCoordinates, stride, outerRing, rtree, true);
var maxCoords = this.getMaxCoords_(outerRing);
@@ -90,7 +90,7 @@ _ol_render_webgl_PolygonReplay_.prototype.drawCoordinates_ = function(
var holeList = {
list: new _ol_structs_LinkedList_(),
maxCoords: undefined,
- rtree: new _ol_structs_RBush_()
+ rtree: new RBush()
};
holeLists.push(holeList);
this.processFlatCoordinates_(holeFlatCoordinates[i],
@@ -554,7 +554,7 @@ _ol_render_webgl_PolygonReplay_.prototype.splitPolygon_ = function(list, rtree)
s0.p1, s1.p0, s1.p1);
var p = this.createPoint_(intersection[0], intersection[1], n);
var newPolygon = new _ol_structs_LinkedList_();
- var newRtree = new _ol_structs_RBush_();
+ var newRtree = new RBush();
this.insertItem_(p, s0.p1, newPolygon, newRtree);
s0.p1 = p;
rtree.update([Math.min(s0.p0.x, p.x), Math.min(s0.p0.y, p.y),
diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js
index 478cbfb999..6d330303af 100644
--- a/src/ol/source/Vector.js
+++ b/src/ol/source/Vector.js
@@ -19,7 +19,7 @@ import _ol_obj_ from '../obj.js';
import _ol_source_Source_ from '../source/Source.js';
import _ol_source_State_ from '../source/State.js';
import _ol_source_VectorEventType_ from '../source/VectorEventType.js';
-import _ol_structs_RBush_ from '../structs/RBush.js';
+import RBush from '../structs/RBush.js';
/**
* @classdesc
@@ -90,13 +90,13 @@ var _ol_source_Vector_ = function(opt_options) {
* @private
* @type {ol.structs.RBush.}
*/
- this.featuresRtree_ = useSpatialIndex ? new _ol_structs_RBush_() : null;
+ this.featuresRtree_ = useSpatialIndex ? new RBush() : null;
/**
* @private
* @type {ol.structs.RBush.<{extent: ol.Extent}>}
*/
- this.loadedExtentsRtree_ = new _ol_structs_RBush_();
+ this.loadedExtentsRtree_ = new RBush();
/**
* @private
diff --git a/src/ol/structs/RBush.js b/src/ol/structs/RBush.js
index d091f4e9f9..e8c70015d4 100644
--- a/src/ol/structs/RBush.js
+++ b/src/ol/structs/RBush.js
@@ -15,7 +15,7 @@ import _ol_obj_ from '../obj.js';
* @struct
* @template T
*/
-var _ol_structs_RBush_ = function(opt_maxEntries) {
+var RBush = function(opt_maxEntries) {
/**
* @private
@@ -38,7 +38,7 @@ var _ol_structs_RBush_ = function(opt_maxEntries) {
* @param {ol.Extent} extent Extent.
* @param {T} value Value.
*/
-_ol_structs_RBush_.prototype.insert = function(extent, value) {
+RBush.prototype.insert = function(extent, value) {
/** @type {ol.RBushEntry} */
var item = {
minX: extent[0],
@@ -58,7 +58,7 @@ _ol_structs_RBush_.prototype.insert = function(extent, value) {
* @param {Array.} extents Extents.
* @param {Array.} values Values.
*/
-_ol_structs_RBush_.prototype.load = function(extents, values) {
+RBush.prototype.load = function(extents, values) {
var items = new Array(values.length);
for (var i = 0, l = values.length; i < l; i++) {
var extent = extents[i];
@@ -84,7 +84,7 @@ _ol_structs_RBush_.prototype.load = function(extents, values) {
* @param {T} value Value.
* @return {boolean} Removed.
*/
-_ol_structs_RBush_.prototype.remove = function(value) {
+RBush.prototype.remove = function(value) {
var uid = getUid(value);
// get the object in which the value was wrapped when adding to the
@@ -100,7 +100,7 @@ _ol_structs_RBush_.prototype.remove = function(value) {
* @param {ol.Extent} extent Extent.
* @param {T} value Value.
*/
-_ol_structs_RBush_.prototype.update = function(extent, value) {
+RBush.prototype.update = function(extent, value) {
var item = this.items_[getUid(value)];
var bbox = [item.minX, item.minY, item.maxX, item.maxY];
if (!equals(bbox, extent)) {
@@ -114,7 +114,7 @@ _ol_structs_RBush_.prototype.update = function(extent, value) {
* Return all values in the RBush.
* @return {Array.} All.
*/
-_ol_structs_RBush_.prototype.getAll = function() {
+RBush.prototype.getAll = function() {
var items = this.rbush_.all();
return items.map(function(item) {
return item.value;
@@ -127,7 +127,7 @@ _ol_structs_RBush_.prototype.getAll = function() {
* @param {ol.Extent} extent Extent.
* @return {Array.} All in extent.
*/
-_ol_structs_RBush_.prototype.getInExtent = function(extent) {
+RBush.prototype.getInExtent = function(extent) {
/** @type {ol.RBushEntry} */
var bbox = {
minX: extent[0],
@@ -151,7 +151,7 @@ _ol_structs_RBush_.prototype.getInExtent = function(extent) {
* @return {*} Callback return value.
* @template S
*/
-_ol_structs_RBush_.prototype.forEach = function(callback, opt_this) {
+RBush.prototype.forEach = function(callback, opt_this) {
return this.forEach_(this.getAll(), callback, opt_this);
};
@@ -164,7 +164,7 @@ _ol_structs_RBush_.prototype.forEach = function(callback, opt_this) {
* @return {*} Callback return value.
* @template S
*/
-_ol_structs_RBush_.prototype.forEachInExtent = function(extent, callback, opt_this) {
+RBush.prototype.forEachInExtent = function(extent, callback, opt_this) {
return this.forEach_(this.getInExtent(extent), callback, opt_this);
};
@@ -177,7 +177,7 @@ _ol_structs_RBush_.prototype.forEachInExtent = function(extent, callback, opt_th
* @return {*} Callback return value.
* @template S
*/
-_ol_structs_RBush_.prototype.forEach_ = function(values, callback, opt_this) {
+RBush.prototype.forEach_ = function(values, callback, opt_this) {
var result;
for (var i = 0, l = values.length; i < l; i++) {
result = callback.call(opt_this, values[i]);
@@ -192,7 +192,7 @@ _ol_structs_RBush_.prototype.forEach_ = function(values, callback, opt_this) {
/**
* @return {boolean} Is empty.
*/
-_ol_structs_RBush_.prototype.isEmpty = function() {
+RBush.prototype.isEmpty = function() {
return _ol_obj_.isEmpty(this.items_);
};
@@ -200,7 +200,7 @@ _ol_structs_RBush_.prototype.isEmpty = function() {
/**
* Remove all values from the RBush.
*/
-_ol_structs_RBush_.prototype.clear = function() {
+RBush.prototype.clear = function() {
this.rbush_.clear();
this.items_ = {};
};
@@ -210,7 +210,7 @@ _ol_structs_RBush_.prototype.clear = function() {
* @param {ol.Extent=} opt_extent Extent.
* @return {ol.Extent} Extent.
*/
-_ol_structs_RBush_.prototype.getExtent = function(opt_extent) {
+RBush.prototype.getExtent = function(opt_extent) {
// FIXME add getExtent() to rbush
var data = this.rbush_.data;
return createOrUpdate(data.minX, data.minY, data.maxX, data.maxY, opt_extent);
@@ -220,10 +220,10 @@ _ol_structs_RBush_.prototype.getExtent = function(opt_extent) {
/**
* @param {ol.structs.RBush} rbush R-Tree.
*/
-_ol_structs_RBush_.prototype.concat = function(rbush) {
+RBush.prototype.concat = function(rbush) {
this.rbush_.load(rbush.rbush_.all());
for (var i in rbush.items_) {
this.items_[i | 0] = rbush.items_[i | 0];
}
};
-export default _ol_structs_RBush_;
+export default RBush;
diff --git a/test/spec/ol/render/webgl/polygonreplay.test.js b/test/spec/ol/render/webgl/polygonreplay.test.js
index 150c09dd98..585da26d0e 100644
--- a/test/spec/ol/render/webgl/polygonreplay.test.js
+++ b/test/spec/ol/render/webgl/polygonreplay.test.js
@@ -6,7 +6,7 @@ import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/
import _ol_render_webgl_polygonreplay_defaultshader_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader.js';
import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader/Locations.js';
import _ol_structs_LinkedList_ from '../../../../../src/ol/structs/LinkedList.js';
-import _ol_structs_RBush_ from '../../../../../src/ol/structs/RBush.js';
+import RBush from '../../../../../src/ol/structs/RBush.js';
import _ol_style_Fill_ from '../../../../../src/ol/style/Fill.js';
import _ol_style_Stroke_ from '../../../../../src/ol/style/Stroke.js';
@@ -84,7 +84,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
var list, rtree;
beforeEach(function() {
list = new _ol_structs_LinkedList_();
- rtree = new _ol_structs_RBush_();
+ rtree = new RBush();
});
describe('#createPoint_', function() {
diff --git a/test/spec/ol/structs/rbush.test.js b/test/spec/ol/structs/rbush.test.js
index 5da83b290e..8c1b2eb82f 100644
--- a/test/spec/ol/structs/rbush.test.js
+++ b/test/spec/ol/structs/rbush.test.js
@@ -1,11 +1,11 @@
-import _ol_structs_RBush_ from '../../../../src/ol/structs/RBush.js';
+import RBush from '../../../../src/ol/structs/RBush.js';
describe('ol.structs.RBush', function() {
var rBush;
beforeEach(function() {
- rBush = new _ol_structs_RBush_();
+ rBush = new RBush();
});
describe('when empty', function() {
@@ -316,7 +316,7 @@ describe('ol.structs.RBush', function() {
it('concatenates two RBush objects', function() {
var obj1 = {};
var obj2 = {};
- var rBush2 = new _ol_structs_RBush_();
+ var rBush2 = new RBush();
rBush.insert([0, 0, 1, 1], obj1);
rBush2.insert([0, 0, 2, 2], obj2);
rBush.concat(rBush2);
@@ -327,7 +327,7 @@ describe('ol.structs.RBush', function() {
it('preserves the concatenated object\'s references', function() {
var obj1 = {};
var obj2 = {};
- var rBush2 = new _ol_structs_RBush_();
+ var rBush2 = new RBush();
rBush.insert([0, 0, 1, 1], obj1);
rBush2.insert([0, 0, 2, 2], obj2);
rBush.concat(rBush2);