Class: Group

Mapspace.layer. Group

Layer with a hierachical collection of vector layers that can be renderer in different ways depending if it is going to be used in Ortho, Oblique, Street or 3D viewers.

This way the same layer object can be referenced in several viewers of different types at the same time.

Note that any property set in the options is set as a ol.Object property on the layer object; for example, setting title: 'My Title' in the options means that title is observable, and has get/set accessors.


new Group( [options])

Parameters:
Name Type Argument Description
options Mapspace.layer.GroupOptions <optional>

Options.

Source:
mapspace/layer/group.js
Fires:
  • ol.render.event:Event

Extends

  • ol.layer.Group

Methods


addLayers(properties, opt_silent)

Parameters:
Name Type Argument Description
properties Mapspace.source.UserVectorLayerGroupProperties

Properties of layers to add.

opt_silent boolean <nullable>

Optional silent mode. Addition is made in silent mode for each push of layers, avoiding triggering an excess of events. Only a change event is triggered if any change is made. This mode has a problem: viewers listenLayer method must be call manually for each layer added to finalize the listening of layers added.

Source:
mapspace/layer/group.js

findGroup(path)

Finds the Mapspace.layer.Group with the given path.

Parameters:
Name Type Description
path string

Path with any pattern like a/b/c where a, b, and c are group IDs.

Source:
mapspace/layer/group.js
Returns:
Type
Mapspace.layer.Group

findLayer(path, name)

Finds the ol.layer.Base with the given path and name.

Parameters:
Name Type Argument Description
path string

Path with any pattern like a/b/c where a, b, and c are group IDs.

name string <nullable>

Name of layer inside the given path. If null then the layer group with path is returned. If not, a sublayer is searched.

Source:
mapspace/layer/group.js
Returns:
Type
ol.layer.Base

getExpanded()

Returns a expanded property that is not serializable.

Source:
mapspace/layer/group.js
Returns:
Type
boolean

getGroupID()

Returns the layer group ID for this layer. The layer group ID is a unique number that identifies each layer group in Mapspace server for all clients.

Source:
mapspace/layer/group.js
Returns:
Type
number

getSourceDefinitionOfLayer(path, name)

Returns a Mapspace.source.SourceDefinition with a Mapspace.source.UserVectorLayerGroupProperties for the layer in the given path and name. If the path and name are not found returns null. This function is useful to generate the source definition object needed to add a sublayer/subgroup to another layer group using addLayers.

Parameters:
Name Type Argument Description
path string

Path.

name string <nullable>

Name. When path is of a subgroup or the group itself, then name should be null.

Source:
mapspace/layer/group.js
Returns:
Type
Mapspace.source.SourceDefinition

getVisibleLayersArray( [opt_array])

Returns the array of ol.layer.Layer that can be visible. This requires that the layer itself is visible and that all the layer groups in the path of the layer are visible.

Parameters:
Name Type Argument Description
opt_array Array.<ol.layer.Layer> <optional>

Array of layers (to be modified in place).

Source:
mapspace/layer/group.js
Returns:

Array of layers.

Type
Array.<ol.layer.Layer>

setExpanded(expanded)

Saves an expanded property that is not serialized.

Parameters:
Name Type Description
expanded boolean

If layer group is expanded or not.

Source:
mapspace/layer/group.js

updateValues()

Traverses tree of layers and ensures that layer groups have the correct level and path observable values.

Source:
mapspace/layer/group.js