/** * @typedef {Object} TreeManagerFullState * @property {Object} [children] * @property {boolean|undefined} [isChecked] * @property {boolean|undefined} [isExpanded] * @property {boolean|undefined} [isLegendExpanded] */ /** * 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. * * @class * @param {angular.IScope} $rootScope Angular rootScope. * @param {angular.ITimeoutService} $timeout Angular timeout service. * @param {angular.auto.IInjectorService} $injector Angular injector service. * @param {angular.gettext.gettextCatalog} gettextCatalog Gettext catalog. * @param {import('ngeo/map/LayerHelper').LayerHelper} ngeoLayerHelper Ngeo Layer Helper. * @param {import('gmf/theme/Themes').ThemesService} gmfThemes gmf Themes service. * @param {import('ngeo/statemanager/Service').StatemanagerService} ngeoStateManager The ngeo * statemanager service. * @ngdoc service * @ngname gmfTreeManager * @hidden */ export function LayertreeTreeManager($rootScope: angular.IScope, $timeout: angular.ITimeoutService, $injector: angular.auto.IInjectorService, gettextCatalog: angular.gettext.gettextCatalog, ngeoLayerHelper: import("ngeo/map/LayerHelper").LayerHelper, gmfThemes: import("gmf/theme/Themes").ThemesService, ngeoStateManager: import("ngeo/statemanager/Service").StatemanagerService): void; export class LayertreeTreeManager { /** * @typedef {Object} TreeManagerFullState * @property {Object} [children] * @property {boolean|undefined} [isChecked] * @property {boolean|undefined} [isExpanded] * @property {boolean|undefined} [isLegendExpanded] */ /** * 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. * * @class * @param {angular.IScope} $rootScope Angular rootScope. * @param {angular.ITimeoutService} $timeout Angular timeout service. * @param {angular.auto.IInjectorService} $injector Angular injector service. * @param {angular.gettext.gettextCatalog} gettextCatalog Gettext catalog. * @param {import('ngeo/map/LayerHelper').LayerHelper} ngeoLayerHelper Ngeo Layer Helper. * @param {import('gmf/theme/Themes').ThemesService} gmfThemes gmf Themes service. * @param {import('ngeo/statemanager/Service').StatemanagerService} ngeoStateManager The ngeo * statemanager service. * @ngdoc service * @ngname gmfTreeManager * @hidden */ constructor($rootScope: angular.IScope, $timeout: angular.ITimeoutService, $injector: angular.auto.IInjectorService, gettextCatalog: angular.gettext.gettextCatalog, ngeoLayerHelper: import("ngeo/map/LayerHelper").LayerHelper, gmfThemes: import("gmf/theme/Themes").ThemesService, ngeoStateManager: import("ngeo/statemanager/Service").StatemanagerService); /** * @type {angular.IScope} */ rootScope_: angular.IScope; /** * @type {angular.ITimeoutService} */ $timeout_: angular.ITimeoutService; /** * @type {angular.auto.IInjectorService} */ $injector_: angular.auto.IInjectorService; /** * @type {angular.gettext.gettextCatalog} */ gettextCatalog_: angular.gettext.gettextCatalog; /** * @type {import('ngeo/map/LayerHelper').LayerHelper} */ layerHelper_: import("ngeo/map/LayerHelper").LayerHelper; /** * @type {import('gmf/theme/Themes').ThemesService} */ gmfThemes_: import("gmf/theme/Themes").ThemesService; /** * The root node and its children used to generate the layertree (with the * same ordre). * * @type {import('gmf/themes').GmfRootNode} * @public */ public root: import("gmf/themes").GmfRootNode; /** * 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. * * @type {?import('ngeo/layertree/Controller').LayertreeController} */ rootCtrl: import("ngeo/layertree/Controller").LayertreeController | null; /** * Number of groups to add to the layertree during one single Angular * digest loop. * * @type {number} * @public */ public numberOfGroupsToAddInThisDigestLoop: number; /** * @type {import('gmf/themes').GmfGroup[]} */ groupsToAddInThisDigestLoop_: import("gmf/themes").GmfGroup[]; /** * @type {?angular.IPromise} */ promiseForGroupsToAddInThisDigestLoop_: angular.IPromise | null; /** * @type {import('ngeo/statemanager/Service').StatemanagerService} */ ngeoStateManager_: import("ngeo/statemanager/Service").StatemanagerService; /** * @type {import('gmf/themes').GmfGroup[] | undefined} */ initialLevelFirstGroups_: import("gmf/themes").GmfGroup[] | undefined; /** * A reference to the OGC servers loaded by the theme service. * * @type {?import('gmf/themes').GmfOgcServers} */ ogcServers_: import("gmf/themes").GmfOgcServers | null; /** * 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. */ handleThemesChange_(): void; /** * 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. * * @param {import('gmf/themes').GmfGroup[]} firstLevelGroups An array of gmf theme group. * @returns {boolean} True if the group has been added. False otherwise. */ setFirstLevelGroups(firstLevelGroups: import("gmf/themes").GmfGroup[]): 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. * * @param {import('gmf/themes').GmfGroup[]} firstLevelGroups An array of gmf theme * group. * @param {boolean} [opt_add] if true, force to use the 'add' mode this time. * @param {boolean} [opt_silent] if true notifyCantAddGroups_ is not called. * @returns {boolean} True if the group has been added. False otherwise. */ addFirstLevelGroups(firstLevelGroups: import("gmf/themes").GmfGroup[], 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. * * @param {import('gmf/themes').GmfGroup[]} firstLevelGroups An array of gmf theme group. * @param {string} groupName The group's name to add. * @param {boolean} [opt_add] if true, force to use the 'add' mode this time. * @param {boolean} [opt_silent] if true notifyCantAddGroups_ is not called. * @returns {boolean} True if the group has been added. False otherwise. */ addSecondLevelGroups(firstLevelGroups: import("gmf/themes").GmfGroup[], groupName: string, opt_add?: boolean, opt_silent?: boolean): boolean; /** * Enable/disable the tree child (node) and apply it to children if present. * * @param {import('gmf/themes').GmfGroup} node The child object in the tree. * @param {boolean} enabled If the child is active or not in the layer-tree. */ setSearchedChild(node: import("gmf/themes").GmfGroup, enabled: boolean): void; /** * @param {import('gmf/themes').GmfGroup[]} firstGroups The groups we add to the layertree */ setInitialFirstLevelGroups(firstGroups: import("gmf/themes").GmfGroup[]): void; /** * @param {import('gmf/themes').GmfGroup | import('gmf/themes').GmfLayer | import('gmf/themes').GmfRootNode} node Layer tree node to remove. */ parseTreeNodes(node: import("gmf/themes").GmfGroup | import("gmf/themes").GmfLayer | import("gmf/themes").GmfRootNode): void; /** * @param {import('gmf/themes').GmfGroup} node Layer tree node to remove. */ removePopup_(node: import("gmf/themes").GmfGroup): void; /** * @param {import('gmf/themes').GmfGroup[]} array An array of groups. * @param {number} old_index The old index before reorder (the current one). * @param {number} new_index The new index after reorder. */ reorderChild_(array: import("gmf/themes").GmfGroup[], old_index: number, new_index: number): void; /** * Update the application state with the list of first level groups in the tree. * * @param {import('gmf/themes').GmfGroup[]} groups current firstlevel groups of the tree. * @param {import('gmf/themes').GmfGroup[]} removedGroups groups removed within this operation. */ updateTreeGroupsState_(groups: import("gmf/themes").GmfGroup[], removedGroups: import("gmf/themes").GmfGroup[]): void; /** * Add a group as tree's children without consideration of this service 'mode'. * Add it only if it's not already in the tree. * * @param {import('gmf/themes').GmfGroup} group The group to add. * @returns {boolean} true if the group has been added. */ addFirstLevelGroup_(group: import("gmf/themes").GmfGroup): boolean; /** * Retrieve a group (first found) by its name and add in the tree. Do nothing * if any corresponding group is found. * * @param {string} groupName Name of the group to add. * @param {boolean} [opt_add] if true, force to use the 'add' mode this time. */ addGroupByName(groupName: string, opt_add?: 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. * * @param {string} layerName Name of the layer inside the group to add. * @param {boolean} [opt_add] if true, force to use the 'add' mode this time. * @param {boolean} [opt_silent] if true notifyCantAddGroups_ is not called */ addGroupByLayerName(layerName: string, opt_add?: boolean, opt_silent?: boolean): 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. * * @param {import('gmf/themes').GmfGroup} group The group to remove. */ removeGroup(group: import("gmf/themes").GmfGroup): void; /** * Remove all groups. */ removeAll(): void; private cloneGroupNode_; /** * 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. * * @param {import('gmf/themes').GmfGroup|import('gmf/themes').GmfLayer} node The original node. * @param {string[]} names Array of node names to check (i.e. that * should have their checkbox checked) */ toggleNodeCheck_(node: import("gmf/themes").GmfGroup | import("gmf/themes").GmfLayer, names: string[]): void; /** * Display a notification that informs that the given groups are already in the * tree. * * @param {import('gmf/themes').GmfGroup[]} groups An array of groups that already in * the tree. */ notifyCantAddGroups_(groups: import("gmf/themes").GmfGroup[]): void; /** * Get a treeCtrl based on it's node id. * * @param {number} id the id of a GMFThemesGroup or a GMFThemesLeaf. * @returns {import('ngeo/layertree/Controller').LayertreeController?} treeCtrl The associated controller * or null. * @public */ public getTreeCtrlByNodeId(id: number): import("ngeo/layertree/Controller").LayertreeController | null; /** * Get the OGC server. * * @param {import('ngeo/layertree/Controller').LayertreeController} treeCtrl ngeo layertree controller, * from the current node. * @returns {import('gmf/themes').GmfOgcServer} The OGC server. */ getOgcServer(treeCtrl: import("ngeo/layertree/Controller").LayertreeController): import("gmf/themes").GmfOgcServer; /** * 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. * * @param {import('gmf/themes').GmfTheme[]} themes the array of themes to be based on. */ refreshFirstLevelGroups_(themes: import("gmf/themes").GmfTheme[]): void; /** * Return a TreeManagerFullState that keeps the state of the given * treeCtrl including the state of its children. * * @param {import('ngeo/layertree/Controller').LayertreeController} treeCtrl the ngeo layertree * controller to save. * @returns {TreeManagerFullState} the fullState object. */ getFirstLevelGroupFullState_(treeCtrl: import("ngeo/layertree/Controller").LayertreeController): TreeManagerFullState; /** * Restore state of the given treeCtrl including the state of its children from passed TreeManagerFullState. * * @param {import("ngeo/layertree/Controller.js").LayertreeController} treeCtrl the ngeo layertree controller. * @param {TreeManagerFullState|undefined} fullState the fullState object. */ setFirstLevelGroupFullState_(treeCtrl: import("ngeo/layertree/Controller.js").LayertreeController, fullState: TreeManagerFullState | undefined): void; } export namespace LayertreeTreeManager { let $inject: string[]; } export default myModule; export type TreeManagerFullState = { children?: { [x: string]: TreeManagerFullState; }; isChecked?: boolean | undefined; isExpanded?: boolean | undefined; isLegendExpanded?: boolean | undefined; }; import angular from 'angular'; /** * @type {angular.IModule} * @hidden */ declare const myModule: angular.IModule;