[OpenLayers-Commits] r11602 - in sandbox/ahocevar/renderer-ng: .
examples lib/OpenLayers/Control lib/OpenLayers/Strategy
tests/Strategy
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Tue Mar 1 10:43:17 EST 2011
Author: ahocevar
Date: 2011-03-01 07:43:16 -0800 (Tue, 01 Mar 2011)
New Revision: 11602
Modified:
sandbox/ahocevar/renderer-ng/
sandbox/ahocevar/renderer-ng/examples/spherical-mercator.html
sandbox/ahocevar/renderer-ng/lib/OpenLayers/Control/Navigation.js
sandbox/ahocevar/renderer-ng/lib/OpenLayers/Control/TouchNavigation.js
sandbox/ahocevar/renderer-ng/lib/OpenLayers/Strategy/BBOX.js
sandbox/ahocevar/renderer-ng/tests/Strategy/BBOX.html
Log:
merging r11589:HEAD from trunk
Property changes on: sandbox/ahocevar/renderer-ng
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:10635-10646,10648-10676,10678-10685,10687-10692,10694-10991,10995-11588
+ /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:10635-10646,10648-10676,10678-10685,10687-10692,10694-10991,10995-11588,11590-11601
Modified: sandbox/ahocevar/renderer-ng/examples/spherical-mercator.html
===================================================================
--- sandbox/ahocevar/renderer-ng/examples/spherical-mercator.html 2011-03-01 15:39:57 UTC (rev 11601)
+++ sandbox/ahocevar/renderer-ng/examples/spherical-mercator.html 2011-03-01 15:43:16 UTC (rev 11602)
@@ -32,7 +32,7 @@
function init(){
var maxExtent = new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508),
- restrictedExtent = maxExtent.clone(-20037508, -20037508, 20037508, 20037508),
+ restrictedExtent = maxExtent.clone(),
maxResolution = 156543.0339;
var options = {
Modified: sandbox/ahocevar/renderer-ng/lib/OpenLayers/Control/Navigation.js
===================================================================
--- sandbox/ahocevar/renderer-ng/lib/OpenLayers/Control/Navigation.js 2011-03-01 15:39:57 UTC (rev 11601)
+++ sandbox/ahocevar/renderer-ng/lib/OpenLayers/Control/Navigation.js 2011-03-01 15:43:16 UTC (rev 11602)
@@ -32,7 +32,7 @@
dragPan: null,
/**
- * APIProprety: dragPanOptions
+ * APIProperty: dragPanOptions
* {Object} Options passed to the DragPan control.
*/
dragPanOptions: null,
Modified: sandbox/ahocevar/renderer-ng/lib/OpenLayers/Control/TouchNavigation.js
===================================================================
--- sandbox/ahocevar/renderer-ng/lib/OpenLayers/Control/TouchNavigation.js 2011-03-01 15:39:57 UTC (rev 11601)
+++ sandbox/ahocevar/renderer-ng/lib/OpenLayers/Control/TouchNavigation.js 2011-03-01 15:43:16 UTC (rev 11602)
@@ -27,7 +27,7 @@
dragPan: null,
/**
- * APIProprety: dragPanOptions
+ * APIProperty: dragPanOptions
* {Object} Options passed to the DragPan control.
*/
dragPanOptions: null,
Modified: sandbox/ahocevar/renderer-ng/lib/OpenLayers/Strategy/BBOX.js
===================================================================
--- sandbox/ahocevar/renderer-ng/lib/OpenLayers/Strategy/BBOX.js 2011-03-01 15:39:57 UTC (rev 11601)
+++ sandbox/ahocevar/renderer-ng/lib/OpenLayers/Strategy/BBOX.js 2011-03-01 15:43:16 UTC (rev 11602)
@@ -90,6 +90,14 @@
"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 @@
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 @@
*/
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.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(
Modified: sandbox/ahocevar/renderer-ng/tests/Strategy/BBOX.html
===================================================================
--- sandbox/ahocevar/renderer-ng/tests/Strategy/BBOX.html 2011-03-01 15:39:57 UTC (rev 11601)
+++ sandbox/ahocevar/renderer-ng/tests/Strategy/BBOX.html 2011-03-01 15:43:16 UTC (rev 11602)
@@ -270,6 +270,29 @@
}
+ // Test fix for Ticket #3142
+ function test_layerLoadedAfterBeingAdded(t) {
+ t.plan(1);
+
+ var dummy = new OpenLayers.Layer(null, {isBaseLayer: true});
+
+ var strategy = new OpenLayers.Strategy.BBOX({
+ ratio: 1 // makes for easier comparison to map bounds
+ });
+ var layer = new OpenLayers.Layer.Vector(null, {
+ protocol: new OpenLayers.Protocol(),
+ strategies: [strategy]
+ });
+
+ var map = new OpenLayers.Map("map");
+ map.addLayer(dummy);
+ map.setCenter(new OpenLayers.LonLat(0, 0));
+ map.addLayer(layer);
+
+ // test that the strategy bounds were set
+ t.ok(map.getExtent().equals(strategy.bounds), "[set center] bounds set to map extent");
+ }
+
</script>
</head>
<body>
More information about the Commits
mailing list