diff --git a/lib/OpenLayers/Layer/WMS.js b/lib/OpenLayers/Layer/WMS.js index 9ec9ac6a77..0bf43022ae 100644 --- a/lib/OpenLayers/Layer/WMS.js +++ b/lib/OpenLayers/Layer/WMS.js @@ -21,13 +21,8 @@ OpenLayers.Layer.WMS.prototype = format: "image/jpeg" }, - /** WMS layer by default is a base layer. - * If the user wishes to use a WMS as a datalayer, s/he needs only - * set this property to false. - * - * @type Boolean - */ - isBaseLayer: true, + /** @type Boolean */ + isBaseLayer: null, /** * @constructor @@ -52,6 +47,8 @@ OpenLayers.Layer.WMS.prototype = OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS) ); } + + this.isBaseLayer = (this.params.TRANSPARENT != "true"); }, /** diff --git a/tests/test_Layer_WMS.html b/tests/test_Layer_WMS.html index 0dd71d2b6b..e52965590b 100644 --- a/tests/test_Layer_WMS.html +++ b/tests/test_Layer_WMS.html @@ -98,12 +98,22 @@ function test_05_Layer_WMS_isBaseLayer(t) { - t.plan(1); + t.plan(2); var url = "http://octo.metacarta.com/cgi-bin/mapserv"; layer = new OpenLayers.Layer.WMS(name, url, params); t.ok( layer.isBaseLayer, "baselayer is true by default"); + + var newParams = Object.extend(new Object(), params); + newParams.transparent = "true"; + layer = new OpenLayers.Layer.WMS(name, url, newParams); + + + t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true"); + + + } function test_06_Layer_WMS_mergeNewParams (t) {