[OpenLayers-Commits] r11002 - in trunk/openlayers:
lib/OpenLayers/Layer tests/Layer
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed Jan 5 12:21:59 EST 2011
Author: tschaub
Date: 2011-01-05 09:21:58 -0800 (Wed, 05 Jan 2011)
New Revision: 11002
Modified:
trunk/openlayers/lib/OpenLayers/Layer/Grid.js
trunk/openlayers/tests/Layer/WMS.html
Log:
For gridded layers where the tile lattice on the server doesn't align with the maxExtent on the client, set the layer tileExtent property. r=ahocevar (closes #3002)
Modified: trunk/openlayers/lib/OpenLayers/Layer/Grid.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/Grid.js 2011-01-05 16:45:10 UTC (rev 11001)
+++ trunk/openlayers/lib/OpenLayers/Layer/Grid.js 2011-01-05 17:21:58 UTC (rev 11002)
@@ -25,6 +25,12 @@
*/
tileSize: null,
+ /**
+ * APIProperty: tileExtent
+ * {<OpenLayers.Bounds>}
+ */
+ tileExtent: null,
+
/** APIProperty: tileOptions
* {Object} optional configuration options for <OpenLayers.Tile> instances
* created by this Layer, if supported by the tile class.
@@ -446,7 +452,7 @@
* {OpenLayers.Bounds}
*/
getMaxExtent: function() {
- return this.maxExtent;
+ return this.tileExtent || this.maxExtent;
},
/**
Modified: trunk/openlayers/tests/Layer/WMS.html
===================================================================
--- trunk/openlayers/tests/Layer/WMS.html 2011-01-05 16:45:10 UTC (rev 11001)
+++ trunk/openlayers/tests/Layer/WMS.html 2011-01-05 17:21:58 UTC (rev 11002)
@@ -154,7 +154,6 @@
map.destroy();
}
-
function test_Layer_WMS_clone (t) {
t.plan(4);
@@ -381,6 +380,39 @@
}
+ function test_tileExtent(t) {
+ t.plan(4);
+
+ var dummy = new OpenLayers.Layer(null, {isBaseLayer: true});
+ var unconstrained = new OpenLayers.Layer.WMS(
+ null, "http://example.com/wms",
+ {layers: "unconstrained"},
+ {isBaseLayer: false, buffer: 0}
+ );
+ var constrained = new OpenLayers.Layer.WMS(
+ null, "http://example.com/wms-c",
+ {layers: "constrained"},
+ {buffer: 0, isBaseLayer: false, tileExtent: new OpenLayers.Bounds(-180, -90, 180, 90)}
+ );
+ var map = new OpenLayers.Map({
+ div: "map",
+ maxExtent: new OpenLayers.Bounds(-185, -95, 185, 95),
+ layers: [dummy, unconstrained, constrained],
+ center: new OpenLayers.LonLat(0, 0),
+ zoom: 1
+ });
+
+ t.eq(unconstrained.grid[1][0].bounds.bottom, -95, "unconstrained bottom correct");
+ t.eq(unconstrained.grid[1][0].bounds.left, -185, "unconstrained left correct");
+ t.eq(constrained.grid[1][0].bounds.bottom, -90, "constrained bottom correct");
+ t.eq(constrained.grid[1][0].bounds.left, -180, "constrained left correct");
+
+ map.destroy();
+
+ }
+
+
+
// DEPRECATED -- REMOVE IN 3.0
function test_Layer_Untiled_WMS(t) {
t.plan(1);
More information about the Commits
mailing list