HSLayers.Control.BoxLayerSwitcher (class)

HSLayers.Control.BoxLayerSwitcher

class HSLayers.Control.BoxLayerSwitcher()

Google-like layer switcher

Example usage:

var base = new OpenLayers.Layer.FOO();
var ortho = new OpenLayers.Layer.BAR();
var shadow =  new OpenLayers.Layer.FOO();
var roads =  new OpenLayers.Layer.BAR();
var labels =  new OpenLayers.Layer.FOO();
var box = new HSLayers.Control.BoxLayerSwitcher();
map.addControl(box);
box.add("Base map",base,shadow,{active:true});
box.add("Aerial map",ortho,[[labels,roads]],{});

Properties

HSLayers.Control.BoxLayerSwitcher.CLASS_NAME
Type :String (static)

HSLayers.Control.BoxLayerSwitcher

HSLayers.Control.BoxLayerSwitcher.groups
Type :Object (static)

HSLayers.Control.BoxLayerSwitcher

groups, their titles, names, layers and status

HSLayers.Control.BoxLayerSwitcher.mainLayersDiv
Type :DOMElement (static)

HSLayers.Control.BoxLayerSwitcher

Element, where the layer list is stored

HSLayers.Control.BoxLayerSwitcher.subLayersDiv
Type :DOMElement (static)

HSLayers.Control.BoxLayerSwitcher

Element, where the layer list is stored

Methods

sublayers will appear

of sublayers will disappear

sublayers will appear

sublayers will disappear

HSLayers.Control.BoxLayerSwitcher.setMap(map)

Set the map property for the control.

:param <a href=”http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Map-js.html“>OpenLayers.Map</a> map:

HSLayers.Control.BoxLayerSwitcher.draw()

Draw the control to map canvas

Returns:
A reference to the DIV DOMElement containing the
switcher tabs.
Return type:DOMElement
HSLayers.Control.BoxLayerSwitcher.add(name, layers, sublayers, attributes)

Initializes new layer group and creates button for it

Arguments:
  • name (String) – which will appear in the layer switcher

:param <a href=”http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Layer-js.html“>OpenLayers.Layer</a>[] layers:

list of layers, which do belong to the button

:param <a href=”http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Layer-js.html“>OpenLayers.Layer</a>[] sublayers:

list of sublayers, which will appear in pullOWSContextdown menu

Optional

Arguments:
  • attributes (Object) –
    • {Object} base, img, title, active

    Optional

  • attributes.base (Boolean) –

    is this group base group?

    Optional

  • attributes.img (String) –

    any image, which should appear on the button

    Optional

  • attributes.title (String) –

    optionaly different title

    Optional

  • attributes.active (Boolean) –

    is this group active, at the beginning?

    Optional

HSLayers.Control.BoxLayerSwitcher.onGroupClicked(evt)

Handler for the click event on the button associated with the group

Arguments:
  • evt (Event) –
HSLayers.Control.BoxLayerSwitcher.onSublayerMouseOver(evt)
Handler for the mouseover event over the sublayer list. The list of

sublayers will appear

param Event evt:
 
HSLayers.Control.BoxLayerSwitcher.onSublayerMouseOut(evt)
Handler for the mouseout event over the list of sublayers. The list

of sublayers will disappear

param Event evt:
 
HSLayers.Control.BoxLayerSwitcher.onGroupMouseOver(evt)
Handler for the mouseover event over the group button. The list of

sublayers will appear

param Event evt:
 
HSLayers.Control.BoxLayerSwitcher.onGroupMouseOut(evt)
Handler for the mouseout event over the group button. The list of

sublayers will disappear

param Event evt:
 

Main Menu


Table Of Contents

Previous topic

HSLayers.Control.Attribution (class)

Next topic

HSLayers.Control.Click (class)

This Page