LayerSwitcher

ol-ishare/control/layerswitcher~ LayerSwitcher

LayerSwitcher control. Lists all overlay layers with optional legend images together with base maps. Extends ol-layerswitcher~LayerSwitcher adding legend images.

If tipLabel or collapseTipLabel options are unset, the iShare server version is >= v6.0.9, your langauge file contains oli.layerSwitcher.showButtonTitle or oli.layerSwitcher.showButtonTitle and the lang UI text lookup is available when this control is created then the entries from the language file will be used. Otherwise the default English values will be used. The lang lookup is automatically loaded when creating a LiteMap and is populated once the load event is dispatched.

Constructor

new LayerSwitcher(opt_options)

Parameters:
Name Type Description
opt_options Object

Control options, extends ol/control/Control options adding:

Properties
Name Type Attributes Default Description
startActive boolean <optional>
false

Whether panel is open when created.

activationMode String <optional>
'mouseover'

Event to use on the button to collapse or expand the panel: 'mouseover' - the layerswitcher panel stays expanded while button or panel are hovered; 'click' - a click on the button toggles the layerswitcher visibility.

collapseLabel String <optional>
'»'

Text label to use for the expanded layerswitcher button. E.g.: '»' or '\u00BB', '-' or '\u2212'. Not visible if activation mode is 'mouseover'

label String <optional>
''

Text label to use for the collapsed layerswitcher button. E.g.: '', '«' or '\u00AB', '+'.

tipLabel String <optional>
'Legend'

the button tooltip.

collapseTipLabel String <optional>

the button tooltip when the panel is open.

groupSelectStyle String <optional>
'children'

what to add to group labels: 'none' - groups don't get a checkbox; 'children' - groups have a checkbox and affect child visibility or; 'group' - groups have a checkbox but do not alter child visibility (like QGIS).

reverse boolean <optional>
true

reverse the layer order.

legends legends <optional>
'none'

Whether to display legend images with the layer name: 'none' - layers have no legend image; 'dynamic' - legend image displayed with checkbox; 'static' - only legend image shown, no checkbox.

Extends