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
+48 -30
View File
@@ -2,31 +2,8 @@
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
if (typeof GMap2 != "undefined") {
/** Hack-on function because GMAPS does not give it to us
*
* @param {GLatLng} gLatLng
*
* @returns A GPoint specifying gLatLng translated into "Container" coords
* @type GPoint
*/
GMap2.prototype.fromLatLngToContainerPixel = function(gLatLng) {
// first we translate into "DivPixel"
var gPoint = this.fromLatLngToDivPixel(gLatLng);
// locate the sliding "Div" div
// it seems like "b" is the main div
var div = this.b.firstChild.firstChild;
// adjust by the offset of "Div" and voila!
gPoint.x += div.offsetLeft;
gPoint.y += div.offsetTop;
return gPoint;
};
}
/**
* @class
@@ -49,7 +26,7 @@ OpenLayers.Layer.Google.prototype =
// OPTIONS
/** @type int */
minZoomLevel: -1,
minZoomLevel: 0,
/** @type int */
maxZoomLevel: 16,
@@ -65,6 +42,8 @@ OpenLayers.Layer.Google.prototype =
if (this.maxExtent == null) {
this.maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);
}
this.addContainerPxFunction();
this.numZoomLevels = this.maxZoomLevel - this.minZoomLevel + 1;
},
/**
@@ -147,6 +126,13 @@ OpenLayers.Layer.Google.prototype =
}
},
/**
* @param {Event} evt
*/
onMapResize: function() {
this.gmap.checkResize();
},
/** If we can't load the GMap, then display an error message to the
* user and tell them where to go for help.
*
@@ -259,6 +245,12 @@ OpenLayers.Layer.Google.prototype =
if ((this.gmap != null) && (this.gmap.getCenter() != null)) {
var gBounds = this.getGLatLngBoundsFromOLBounds(bounds);
var gZoom = this.gmap.getBoundsZoomLevel(gBounds);
//make sure zoom is within bounds
var gZoom = Math.min(Math.max(gZoom, this.minZoomLevel),
this.maxZoomLevel);
zoom = this.getOLZoomFromGZoom(gZoom);
}
return zoom;
@@ -287,7 +279,7 @@ OpenLayers.Layer.Google.prototype =
getOLZoomFromGZoom: function(gZoom) {
var zoom = null;
if (gZoom != null) {
zoom = gZoom;
zoom = gZoom - this.minZoomLevel;
}
return zoom;
},
@@ -302,7 +294,7 @@ OpenLayers.Layer.Google.prototype =
getGZoomFromOLZoom: function(olZoom) {
var zoom = null;
if (olZoom != null) {
zoom = olZoom;
zoom = olZoom + this.minZoomLevel;
}
return zoom;
},
@@ -416,8 +408,34 @@ OpenLayers.Layer.Google.prototype =
}
return gLatLngBounds;
},
addContainerPxFunction: function() {
if (typeof GMap2 != "undefined" && !GMap2.fromLatLngToContainerPixel) {
/** Hack-on function because GMAPS does not give it to us
*
* @param {GLatLng} gLatLng
*
* @returns A GPoint specifying gLatLng translated into "Container" coords
* @type GPoint
*/
GMap2.prototype.fromLatLngToContainerPixel = function(gLatLng) {
// first we translate into "DivPixel"
var gPoint = this.fromLatLngToDivPixel(gLatLng);
// locate the sliding "Div" div
// it seems like "b" is the main div
var div = this.b.firstChild.firstChild;
// adjust by the offset of "Div" and voila!
gPoint.x += div.offsetLeft;
gPoint.y += div.offsetTop;
return gPoint;
};
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.Google"
});