new LayerSwitcher( [options])
Parameters:
Name | Type | Argument | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Properties
|
Fires:
- event:select
- event:drawlist
- event:toggle
- event:reorder-start
- event:reorder-end
- layer:visible
- layer:opacity
Extends
Members
-
tip
-
List of tips for internationalization purposes
Methods
-
displayInLayerSwitcher(layer)
-
Test if a layer should be displayed in the switcher
Parameters:
Name Type Description layer
ol.layer Returns:
true if the layer is displayed
- Type
- boolean
-
drawPanel()
-
Draw the panel control (prevent multiple draw due to layers manipulation on the map with a delay function)
-
getLayerClass(layer)
-
Select a layer
Parameters:
Name Type Description layer
ol.layer.Layer Returns:
the layer classname
- Type
- string
-
getPanel()
-
Get control panel
-
getSelection()
-
Get selected layer
Returns:
- Type
- ol.layer.Layer
-
hide()
-
Hide control
-
isOpen()
-
Is control open
Returns:
- Type
- boolean
-
selectLayer(layer)
-
Select a layer
Parameters:
Name Type Description layer
ol.layer.Layer -
setHeader(html)
-
Add a custom header
Parameters:
Name Type Description html
Element | string content html
-
setLayerVisibility(layer, li)
-
Set visibility for a layer
Parameters:
Name Type Description layer
ol.layer.Layer li
Element the list element
-
setMap(map)
-
Set the map instance the control is associated with.
Parameters:
Name Type Description map
_ol_Map_ The map instance.
-
show()
-
Show control
-
toggle()
-
Toggle control