BBOX strategy should not request data if its layer is out of range when changing layer visibility
This commit is contained in:
@@ -87,7 +87,7 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
|
|||||||
"refresh": this.update,
|
"refresh": this.update,
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
if(this.layer.visibility === true && this.layer.inRange === true) {
|
if(this.layer.visibility === true) {
|
||||||
this.update();
|
this.update();
|
||||||
} else {
|
} else {
|
||||||
this.layer.events.on({
|
this.layer.events.on({
|
||||||
@@ -134,7 +134,7 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
|
|||||||
update: function(options) {
|
update: function(options) {
|
||||||
var mapBounds = this.getMapBounds();
|
var mapBounds = this.getMapBounds();
|
||||||
if (mapBounds !== null && ((options && options.force) ||
|
if (mapBounds !== null && ((options && options.force) ||
|
||||||
this.invalidBounds(mapBounds))) {
|
(this.layer.calculateInRange() && this.invalidBounds(mapBounds)))) {
|
||||||
this.calculateBounds(mapBounds);
|
this.calculateBounds(mapBounds);
|
||||||
this.resolution = this.layer.map.getResolution();
|
this.resolution = this.layer.map.getResolution();
|
||||||
this.triggerRead(options);
|
this.triggerRead(options);
|
||||||
|
|||||||
@@ -305,7 +305,7 @@
|
|||||||
|
|
||||||
// Test fix for Ticket #3142
|
// Test fix for Ticket #3142
|
||||||
function test_layerLoadedAfterBeingAdded(t) {
|
function test_layerLoadedAfterBeingAdded(t) {
|
||||||
t.plan(2);
|
t.plan(3);
|
||||||
|
|
||||||
var dummy = new OpenLayers.Layer(null, {isBaseLayer: true});
|
var dummy = new OpenLayers.Layer(null, {isBaseLayer: true});
|
||||||
|
|
||||||
@@ -341,6 +341,11 @@
|
|||||||
// test that the strategy bounds were set
|
// test that the strategy bounds were set
|
||||||
t.ok(map.getExtent().equals(strategy.bounds), "[set center] bounds set to map extent");
|
t.ok(map.getExtent().equals(strategy.bounds), "[set center] bounds set to map extent");
|
||||||
t.eq(layerOutOfRange.strategies[0].bounds, null, "Data not requested if layer is out of range");
|
t.eq(layerOutOfRange.strategies[0].bounds, null, "Data not requested if layer is out of range");
|
||||||
|
|
||||||
|
layerOutOfRange.setVisibility(false);
|
||||||
|
layerOutOfRange.setVisibility(true);
|
||||||
|
t.eq(layerOutOfRange.strategies[0].bounds, null, "Data not requested if layer is out of range when switching visibility");
|
||||||
|
|
||||||
map.destroy();
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user