From 03fc6aacd4725e1a84977448efd30921b139ca90 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Fri, 21 Mar 2008 17:31:58 +0000 Subject: [PATCH] FixedZoomLevels subclassese don't propertly set min/max resolution, so calculateInRange always returns false, so the layers can never be displayed (due to recent code): Fix calculateInRange by setting min/max res. r=tschaub, (Closes #1457) git-svn-id: http://svn.openlayers.org/trunk/openlayers@6572 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/FixedZoomLevels.js | 4 +++- tests/Layer/test_Google.html | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Layer/FixedZoomLevels.js b/lib/OpenLayers/Layer/FixedZoomLevels.js index c197e15acb..c653d17431 100644 --- a/lib/OpenLayers/Layer/FixedZoomLevels.js +++ b/lib/OpenLayers/Layer/FixedZoomLevels.js @@ -110,7 +110,9 @@ OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class({ for(var i= this.minZoomLevel; i <= this.maxZoomLevel; i++) { this.resolutions[resolutionsIndex++] = this.RESOLUTIONS[i]; } - } + this.maxResolution = this.resolutions[0]; + this.minResolution = this.resolutions[this.resolutions.length - 1]; + } }, /** diff --git a/tests/Layer/test_Google.html b/tests/Layer/test_Google.html index cf56a47244..36aea7f6e3 100644 --- a/tests/Layer/test_Google.html +++ b/tests/Layer/test_Google.html @@ -215,6 +215,28 @@ window.location.host); } } + function test_02_Layer_Google_isBaseLayer (t) { + if(validkey) { + t.plan(3); + var map = new OpenLayers.Map( 'map' , + { controls: [] , 'numZoomLevels':20}); + + var satellite = new OpenLayers.Layer.Google( "Google Satellite" , {type: G_SATELLITE_MAP, 'maxZoomLevel':18} ); + map.addLayers([satellite]); + map.zoomToMaxExtent(); + + t.eq(satellite.div.style.display, "", "Satellite layer is visible."); + satellite.setVisibility(false); + t.eq(satellite.div.style.display, "none", "Satellite layer is not visible."); + satellite.setVisibility(true); + t.eq(satellite.div.style.display, "block", "Satellite layer is visible."); + + } else { + t.plan(0); + t.debug_print("Google tests can't be run from " + + window.location.host); + } + }