The LayerSwitcher control displays a table of contents for the map. This allows the user interface to switch between BaseLayers and to show or hide Overlays. By default the switcher is shown minimized on the right edge of the map, the user may expand it by clicking on the handle.
To create the LayerSwitcher outside of the map, pass the Id of a html div as the first argument to the constructor.
ALKMaps. | The LayerSwitcher control displays a table of contents for the map. |
Properties | |
layerStates | {Array(Object)} Basically a copy of the “state” of the map’s layers the last time the control was drawn. |
layersDiv | {DOMElement} |
baseLayersDiv | {DOMElement} |
baseLayers | {Array(Object)} |
dataLbl | {DOMElement} |
dataLayersDiv | {DOMElement} |
dataLayers | {Array(Object)} |
minimizeDiv | {DOMElement} |
maximizeDiv | {DOMElement} |
ascending | {Boolean} |
Constructor | |
ALKMaps. | |
Functions | |
destroy | |
setMap | |
draw | {DOMElement} A reference to the DIV DOMElement containing the switcher tabs. |
onButtonClick | |
clearLayersArray | User specifies either “base” or “data”. |
checkRedraw | Checks if the layer state has changed since the last redraw() call. |
redraw | Goes through and takes the current state of the Map and rebuilds the control to display that state. |
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. |
maximizeControl | Set up the labels and divs for the control |
minimizeControl | Hide all the contents of the control, shrink the size, add the maximize icon |
showControls | Hide/Show all LayerSwitcher controls depending on whether we are minimized or not |
loadContents | Set up the labels and divs for the control |
destroy: function()
setMap: function( map )
{DOMElement} A reference to the DIV DOMElement containing the switcher tabs.
draw: function()
onButtonClick: function( evt )
User specifies either “base” or “data”.
clearLayersArray: function( layersType )
Checks if the layer state has changed since the last redraw() call.
checkRedraw: function()
Goes through and takes the current state of the Map and rebuilds the control to display that state.
redraw: function()
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 up the labels and divs for the control
maximizeControl: function( e )
Hide all the contents of the control, shrink the size, add the maximize icon
minimizeControl: function( e )
Hide/Show all LayerSwitcher controls depending on whether we are minimized or not
showControls: function( minimize )
Set up the labels and divs for the control
loadContents: function()