new LayerSwitcher(lsOptions)
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lsOptions | Object |
control options
|
Example
var layerSwitcher = new itowns.control.LayerSwitcher({
layers : [
{
id : "myLayer",
config : {
title : "test layer name 1",
description : "test layer desc 1",
}
}
],
options : {
collapsed : false
}
));
Extends
Methods
-
addLayer(layer, config)
Itowns/Controls/LayerSwitcher.js, line 277 -
Adds a new layer to control (when added to globe) or add new layer configuration
Name Type Description layer Object 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({ layer : gpParcels, config : { title : "Parcelles cadastrales", description : "description de la couche", quicklookUrl : "http://quicklookUrl.fr" } })
-
getCollapsed()
Itowns/Controls/LayerSwitcher.js, line 429 -
Returns true if widget is collapsed (minimize), false otherwise
-
inherited getElement(){HTMLElement}
Itowns/Controls/Widget.js, line 41 -
Return the widget's container element.
Returns:
container element.
-
inherited getGlobe(){Object}
Itowns/Controls/Widget.js, line 106 -
Get the globe associated with the widget. Undefined if the widget is not added to a globe.
-
inherited getTarget(){HTMLElement}
Itowns/Controls/Widget.js, line 84 -
Return the widget's target div.
Returns:
target div.
-
removeLayer(layerId)
Itowns/Controls/LayerSwitcher.js, line 385 -
Removes a layer from control
Name Type Description layerId Object layer to remove to layer switcher
-
setCollapsed(collapsed)
Itowns/Controls/LayerSwitcher.js, line 406 -
Collapse or display control main container
Name Type Description collapsed Boolean True to collapse control, False to display it
-
setGlobe()
Itowns/Controls/LayerSwitcher.js, line 99 -
Binds globe to control
-
inherited setOptions(options)
Itowns/Controls/Widget.js, line 94 -
Change the options of the widget.
Name Type Description options Object The new options of the control.
-
inherited setTarget(targetDiv, position)
Itowns/Controls/Widget.js, line 52 -
Associates the widget to a specified target div.
Name Type Description targetDiv HTMLElement widget target div.
position String html position attribute.