Class: LayerControl

OM.control. LayerControl


new LayerControl(options)

The LayerControl class
A LayerControl is a map decoration used to list the currently displayed map layers and optionally show or hide them.

Parameters:
Name Type Description
options Object

An object, or literal, with the following attributes.


  • anchorPosition {int} Specify where a collapsed layer control will be docked,
    as well as where the docker icon is positioned.
    A set of 6 predefined positions for the panel. The 6 values are: 1--upper left,2--upper center,
    3--upper right,4--lower left,5--lower center,6--lower right

  • offsetX {int} in pixels to the dock icon

  • offsetY {int} in pixels to the dock icon

  • layerDeleteEnable {boolean} true:the delete icon will show up when a vector is highlighted. The default value is false.

  • contentStyle {Object} Specifies the minimum width and maximum height of the panel, and the font used to display the
    layer names. This object has the following attributes:

    • minWidth {int} The minimum width of the panel (in pixels)

    • maxHeight {int} The maximum height of the panel (in pixels)

    • font_size (int} Font size in points

    • font_family {String} Font family name (e.g. Arial)



  • titleStyle {Object} Specify the font to use for the title text.
    This object has the folowing attributes:

    • font_size (int} Font size in points

    • font_family {String} Font family name (e.g. Arial)



Returns:

An instance of OM.control.LayerControl

Extends

Methods


isVisible()

Get the visibility of the decoration.

Inherited From:
Returns:

True if the decoration is currently visible,
False if the decoration is currently not visible.

Type
Boolean

on()

A shorthand name for the member function addListener.

Inherited From:
Mixes In:

setDraggable()

Set whether the decoration should be draggable

Parameters:
Name Type Description
draggable. Boolean

True if draggable, false if not.

Inherited From:
Returns:
Type
void

setPosition(offsetX, offsetY)

Set the map decoration position

Parameters:
Name Type Description
offsetX Float

in pixels to the dock icon if the value is greater than 1, or percentage if it is less than 1.

offsetY Float

in pixels to the dock icon if the value is greater than 1, or percentage if it is less than 1.

Inherited From:
Returns:
Type
void

setSize(width, height)

Set the map decoration size

Parameters:
Name Type Description
width int
height int
Inherited From:
Returns:
Type
void

setVisible(visible)

Set the visibility.

Parameters:
Name Type Description
visible Boolean

True if visible, false if not.

Inherited From:
Returns:
Type
void