Respecting minResolution and maxScale if specified in the layer options. r=ahocevar (closes #1321)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6332 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2008-02-21 00:03:11 +00:00
parent 697da4900d
commit db8869e50f
2 changed files with 68 additions and 18 deletions

View File

@@ -715,6 +715,7 @@ OpenLayers.Layer = OpenLayers.Class({
}
// determine numZoomLevels if not already set on the layer
// this gives numZoomLevels assuming approximately base 2 scaling
if (confProps.minResolution != null &&
this.options.numZoomLevels == undefined) {
var ratio = confProps.maxResolution / confProps.minResolution;
@@ -727,13 +728,12 @@ OpenLayers.Layer = OpenLayers.Class({
confProps.resolutions = new Array(confProps.numZoomLevels);
var base = 2;
if(typeof confProps.minResolution == "number" &&
this.options.numZoomLevels > 1) {
confProps.numZoomLevels > 1) {
/**
* If numZoomLevels is explicitly set in the layer options,
* respect it. If numZoomLevels is not specified, we use
* exponential scaling with a base of 2. If numZoomLevels
* is specified, we use exponential scaling and determine the
* appropriate base so minResolution is reached.
* If maxResolution and minResolution are set (or related
* scale properties), we calculate the base for exponential
* scaling that starts at maxResolution and ends at
* minResolution in numZoomLevels steps.
*/
base = Math.pow(
(confProps.maxResolution / confProps.minResolution),