Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.2] Background group name use a variable #3658

Merged
merged 1 commit into from
Mar 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.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.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.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.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.BACKGROUNDLAYERGROUP_NAME = 'background';