# Class LayertreeTreeManager

#### Hierarchy

- LayertreeTreeManager

- Defined in src/layertree/TreeManager.js:69

#####
Index

### Properties

$injector_
$timeout_
gettextCatalog_
gmfThemes_
groupsToAddInThisDigestLoop_
initialLevelFirstGroups_
layerHelper_
ngeoStateManager_
numberOfGroupsToAddInThisDigestLoop
ogcServers_
promiseForGroupsToAddInThisDigestLoop_
root
rootCtrl
rootScope_

### Methods

addFirstLevelGroup_
addFirstLevelGroups
addGroupByLayerName
addGroupByName
addSecondLevelGroups
getFirstLevelGroupFullState_
getOgcServer
getTreeCtrlByNodeId
handleThemesChange_
notifyCantAddGroups_
parseTreeNodes
refreshFirstLevelGroups_
removeAll
removeGroup
removePopup_
reorderChild_
setFirstLevelGroupFullState_
setFirstLevelGroups
setInitialFirstLevelGroups
setSearchedChild
toggleNodeCheck_
updateTreeGroupsState_

## Properties

### $injector_

$injector_: IInjectorService

- Defined in src/layertree/TreeManager.js:91

### $timeout_

$timeout_: ITimeoutService

- Defined in src/layertree/TreeManager.js:86

### gettextCatalog_

gettextCatalog_: gettextCatalog

- Defined in src/layertree/TreeManager.js:96

### gmfThemes_

gmfThemes_: any

- Defined in src/layertree/TreeManager.js:106

### groupsToAddInThisDigestLoop_

groupsToAddInThisDigestLoop_: any[]

- Defined in src/layertree/TreeManager.js:140

### initialLevelFirstGroups_

initialLevelFirstGroups_: any[]

- Defined in src/layertree/TreeManager.js:155
- Defined in src/layertree/TreeManager.js:306
- Defined in src/layertree/TreeManager.js:426

### layerHelper_

layerHelper_: LayerHelper

- Defined in src/layertree/TreeManager.js:101

### ngeoStateManager_

ngeoStateManager_: StatemanagerService

- Defined in src/layertree/TreeManager.js:150

### numberOfGroupsToAddInThisDigestLoop

numberOfGroupsToAddInThisDigestLoop: number

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

- Defined in src/layertree/TreeManager.js:135
- Defined in src/layertree/TreeManager.js:396
- Defined in src/layertree/TreeManager.js:408

### ogcServers_

ogcServers_: any

A reference to the OGC servers loaded by the theme service.

- Defined in src/layertree/TreeManager.js:162
- Defined in src/layertree/TreeManager.js:174

### promiseForGroupsToAddInThisDigestLoop_

promiseForGroupsToAddInThisDigestLoop_: IPromise<void>

- Defined in src/layertree/TreeManager.js:145
- Defined in src/layertree/TreeManager.js:406
- Defined in src/layertree/TreeManager.js:434

### root

root: any

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

- Defined in src/layertree/TreeManager.js:115

### rootCtrl

rootCtrl: LayertreeController

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

- Defined in src/layertree/TreeManager.js:126

### rootScope_

rootScope_: IScope

- Defined in src/layertree/TreeManager.js:81

## Methods

### addFirstLevelGroup_

- addFirstLevelGroup_(group: any): boolean

- Add a group as tree's children without consideration of this service 'mode'. Add it only if it's not already in the tree.

  ### Returns

  true if the group has been added.

  #### Parameters

  - ##### group: any

    The group to add.

  #### Returns boolean

  - Defined in src/layertree/TreeManager.js:372

### addFirstLevelGroups

- addFirstLevelGroups(firstLevelGroups: any[], opt_add?: boolean, opt_silent?: boolean): boolean

- 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.

  ### Returns

  True if the group has been added. False otherwise.

  #### Parameters

  - ##### firstLevelGroups: any[]

    An array of gmf theme group.

  - ##### `Optional` opt_add: boolean

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

  - ##### `Optional` opt_silent: boolean

    if true notifyCantAddGroups_ is not called.

  #### Returns boolean

  - Defined in src/layertree/TreeManager.js:214

### addGroupByLayerName

- addGroupByLayerName(layerName: string, opt_add?: boolean, opt_silent?: boolean): void

- 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

  - ##### layerName: string

    Name of the layer inside the group to add.

  - ##### `Optional` opt_add: boolean

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

  - ##### `Optional` opt_silent: boolean

    if true notifyCantAddGroups_ is not called

  #### Returns void

  - Defined in src/layertree/TreeManager.js:471

### addGroupByName

- addGroupByName(groupName: string, opt_add?: boolean): void

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

  #### Parameters

  - ##### groupName: string

    Name of the group to add.

  - ##### `Optional` opt_add: boolean

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

  #### Returns void

  - Defined in src/layertree/TreeManager.js:447

### addSecondLevelGroups

- addSecondLevelGroups(firstLevelGroups: any[], groupName: string, opt_add?: boolean, opt_silent?: boolean): boolean

- 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.

  NB: The first level group is added, second-level tree is set active when it corresponds to the searched group.

  ### Returns

  True if the group has been added. False otherwise.

  #### Parameters

  - ##### firstLevelGroups: any[]

    An array of gmf theme group.

  - ##### groupName: string

    The group's name to add.

  - ##### `Optional` opt_add: boolean

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

  - ##### `Optional` opt_silent: boolean

    if true notifyCantAddGroups_ is not called.

  #### Returns boolean

  - Defined in src/layertree/TreeManager.js:247

### getFirstLevelGroupFullState_

