protect google base layer functions from an uncentered gmaps object

git-svn-id: http://svn.openlayers.org/trunk/openlayers@949 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-16 16:41:54 +00:00
parent 460446f558
commit 629e62b82b

View File

@@ -262,12 +262,12 @@ OpenLayers.Layer.Google.prototype = Object.extend( new OpenLayers.Layer(), {
*
* @returns An OpenLayers.LonLat which is the passed-in view port
* OpenLayers.Pixel, translated into lon/lat by GMAPS
* If gmap is not loaded, returns null.
* If gmap is not loaded or not centered, returns null
* @type OpenLayers.LonLat
*/
getLonLatFromViewPortPx: function (viewPortPx) {
var lonlat = null;
if (this.gmap != null) {
if ((this.gmap != null) && (this.gmap.getCenter() != null)) {
var gPoint = this.getGPointFromOLPixel(viewPortPx);
var gLatLng = this.gmap.fromContainerPixelToLatLng(gPoint)
lonlat = this.getOLLonLatFromGLatLng(gLatLng);
@@ -281,12 +281,12 @@ OpenLayers.Layer.Google.prototype = Object.extend( new OpenLayers.Layer(), {
*
* @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat,
* translated into view port pixels BY GMAPS
* If gmap is not loaded, returns null.
* If gmap is not loaded or not centered, returns null
* @type OpenLayers.Pixel
*/
getViewPortPxFromLonLat: function (lonlat) {
var viewPortPx = null;
if (this.gmap != null) {
if ((this.gmap != null) && (this.gmap.getCenter() != null)) {
var gLatLng = this.getGLatLngFromOLLonLat(lonlat);
// note we use special hacked function here
@@ -302,12 +302,12 @@ OpenLayers.Layer.Google.prototype = Object.extend( new OpenLayers.Layer(), {
* @param {OpenLayers.Bounds} bounds
*
* @returns Corresponding zoom level for a specified Bounds.
* If gmap is not loaded, returns null.
* If gmap is not loaded or not centered, returns null
* @type int
*/
getZoomForExtent: function (bounds) {
var zoom = null;
if (this.gmap != null) {
if ((this.gmap != null) && (this.gmap.getCenter() != null)) {
var gBounds = this.getGLatLngBoundsFromOLBounds(bounds);
var gZoom = this.gmap.getBoundsZoomLevel(gBounds);
zoom = this.getOLZoomFromGZoom(gZoom);