Vector layer with BBOX Strategy isn't loaded/requested automatically, p=vmische, r=me (closes #3142)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11598 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -90,6 +90,14 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
|
||||
"refresh": this.update,
|
||||
scope: this
|
||||
});
|
||||
if(this.layer.visibility == true) {
|
||||
this.update();
|
||||
} else {
|
||||
this.layer.events.on({
|
||||
"visibilitychanged": this.update,
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
}
|
||||
return activated;
|
||||
},
|
||||
@@ -106,10 +114,8 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
|
||||
if(deactivated) {
|
||||
this.layer.events.un({
|
||||
"moveend": this.update,
|
||||
scope: this
|
||||
});
|
||||
this.layer.events.un({
|
||||
"refresh": this.update,
|
||||
"visibilitychanged": this.update,
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
@@ -127,7 +133,8 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
|
||||
*/
|
||||
update: function(options) {
|
||||
var mapBounds = this.getMapBounds();
|
||||
if ((options && options.force) || this.invalidBounds(mapBounds)) {
|
||||
if (mapBounds !== null && ((options && options.force) ||
|
||||
this.invalidBounds(mapBounds))) {
|
||||
this.calculateBounds(mapBounds);
|
||||
this.resolution = this.layer.map.getResolution();
|
||||
this.triggerRead();
|
||||
@@ -142,6 +149,9 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
|
||||
* {<OpenLayers.Bounds>} Map bounds in the projection of the layer.
|
||||
*/
|
||||
getMapBounds: function() {
|
||||
if (this.layer.map === null) {
|
||||
return null;
|
||||
}
|
||||
var bounds = this.layer.map.getExtent();
|
||||
if(!this.layer.projection.equals(this.layer.map.getProjectionObject())) {
|
||||
bounds = bounds.clone().transform(
|
||||
|
||||
Reference in New Issue
Block a user