rollback 1295 -- prematurely committed
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1296 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -36,17 +36,10 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
|||||||
this.params = Object.extend( new Object(), params);
|
this.params = Object.extend( new Object(), params);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** When the layer is added to the map, once it has taken all the
|
|
||||||
* relevant properties from the map (in Layer.setMap()), we will
|
|
||||||
* make the call to initialize the layer's resolutions array.
|
|
||||||
*
|
|
||||||
* @param {OpenLayers.Map} map
|
|
||||||
*/
|
|
||||||
setMap: function(map) {
|
setMap: function(map) {
|
||||||
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||||
this.initResolutions();
|
this.initResolutions();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -138,55 +131,31 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
|||||||
return requestString;
|
return requestString;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @private
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
initResolutions: function() {
|
initResolutions: function() {
|
||||||
|
if (this.scales != null) {
|
||||||
if ((this.scales != null) || (this.resolutions != null)) {
|
this.resolutions = new Array();
|
||||||
if (this.scales != null) {
|
for(var i = 0; i < this.scales.length; i++)
|
||||||
//convert the scales into resolutions.
|
this.resolutions[i] = OpenLayers.Util.getResolutionFromScale(this.scales[i], this.units);
|
||||||
this.resolutions = new Array();
|
this.maxZoomLevel = this.resolutions.length;
|
||||||
for(var i = 0; i < this.scales.length; i++) {
|
} else if (this.resolutions != null) {
|
||||||
this.resolutions[i] =
|
|
||||||
OpenLayers.Util.getResolutionFromScale(this.scales[i],
|
|
||||||
this.units);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.maxZoomLevel = this.resolutions.length;
|
this.maxZoomLevel = this.resolutions.length;
|
||||||
} else {
|
} else {
|
||||||
this.resolutions = new Array();
|
this.resolutions = new Array();
|
||||||
|
if (this.minScale)
|
||||||
if (this.minScale) {
|
this.maxResolution = OpenLayers.Util.getResolutionFromScale(this.minScale, this.units);
|
||||||
this.maxResolution =
|
|
||||||
OpenLayers.Util.getResolutionFromScale(this.minScale,
|
|
||||||
this.units);
|
|
||||||
}
|
|
||||||
|
|
||||||
var maxRes = this.getMaxResolution();
|
var maxRes = this.getMaxResolution();
|
||||||
|
|
||||||
if (this.maxScale) {
|
if (this.maxScale) {
|
||||||
var minRes =
|
/* This will cause this.map.getMaxZoomLevel() to be set the next time
|
||||||
OpenLayers.Util.getResolutionFromScale(this.maxScale);
|
* it is called, which means that the next portion here will succeed. */
|
||||||
this.maxZoomLevel = Math.floor(Math.log(maxRes/minRes) /
|
var minRes = OpenLayers.Util.getResolutionFromScale(this.maxScale);
|
||||||
Math.log(2));
|
this.maxZoomLevel = Math.floor(Math.log(maxRes/minRes) / Math.log(2));
|
||||||
}
|
}
|
||||||
|
for (var i=this.getMinZoomLevel(); i <= this.getMaxZoomLevel(); i++) {
|
||||||
//at this point, min and max zoom levels are correctly set, so
|
|
||||||
// iterate and add them to the resolutions array.
|
|
||||||
var minZoomLevel = this.getMinZoomLevel()
|
|
||||||
var maxZoomLevel = this.getMaxZoomLevel()
|
|
||||||
for (var i = minZoomLevel; i <= maxZoomLevel; i++) {
|
|
||||||
this.resolutions.push(maxRes / Math.pow(2, i));
|
this.resolutions.push(maxRes / Math.pow(2, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns The currently selected resolution of the map, taken from the
|
|
||||||
* resolutions array, indexed by current zoom level.
|
|
||||||
* @type float
|
|
||||||
*/
|
|
||||||
getResolution: function() {
|
getResolution: function() {
|
||||||
var zoom = this.map.getZoom();
|
var zoom = this.map.getZoom();
|
||||||
|
|
||||||
|
|||||||
@@ -706,6 +706,11 @@ OpenLayers.Map.prototype = {
|
|||||||
if (this.baseLayer != null) {
|
if (this.baseLayer != null) {
|
||||||
maxResolution = this.baseLayer.getMaxResolution();
|
maxResolution = this.baseLayer.getMaxResolution();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maxResolution == null) {
|
||||||
|
maxResolution = this.maxResolution;
|
||||||
|
}
|
||||||
|
|
||||||
return maxResolution;
|
return maxResolution;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user