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:
@@ -41,6 +41,20 @@ OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
*/
|
||||
serverResolutions: null,
|
||||
|
||||
/**
|
||||
* 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). Using <zoomOffset> is an alternative to
|
||||
* setting <serverResolutions> if you only want to expose a subset
|
||||
* of the server resolutions.
|
||||
*/
|
||||
zoomOffset: 0,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Layer.TMS
|
||||
*
|
||||
@@ -107,7 +121,7 @@ OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
|
||||
var z = this.serverResolutions != null ?
|
||||
OpenLayers.Util.indexOf(this.serverResolutions, res) :
|
||||
this.map.getZoom();
|
||||
this.map.getZoom() + this.zoomOffset;
|
||||
var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
|
||||
var url = this.url;
|
||||
if (url instanceof Array) {
|
||||
|
||||
Reference in New Issue
Block a user