new LayerSwitcher(lsOptions)
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lsOptions | Object |
control options
|
Example
map.addControl(new ol.control.LayerSwitcher(
[
{
layer : wms1,
config : {
title : "test layer name 1",
description : "test layer desc 1",
}
}
],
{
collapsed : true
}
));
Extends
- ol.control.Control
Members
-
collapsed
-
{Boolean} true if widget is collapsed, false otherwise
Methods
-
addLayer(layer, config)
Ol3/Controls/LayerSwitcher.js, line 200 -
Add a new layer to control (when added to map) or add new layer configuration
Name Type Description layer ol.layer.Layer layer to add to layer switcher
config Object optional additional options for layer configuration
Name Type Description title Object optional layer title (default is layer identifier)
description Object optional layer description (default is null)
legends Object optional layer legends (default is an empty array)
metadata Object optional layer metadata (default is an empty array)
quicklookUrl Object optional layer quicklookUrl (default is null)
Example
layerSwitcher.addLayer( gpParcels, { title : "Parcelles cadastrales", description : "description de la couche", quicklookUrl : "http://quicklookUrl.fr" } )
-
getCollapsed()
Ol3/Controls/LayerSwitcher.js, line 393 -
Returns true if widget is collapsed (minimize), false otherwise
-
getLayerDOMId(olLayer){String}
Ol3/Controls/LayerSwitcher.js, line 1030 -
Returns Layer Container Id associated with given olLayer
Name Type Description olLayer ol.layer.Layer ol layer object
Returns:
container Id ; null if layer not found.
-
removeLayer(layer)
Ol3/Controls/LayerSwitcher.js, line 338 -
Remove a layer from control
Name Type Description layer ol.layer.Layer layer.
-
setCollapsed(collapsed)
Ol3/Controls/LayerSwitcher.js, line 370 -
Collapse or display control main container
Name Type Description collapsed Boolean True to collapse control, False to display it
-
setMap(map)
Ol3/Controls/LayerSwitcher.js, line 109 -
Overload setMap function, that enables to catch map events, such as movend events.
Name Type Description map ol.Map Map.
-
setRemovable(layer, removable)
Ol3/Controls/LayerSwitcher.js, line 403 -
Display or hide removeLayerPicto from layerSwitcher for this layer
Name Type Description layer ol.layer.Layer ol.layer to be configured
removable Boolean specify if layer can be remove from layerSwitcher (true) or not (false). Default is true