Skip to content

Commit

Permalink
Background group name use a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
llienher committed Mar 15, 2018
1 parent aac04a6 commit 8839352
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 0 additions & 6 deletions contribs/gmf/src/gmf.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ gmf.module.config(['$animateProvider',
*/
gmf.baseTemplateUrl = 'gmf';

/**
* @const
* @export
*/
gmf.BACKGROUNDLAYERGROUP_NAME = 'background';

/**
* @const
* @export
Expand Down
15 changes: 11 additions & 4 deletions src/services/backgroundlayermgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};


Expand All @@ -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_);
Expand Down Expand Up @@ -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;
};

/**
Expand All @@ -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) {
Expand Down Expand Up @@ -241,3 +243,8 @@ ngeo.BackgroundLayerMgr.prototype.updateDimensions = function(map, dimensions) {


ngeo.module.service('ngeoBackgroundLayerMgr', ngeo.BackgroundLayerMgr);

/**
* @const
*/
ngeo.BackgroundLayerMgr.prototype.BACKGROUNDLAYERGROUP_NAME = 'background';

0 comments on commit 8839352

Please sign in to comment.