add LayerSwitcher control. Currently, when added, this will simply loop through all the map layers, display a div (with text in it) which allows you tu turn the layer on or off. Layer visibility is a new concept in Layer.js, including a getter and setter, which uses the style.visibility prop to change the status of the layer.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@31 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-05-14 02:44:49 +00:00
parent 45655e12a2
commit 54c0403850
5 changed files with 60 additions and 1 deletions
+15
View File
@@ -10,6 +10,8 @@ OpenLayers.Layer.prototype = {
// OpenLayers.Map
map: null,
status: null,
/**
* @param {str} name
*/
@@ -18,6 +20,7 @@ OpenLayers.Layer.prototype = {
this.div = OpenLayers.Util.createDiv();
this.div.style.width="100%";
this.div.style.height="100%";
this.status = true;
},
/**
@@ -35,5 +38,17 @@ OpenLayers.Layer.prototype = {
moveTo: function (bound,zoomChanged) {
// not implemented here
return;
},
getVisibility: function() {
return this.status;
},
setVisibility: function(on) {
if (on) {
this.div.style.display="block";
} else {
this.div.style.display="none";
}
this.status = on;
}
};