Class: TreeManager service:gmfTreeManager

gmf.layertree.TreeManager

new TreeManager($timeout, $injector, gettextCatalog, ngeoLayerHelper, ngeoNotification, gmfThemes, ngeoStateManager)

Manage a tree with children. This service can be used in mode 'flush' (default) or not (mode 'add'). In mode 'flush', each theme, group or group by layer that you add will replace the previous children's array. In mode 'add', children will be just pushed in this array. The default state can be changed by setting the value gmfTreeManagerModeFlush, e.g.:

let module = angular.module('app');
module.value('gmfTreeManagerModeFlush', false);

This service's theme is a GmfTheme with only children and a name. Thought to be the tree source of the gmf layertree directive.

Parameters:
Name Type Description
$timeout angular.$timeout

Angular timeout service.

$injector angular.$injector

Angular injector service.

gettextCatalog angularGettext.Catalog

Gettext catalog.

ngeoLayerHelper ngeo.map.LayerHelper

Ngeo Layer Helper.

ngeoNotification ngeo.message.Notification

Ngeo notification service.

gmfThemes gmf.theme.Themes

gmf Themes service.

ngeoStateManager ngeo.statemanager.Service

The ngeo statemanager service.

Members

(static, non-null) module: angular.Module

numberOfGroupsToAddInThisDigestLoop: number

Number of groups to add to the layertree during one single Angular digest loop.

root: gmfThemes.GmfRootNode

The root node and its children used to generate the layertree (with the same ordre).

rootCtrl: ngeo.layertree.Controller

The controller of the (unique) root layer tree. The array of top level layer trees is avaible through rootCtrl.children. The order doesn't match with the ordre of the displayed layertree.

Methods

addFirstLevelGroups(firstLevelGroups, [opt_add]opt, [opt_silent]opt)

Add some groups as tree's children. If the service use mode 'flush', the previous tree's children will be removed. Add only groups that are not already in the tree.

Parameters:
Name Type Attributes Description
firstLevelGroups Array.

An array of gmf theme group.

[opt_add] boolean= <optional>

if true, force to use the 'add' mode this time.

[opt_silent] boolean= <optional>

if true notifyCantAddGroups_ is not called.

addGroupByLayerName(layerName, [opt_add]opt, [opt_silent]opt)

Retrieve a group by the name of a layer that is contained in this group (first found). This group will be added in the tree. Do nothing if any corresponding group is found.

Parameters:
Name Type Attributes Description
layerName string

Name of the layer inside the group to add.

[opt_add] boolean= <optional>

if true, force to use the 'add' mode this time.

[opt_silent] boolean= <optional>

if true notifyCantAddGroups_ is not called

addGroupByName(groupName, [opt_add]opt)

Retrieve a group (first found) by its name and add in the tree. Do nothing if any corresponding group is found.

Parameters:
Name Type Attributes Description
groupName string

Name of the group to add.

[opt_add] boolean= <optional>

if true, force to use the 'add' mode this time.

getOgcServer(treeCtrl)

Get the OGC server.

Parameters:
Name Type Description
treeCtrl ngeo.layertree.Controller

ngeo layertree controller, from the current node.

Returns:
gmfThemes.GmfOgcServer

The OGC server.

getTreeCtrlByNodeId(id)

Get a treeCtrl based on it's node id.

Parameters:
Name Type Description
id number

the id of a GMFThemesGroup or a GMFThemesLeaf.

Returns:
ngeo.layertree.Controller?

treeCtrl The associated controller or null.

removeAll()

Remove all groups.

removeGroup(group)

Remove a group from this tree's children. The first group that is found ( based on its name) will be removed. If any is found, nothing will append.

Parameters:
Name Type Description
group gmfThemes.GmfGroup

The group to remove.

setFirstLevelGroups(firstLevelGroups)

Set some groups as tree's children. If the service use mode 'flush', the previous tree's children will be removed. Add only groups that are not already in the tree.

Parameters:
Name Type Description
firstLevelGroups Array.

An array of gmf theme group.

Returns:
boolean

True if the group has been added. False otherwise.