- getFirstLevelGroupFullState_(treeCtrl: LayertreeController): TreeManagerFullState

- Return a TreeManagerFullState that keeps the state of the given treeCtrl including the state of its children.

  ### Returns

  the fullState object.

  #### Parameters

  - ##### treeCtrl: LayertreeController

    the ngeo layertree controller to save.

  #### Returns TreeManagerFullState

  - Defined in src/layertree/TreeManager.js:716

### getOgcServer

- getOgcServer(treeCtrl: LayertreeController): any

- Get the OGC server.

  ### Returns

  The OGC server.

  #### Parameters

  - ##### treeCtrl: LayertreeController

    ngeo layertree controller, from the current node.

  #### Returns any

  - Defined in src/layertree/TreeManager.js:632

### getTreeCtrlByNodeId

- getTreeCtrlByNodeId(id: number): LayertreeController

- Get a treeCtrl based on it's node id.

  ### Returns

  treeCtrl The associated controller or null.

  #### Parameters

  - ##### id: number

    the id of a GMFThemesGroup or a GMFThemesLeaf.

  #### Returns LayertreeController

  - Defined in src/layertree/TreeManager.js:611

### handleThemesChange_

- handleThemesChange_(): void

- Called when the themes change. Get the OGC servers, then listen to the tree manager Layertree controllers array changes. The themes could have been changed so it also call a refresh of the layertree.

  #### Returns void

  - Defined in src/layertree/TreeManager.js:172

### notifyCantAddGroups_

- notifyCantAddGroups_(groups: any[]): void

- Display a notification that informs that the given groups are already in the tree.

  #### Parameters

  - ##### groups: any[]

    An array of groups that already in the tree.

  #### Returns void

  - Defined in src/layertree/TreeManager.js:586

### parseTreeNodes

- parseTreeNodes(node: any): void

- #### Parameters

  - ##### node: any

    Layer tree node to remove.

  #### Returns void

  - Defined in src/layertree/TreeManager.js:312

### refreshFirstLevelGroups_

- refreshFirstLevelGroups_(themes: any[]): void

- Keep the state of each existing first-level-groups in the layertree then remove it and recreate it with nodes that come from the new theme and the corresponding saved state (when possible, otherwise, juste take the corresponding new node). FIXME: Currently doesn't save nor restore the opacity.

  #### Parameters

  - ##### themes: any[]

    the array of themes to be based on.

  #### Returns void

  - Defined in src/layertree/TreeManager.js:665

### removeAll

- removeAll(): void

- Remove all groups.

  #### Returns void

  - Defined in src/layertree/TreeManager.js:531

### removeGroup

- removeGroup(group: any): void

- 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

  - ##### group: any

    The group to remove.

  #### Returns void

  - Defined in src/layertree/TreeManager.js:511

### removePopup_

- removePopup_(node: any): void

- #### Parameters

  - ##### node: any

    Layer tree node to remove.

  #### Returns void

  - Defined in src/layertree/TreeManager.js:330

### reorderChild_

- reorderChild_(array: any[], old_index: number, new_index: number): void

- #### Parameters

  - ##### array: any[]

    An array of groups.

  - ##### old_index: number

    The old index before reorder (the current one).

  - ##### new_index: number

    The new index after reorder.

  #### Returns void

  - Defined in src/layertree/TreeManager.js:341

### setFirstLevelGroupFullState_

- setFirstLevelGroupFullState_(treeCtrl: LayertreeController, fullState: TreeManagerFullState): void

- Restore state of the given treeCtrl including the state of its children from passed TreeManagerFullState.

  #### Parameters

  - ##### treeCtrl: LayertreeController

    the ngeo layertree controller.

  - ##### fullState: TreeManagerFullState

    the fullState object.

  #### Returns void

  - Defined in src/layertree/TreeManager.js:763

### setFirstLevelGroups

- setFirstLevelGroups(firstLevelGroups: any[]): boolean

- 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.

  ### Returns

  True if the group has been added. False otherwise.

  #### Parameters

  - ##### firstLevelGroups: any[]

    An array of gmf theme group.

  #### Returns boolean

  - Defined in src/layertree/TreeManager.js:192

### setInitialFirstLevelGroups

- setInitialFirstLevelGroups(firstGroups: any[]): void

- #### Parameters

  - ##### firstGroups: any[]

    The groups we add to the layertree

  #### Returns void

  - Defined in src/layertree/TreeManager.js:305

### setSearchedChild

- setSearchedChild(node: any, enabled: boolean): void

- Enable/disable the tree child (node) and apply it to children if present.

  #### Parameters

  - ##### node: any

    The child object in the tree.

  - ##### enabled: boolean

    If the child is active or not in the layer-tree.

  #### Returns void

  - Defined in src/layertree/TreeManager.js:291

### toggleNodeCheck_

- toggleNodeCheck_(node: any, names: string[]): void

- Set the child nodes metadata `isChecked` if its name is among the list of given names. If a child node also has children, check those instead.

  #### Parameters

  - ##### node: any

    The original node.

  - ##### names: string[]

    Array of node names to check (i.e. that should have their checkbox checked)

  #### Returns void

  - Defined in src/layertree/TreeManager.js:564

### updateTreeGroupsState_

- updateTreeGroupsState_(groups: any[], removedGroups: any[]): void

- Update the application state with the list of first level groups in the tree.

  #### Parameters

  - ##### groups: any[]

    current firstlevel groups of the tree.

  - ##### removedGroups: any[]

    groups removed within this operation.

  #### Returns void

  - Defined in src/layertree/TreeManager.js:351

Generated using TypeDoc