1 /* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
2 * See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
3 * text of the license. */
7 OpenLayers.Layer = Class.create();
8 OpenLayers.Layer.prototype = {
13 /** @type DOMElement */
16 /** This variable is set in map.addLayer, not within the layer itself
17 * @type OpenLayers.Map */
23 * @param {String} name
25 initialize: function(name) {
26 if (arguments.length > 0) {
28 if (this.div == null) {
29 this.div = OpenLayers.Util.createDiv();
30 this.div.style.width = "100%";
31 this.div.style.height = "100%";
37 * Destroy is a destructor: this is to alleviate cyclic references which
38 * the Javascript garbage cleaner can not take care of on its own.
41 if (this.map != null) {
42 this.map.removeLayer(this);
48 * @params {OpenLayers.Bounds} bound
49 * @params {Boolean} zoomChanged tells when zoom has changed, as layers have to do some init work in that case.
51 moveTo: function (bound, zoomChanged) {
52 // not implemented here
57 * @param {OpenLayers.Map} map
59 setMap: function(map) {
64 * @returns Whether or not the layer is a base layer. This should be
65 * determined individually by all subclasses.
68 isBaseLayer: function() {
69 //this function should be implemented by all subclasses.
73 * @returns Whether or not the layer is visible
76 getVisibility: function() {
77 return (this.div.style.display != "none");
81 * @param {bool} visible
83 setVisibility: function(visible) {
84 this.div.style.display = (visible) ? "block" : "none";
85 if ((visible) && (this.map != null)) {
86 this.moveTo(this.map.getExtent());
90 /** @final @type String */
91 CLASS_NAME: "OpenLayers.Layer"