Also taking into account zoomOffset.
Now the meaning of getServerZoom is fully clarified, and we can get rid of some code again as well.
This commit is contained in:
@@ -651,17 +651,18 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
|
||||
/**
|
||||
* Method: getServerZoom
|
||||
* Return the zoom value corresponding to the best zoom supported by the server
|
||||
* resolution.
|
||||
* Return the zoom value corresponding to the best matching server
|
||||
* resolution, taking into account <serverResolutions> and <zoomOffset>.
|
||||
*
|
||||
* Returns:
|
||||
* {Number} The closest server supported zoom.
|
||||
* {Number} The closest server supported zoom. This is not the map zoom
|
||||
* level, but an index of the server's resolutions array.
|
||||
*/
|
||||
getServerZoom: function() {
|
||||
var serverResolution = this.getServerResolution();
|
||||
var resolution = this.getServerResolution();
|
||||
return this.serverResolutions ?
|
||||
OpenLayers.Util.indexOf(this.serverResolutions, serverResolution) :
|
||||
this.map.getZoomForResolution(serverResolution);
|
||||
OpenLayers.Util.indexOf(this.serverResolutions, resolution) :
|
||||
this.map.getZoomForResolution(resolution) + (this.zoomOffset || 0);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -173,7 +173,7 @@ OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
var res = this.getServerResolution();
|
||||
var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
|
||||
var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
|
||||
var z = this.getServerZoom() + (this.zoomOffset || 0);
|
||||
var z = this.getServerZoom();
|
||||
var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
|
||||
var url = this.url;
|
||||
if (OpenLayers.Util.isArray(url)) {
|
||||
|
||||
@@ -332,7 +332,7 @@ OpenLayers.Layer.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
* Get the current index in the matrixIds array.
|
||||
*/
|
||||
getIdentifier: function() {
|
||||
return this.getServerZoom() + (this.zoomOffset || 0);
|
||||
return this.getServerZoom();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -143,7 +143,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.getServerZoom() + (this.zoomOffset || 0);
|
||||
var z = this.getServerZoom();
|
||||
|
||||
if (this.wrapDateLine) {
|
||||
var limit = Math.pow(2, z);
|
||||
|
||||
Reference in New Issue
Block a user