undefined

API Docs for: 5.4.2
Show:

LayerGroup Class

Imports RAMP Modules:

TmplHelper
Array
LayerItem

Uses RAMP Templates:

templates/layer_selector_template.json

Constructor

LayerGroup

(
  • layers
  • [options]
)
LayerGroup

Parameters:

  • layers Array

    an array of layer config definitions to be added to the group

  • [options] Object optional

    Additional options

    • [layerGroupType] String optional

      Specifies type of this LayerGroup and the name of the layer group template to use

    • [layerState] String optional

      Specifies the initial state of any LyerItem added to this group; must be one of the LayerItem.state defaults

    • [layerType] String optional

      Specifies type of any LayerItem added to this group and the name of the layer item template to use

    • [stateMatrix] Object optional

      additional state matrix records to be mixed into the default

    • [transitionMatrix] Object optional

      additional state transition matrix records to be mixed into the default

Returns:

LayerGroup:

A control object representing a group of layers allowing to dynamically change their states.

Methods

_constructStateMatrix

(
  • layerConfig
  • [stateMatrix]
)
Object private

Modifies the state matrix of the layer to accommodate types of layers that might not use/have all the default controls or have extra controls.

Parameters:

  • layerConfig Object

    layer config

  • [stateMatrix] Object optional

    optional stateMatrix

Returns:

Object:

modified layer state matrix

addLayerItem

(
  • layer
  • options
)
Object

Constructs and adds a LayerItem to the LayerGroup.

Parameters:

  • layer Object

    config of the layer to be added

  • options Object

    additional options allowing for customization

Returns:

Object:

the item that was added

getLayerItem

(
  • layerId
)
LayerItem

Finds and returns a LayerItem object with the specified id. If none found, returns null.

Parameters:

  • layerId String

    an id of the LayerItem to return

Returns:

LayerItem:

a LayerItem with the specified id

removeLayerItem

(
  • layerId
)
Object

Removes the specified LayerItem from the LayerGroup.

Parameters:

  • layerId String

    id of the layer to be removed

Returns:

Object:

this LayerGroup for chaining

setState

(
  • layerId
  • state
  • options
)

Constructs and adds a LayerItem to the LayerGroup.

Parameters:

  • layerId String

    an id of the LayerItem to set the state on

  • state String

    state to be set; must be one of the LayerItem.state defaults

  • options Object

    additional options allowing for customization

Properties

layerGroupType

String

Specifies type of this LayerGroup and the name of the layer group template to use; is set by layerGroupType value;

Default: 'layer_group'

layerItems

Array

An array of resulting LayerItem objects.

Default: []

node

JObject

A node of the LayerGroup.

Default: null

node

JObject private

A node of the list in the LayerGroup.

Default: null

state

String

State of any LayerItem added to this group during its initialization; is set by layerSate value; can be overwritten when adding individual layers by options.state.

Default: LayerItem.state.DEFAULT

templates

Object

Templates to be used in construction of the layer nodes.

Default: layer_selector_template.json

type

String

Specifies type of any LayerItem added to this group during initialization and the name of the layer item template to use; is set by layerType value;; can be overwritten when adding individual layers by options.type.

Default: null