Merge 2.0 branch to trunk.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1369 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-08-25 18:17:06 +00:00
parent 282d9d6047
commit 104e509eb9
47 changed files with 840 additions and 483 deletions

View File

@@ -14,6 +14,12 @@ OpenLayers.Layer.VirtualEarth.prototype =
/** @type VEMap */
vemap: null,
/** @type int */
minZoomLevel: 1,
/** @type int */
maxZoomLevel: 17,
/**
* @constructor
*
@@ -21,6 +27,8 @@ OpenLayers.Layer.VirtualEarth.prototype =
*/
initialize:function(name) {
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
this.numZoomLevels = this.maxZoomLevel - this.minZoomLevel + 1;
},
/**
@@ -200,24 +208,26 @@ OpenLayers.Layer.VirtualEarth.prototype =
*/
getZoomForExtent: function (bounds) {
var maxRes = this.map.getMaxResolution();
var viewSize = this.map.getSize();
var width = bounds.getWidth();
var height = bounds.getHeight();
var degPerPixel = (width > height) ? width / viewSize.w
: height / viewSize.h;
var zoom = Math.floor( (Math.log(maxRes/degPerPixel)) / Math.log(2) );
var maxZoomLevel = this.map.getMaxZoomLevel();
var minZoomLevel = this.map.getMinZoomLevel();
var zoom = null;
if (this.vemap != null) {
var maxRes = this.map.getMaxResolution();
var viewSize = this.map.getSize();
//make sure zoom is within bounds
zoom = Math.min( Math.max(zoom, minZoomLevel),
maxZoomLevel );
var width = bounds.getWidth();
var height = bounds.getHeight();
var degPerPixel = (width > height) ? width / viewSize.w
: height / viewSize.h;
var veZoom = Math.floor( (Math.log(maxRes/degPerPixel)) /
Math.log(2) );
//make sure zoom is within bounds
var veZoom = Math.min(Math.max(veZoom, this.minZoomLevel),
this.maxZoomLevel);
zoom = this.getOLZoomFromVEZoom(veZoom);
}
return zoom;
},
@@ -245,7 +255,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
getOLZoomFromVEZoom: function(veZoom) {
var zoom = null;
if (veZoom != null) {
zoom = veZoom;
zoom = veZoom - this.minZoomLevel;
}
return zoom;
},
@@ -260,7 +270,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
getVEZoomFromOLZoom: function(olZoom) {
var zoom = null;
if (olZoom != null) {
zoom = olZoom;
zoom = olZoom + this.minZoomLevel;
}
return zoom;
},