Merge remote-tracking branch 'openlayers/master' into vector-api
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
<option value="Aerial">Aerial</option>
|
||||
<option value="AerialWithLabels" selected>Aerial with labels</option>
|
||||
<option value="Road">Road</option>
|
||||
<option value="collinsBart">Collins Bart</option>
|
||||
<option value="ordnanceSurvey">Ordnance Survey</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,13 +2,19 @@ goog.require('ol.Map');
|
||||
goog.require('ol.RendererHints');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.source.BingMaps');
|
||||
|
||||
|
||||
var styles = ['Road', 'Aerial', 'AerialWithLabels'];
|
||||
var styles = [
|
||||
'Road',
|
||||
'Aerial',
|
||||
'AerialWithLabels',
|
||||
'collinsBart',
|
||||
'ordnanceSurvey'
|
||||
];
|
||||
var layers = [];
|
||||
for (var i = 0; i < styles.length; ++i) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = styles.length; i < ii; ++i) {
|
||||
layers.push(new ol.layer.Tile({
|
||||
visible: false,
|
||||
preload: Infinity,
|
||||
@@ -23,14 +29,15 @@ var map = new ol.Map({
|
||||
renderers: ol.RendererHints.createFromQueryData(),
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
center: ol.proj.transform([-123.1, 49.25], 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 8
|
||||
center: [-6655.5402445057125, 6709968.258934638],
|
||||
zoom: 13
|
||||
})
|
||||
});
|
||||
|
||||
$('#layer-select').change(function() {
|
||||
var style = $(this).find(':selected').val();
|
||||
for (var i = 0; i < layers.length; ++i) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = layers.length; i < ii; ++i) {
|
||||
layers[i].setVisible(styles[i] == style);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -620,8 +620,9 @@ ol.structs.RBush.prototype.remove_ = function(extent, value) {
|
||||
var path = [node];
|
||||
/** @type {Array.<number>} */
|
||||
var indexes = [0];
|
||||
var child, children, i, ii;
|
||||
var childrenDone, child, children, i, ii;
|
||||
while (path.length > 0) {
|
||||
childrenDone = false;
|
||||
goog.asserts.assert(node.height > 0);
|
||||
if (node.height == 1) {
|
||||
children = node.children;
|
||||
@@ -633,8 +634,7 @@ ol.structs.RBush.prototype.remove_ = function(extent, value) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
node = path.pop();
|
||||
index = indexes.pop();
|
||||
childrenDone = true;
|
||||
} else if (index < node.children.length) {
|
||||
child = node.children[index];
|
||||
if (ol.extent.containsExtent(child.extent, extent)) {
|
||||
@@ -646,8 +646,16 @@ ol.structs.RBush.prototype.remove_ = function(extent, value) {
|
||||
++index;
|
||||
}
|
||||
} else {
|
||||
node = path.pop();
|
||||
index = indexes.pop();
|
||||
childrenDone = true;
|
||||
}
|
||||
if (childrenDone) {
|
||||
var lastPathIndex = path.length - 1;
|
||||
node = path[lastPathIndex];
|
||||
index = ++indexes[lastPathIndex];
|
||||
if (index > node.children.length) {
|
||||
path.pop();
|
||||
indexes.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -32,13 +32,18 @@ describe('ol.structs.RBush', function() {
|
||||
|
||||
var objs;
|
||||
beforeEach(function() {
|
||||
objs = [{}, {}, {}, {}, {}, {}];
|
||||
objs = [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}];
|
||||
rBush.insert([0, 0, 1, 1], objs[0]);
|
||||
rBush.insert([1, 1, 4, 4], objs[1]);
|
||||
rBush.insert([2, 2, 3, 3], objs[2]);
|
||||
rBush.insert([-5, -5, -4, -4], objs[3]);
|
||||
rBush.insert([-4, -4, -1, -1], objs[4]);
|
||||
rBush.insert([-3, -3, -2, -2], objs[5]);
|
||||
rBush.insert([-3, -3, -2, -2], objs[6]);
|
||||
rBush.insert([-3, -3, -2, -2], objs[7]);
|
||||
rBush.insert([-3, -3, -2, -2], objs[8]);
|
||||
rBush.insert([-3, -3, -2, -2], objs[9]);
|
||||
rBush.insert([-3, -3, -2, -2], objs[10]);
|
||||
});
|
||||
|
||||
describe('#getAllInExtent', function() {
|
||||
@@ -294,6 +299,20 @@ describe('ol.structs.RBush', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('#remove', function() {
|
||||
|
||||
it('can remove all 2000 objects', function() {
|
||||
var objs = rBush.getAll();
|
||||
var i, value;
|
||||
for (i = objs.length - 1; i >= 0; --i) {
|
||||
value = objs[i];
|
||||
rBush.remove(value);
|
||||
}
|
||||
expect(rBush.isEmpty()).to.be(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user