/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for * full list of contributors). Published under the Clear BSD license. * See http://svn.openlayers.org/trunk/openlayers/license.txt for the * full text of the license. */ /** * @requires OpenLayers/Control/LayerSwitcher.js * @requires OpenLayers/Control.js * @requires OpenLayers/Lang.js * @requires Rico/Corner.js */ /** * Class: OpenLayers.Control.LayerSwitcherGroups * The LayerSwitcherGroups control displays a table of contents for the map * similar to LayerSwitcher but with split over groups (like lakes, building, etc). * * Inherits from: * - */ OpenLayers.Control.LayerSwitcherGroups = OpenLayers.Class(OpenLayers.Control.LayerSwitcher, { /** * Constructor: OpenLayers.Control.LayerSwitcherGroups * * Parameters: * options - {Object} */ initialize: function(options) { OpenLayers.Control.LayerSwitcher.prototype.initialize.apply(this, arguments); this.layerStates = []; }, /** * APIMethod: destroy */ destroy: function() { OpenLayers.Event.stopObservingElement(this.div); OpenLayers.Event.stopObservingElement(this.minimizeDiv); OpenLayers.Event.stopObservingElement(this.maximizeDiv); //clear out layers info and unregister their events this.clearLayersArray("base"); this.clearLayersArray("data"); this.map.events.un({ "addlayer": this.redraw, "changelayer": this.redraw, "removelayer": this.redraw, "changebaselayer": this.redraw, scope: this }); OpenLayers.Control.prototype.destroy.apply(this, arguments); }, /** * Method: clearLayersArray * User specifies either "base" or "data". we then clear all the * corresponding listeners, the div, and reinitialize a new array. * * Parameters: * layersType - {String} */ clearLayersArray: function(layersType) { var layers = this[layersType + "Layers"]; if (layers) { for(var i=0, len=layers.length; i} layerSwitcher * - {} layer */ onInputClick: function(e) { if (!this.inputElem.disabled) { if (this.inputElem.type == "radio") { this.inputElem.checked = true; this.layer.map.setBaseLayer(this.layer); } else { this.inputElem.checked = !this.inputElem.checked; this.layerSwitcher.updateMap(); } } OpenLayers.Event.stop(e); }, /** * Method: updateMap * Cycles through the loaded data and base layer input arrays and makes * the necessary calls to the Map object such that that the map's * visual state corresponds to what the user has selected in * the control. */ updateMap: function() { // set the newly selected base layer for(var i=0, len=this.baseLayers.length; i