Class: LayerShop

ol.control. LayerShop

LayerShop a layer switcher with special controls to handle operation on layers.


new LayerShop( [options])

Parameters:
Name Type Argument Description
options Object <optional>
Properties
Name Type Description
selection boolean

enable layer selection when click on the title

displayInLayerSwitcher function

function that takes a layer and return a boolean if the layer is displayed in the switcher, default test the displayInLayerSwitcher layer attribute

show_progress boolean

show a progress bar on tile layers, default false

mouseover boolean

show the panel on mouseover, default false

reordering boolean

allow layer reordering, default true

trash boolean

add a trash button to delete the layer, default false

oninfo function

callback on click on info button, if none no info button is shown DEPRECATED: use on(info) instead

extent boolean

add an extent button to zoom to the extent of the layer

onextent function

callback when click on extent, default fits view to extent

drawDelay number

delay in ms to redraw the layer (usefull to prevent flickering when manipulating the layers)

collapsed boolean

collapse the layerswitcher at beginning, default true

layerGroup ol.layer.Group

a layer group to display in the switcher, default display all layers of the map

noScroll boolean

prevent handle scrolling, default false

Layers attributes that control the switcher - allwaysOnTop {boolean} true to force layer stay on top of the others while reordering, default false - displayInLayerSwitcher {boolean} display the layer in switcher, default true - noSwitcherDelete {boolean} to prevent layer deletion (w. trash option = true), default false

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

Inherited From:
Overrides:

Methods


addControl(control [, position])

Add a control to the panel

Parameters:
Name Type Argument Default Description
control ol.control.Control
position string <optional>
'top'

bar position bottom or top, default top


displayInLayerSwitcher(layer)

Test if a layer should be displayed in the switcher

Parameters:
Name Type Description
layer ol.layer
Inherited From:
Overrides:
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)

Inherited From:
Overrides:

getBarElement( [position])

Get the bar element (to add new element in it)

Parameters:
Name Type Argument Default Description
position string <optional>
'top'

bar position bottom or top, default top

Returns:
Type
Element

getLayerClass(layer)

Select a layer

Parameters:
Name Type Description
layer ol.layer.Layer
Inherited From:
Overrides:
Returns:

the layer classname

Type
string

getPanel()

Get control panel

Inherited From:
Overrides:

getSelection()

Get selected layer

Inherited From:
Overrides:
Returns:
Type
ol.layer.Layer

hide()

Hide control

Inherited From:
Overrides:

isOpen()

Is control open

Inherited From:
Overrides:
Returns:
Type
boolean

selectLayer(layer)

Select a layer

Parameters:
Name Type Description
layer ol.layer.Layer
Inherited From:
Overrides:

setHeader(html)

Add a custom header

Parameters:
Name Type Description
html Element | string

content html

Inherited From:
Overrides:

setLayerVisibility(layer, li)

Set visibility for a layer

Parameters:
Name Type Description
layer ol.layer.Layer
li Element

the list element

Inherited From:
Overrides:

setMap(map)

Set the map instance the control is associated with.

Parameters:
Name Type Description
map _ol_Map_

The map instance.

Overrides:

show()

Show control

Inherited From:
Overrides:

toggle()

Toggle control

Inherited From:
Overrides: