Adding fractionalZoom property to the map. This allows zooming to an arbitrary level, making it possible to have non-discrete resolutions for layers that support it. This property should not be set to true for layers with fixed zoom levels (commercial layers or others with cached tiles). r=elemoine,crschmidt,ahocevar (closes #1243)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@5982 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2008-02-04 06:23:54 +00:00
parent 1faf641806
commit 211a2834de
6 changed files with 225 additions and 20 deletions

View File

@@ -66,6 +66,14 @@ OpenLayers.Map = OpenLayers.Class({
*/
id: null,
/**
* Property: fractionalZoom
* {Boolean} For a base layer that supports it, allow the map resolution
* to be set to a value between one of the values in the resolutions
* array. Default is false.
*/
fractionalZoom: false,
/**
* APIProperty: events
* {<OpenLayers.Events>} An events object that handles all
@@ -1266,10 +1274,7 @@ OpenLayers.Map = OpenLayers.Class({
if(zoom == null) {
zoom = this.getZoom();
}
var resolution = null;
if(this.baseLayer != null) {
resolution = this.baseLayer.resolutions[zoom];
}
var resolution = this.getResolutionForZoom(zoom);
var extent = this.calculateBounds(lonlat, resolution);
if(!this.restrictedExtent.containsBounds(extent)) {
var maxCenter = this.restrictedExtent.getCenterLonLat();
@@ -1326,7 +1331,7 @@ OpenLayers.Map = OpenLayers.Class({
if (zoomChanged) {
this.zoom = zoom;
this.resolution = this.baseLayer.getResolution();
this.resolution = this.getResolutionForZoom(zoom);
// zoom level has changed, increment viewRequestID.
this.viewRequestID++;
}
@@ -1594,6 +1599,24 @@ OpenLayers.Map = OpenLayers.Class({
return zoom;
},
/**
* APIMethod: getResolutionForZoom
*
* Parameter:
* zoom - {Float}
*
* Returns:
* {Float} A suitable resolution for the specified zoom. If no baselayer
* is set, returns null.
*/
getResolutionForZoom: function(zoom) {
var resolution = null;
if(this.baseLayer) {
resolution = this.baseLayer.getResolutionForZoom(zoom);
}
return resolution;
},
/**
* APIMethod: getZoomForResolution
*