From 8839352d29f5816dcede317c6fcdc30bb316d281 Mon Sep 17 00:00:00 2001 From: Laurent Lienher Date: Wed, 14 Mar 2018 15:08:55 +0100 Subject: [PATCH] Background group name use a variable --- contribs/gmf/src/gmf.js | 6 ------ src/services/backgroundlayermgr.js | 15 +++++++++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/contribs/gmf/src/gmf.js b/contribs/gmf/src/gmf.js index 200d7d090953..ecf7a252a4ae 100644 --- a/contribs/gmf/src/gmf.js +++ b/contribs/gmf/src/gmf.js @@ -40,12 +40,6 @@ gmf.module.config(['$animateProvider', */ gmf.baseTemplateUrl = 'gmf'; -/** - * @const - * @export - */ -gmf.BACKGROUNDLAYERGROUP_NAME = 'background'; - /** * @const * @export diff --git a/src/services/backgroundlayermgr.js b/src/services/backgroundlayermgr.js index d8c225e208cc..68f64ac1fea6 100644 --- a/src/services/backgroundlayermgr.js +++ b/src/services/backgroundlayermgr.js @@ -126,7 +126,8 @@ ol.inherits(ngeo.BackgroundLayerMgr, ol.Observable); */ ngeo.BackgroundLayerMgr.prototype.get = function(map) { const mapUid = ol.getUid(map).toString(); - return mapUid in this.mapUids_ ? this.ngeoLayerHelper_.getGroupFromMap(map, gmf.BACKGROUNDLAYERGROUP_NAME).getLayers().item(0) : null; + return mapUid in this.mapUids_ ? this.ngeoLayerHelper_.getGroupFromMap(map, + ngeo.BackgroundLayerMgr.prototype.BACKGROUNDLAYERGROUP_NAME).getLayers().item(0) : null; }; @@ -147,7 +148,7 @@ ngeo.BackgroundLayerMgr.prototype.set = function(map, layer) { this.ngeoLayerHelper_.setZIndexToFirstLevelChildren(layer, ZIndex); } - const bgGroup = this.ngeoLayerHelper_.getGroupFromMap(map, gmf.BACKGROUNDLAYERGROUP_NAME); + const bgGroup = this.ngeoLayerHelper_.getGroupFromMap(map, ngeo.BackgroundLayerMgr.prototype.BACKGROUNDLAYERGROUP_NAME); if (previous !== null) { goog.asserts.assert(mapUid in this.mapUids_); @@ -176,7 +177,8 @@ ngeo.BackgroundLayerMgr.prototype.set = function(map, layer) { */ ngeo.BackgroundLayerMgr.prototype.getOpacityBgLayer = function(map) { const mapUid = ol.getUid(map).toString(); - return mapUid in this.mapUids_ ? this.ngeoLayerHelper_.getGroupFromMap(map, gmf.BACKGROUNDLAYERGROUP_NAME).getLayers().item(1) : null; + return mapUid in this.mapUids_ ? this.ngeoLayerHelper_.getGroupFromMap(map, + ngeo.BackgroundLayerMgr.prototype.BACKGROUNDLAYERGROUP_NAME).getLayers().item(1) : null; }; /** @@ -190,7 +192,7 @@ ngeo.BackgroundLayerMgr.prototype.setOpacityBgLayer = function(map, layer) { layer.setVisible(true); layer.setZIndex(ZIndex); this.ngeoLayerHelper_.setZIndexToFirstLevelChildren(layer, ZIndex); - const bgGroup = this.ngeoLayerHelper_.getGroupFromMap(map, gmf.BACKGROUNDLAYERGROUP_NAME); + const bgGroup = this.ngeoLayerHelper_.getGroupFromMap(map, ngeo.BackgroundLayerMgr.prototype.BACKGROUNDLAYERGROUP_NAME); const index = bgGroup.getLayers().getArray().indexOf(layer); if (index === -1) { @@ -241,3 +243,8 @@ ngeo.BackgroundLayerMgr.prototype.updateDimensions = function(map, dimensions) { ngeo.module.service('ngeoBackgroundLayerMgr', ngeo.BackgroundLayerMgr); + +/** + * @const + */ +ngeo.BackgroundLayerMgr.prototype.BACKGROUNDLAYERGROUP_NAME = 'background';