Adding a zoomOffset property to XYZ and TMS layers. This allows you to have a map with a maximum resolution that differs from the maximum cache resolution (if you want to show a subset of OSM for example). r=ahocevar (closes #2616)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10650 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2010-08-20 19:40:53 +00:00
parent 5750b5f6e0
commit 59953b8eb6
6 changed files with 192 additions and 2 deletions
+13 -1
View File
@@ -31,6 +31,18 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
*/
sphericalMercator: false,
/**
* APIProperty: zoomOffset
* {Number} If your cache has more zoom levels than you want to provide
* access to with this layer, supply a zoomOffset. This zoom offset
* is added to the current map zoom level to determine the level
* for a requested tile. For example, if you supply a zoomOffset
* of 3, when the map is at the zoom 0, tiles will be requested from
* level 3 of your cache. Default is 0 (assumes cache level and map
* zoom are equivalent).
*/
zoomOffset: 0,
/**
* Constructor: OpenLayers.Layer.XYZ
*
@@ -101,7 +113,7 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
/ (res * this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top)
/ (res * this.tileSize.h));
var z = this.map.getZoom();
var z = this.map.getZoom() + this.zoomOffset;
var url = this.url;
var s = '' + x + y + z;