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

Merge remote-tracking branch 'origin/2.3' into 2.4 #4925

Merged
merged 7 commits into from
Jun 5, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion contribs/gmf/src/controllers/AbstractAppController.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export function AbstractAppController(config, map, $scope, $injector) {

if (evt.type !== 'ready') {
const themeName = this.permalink_.defaultThemeNameFromFunctionalities();
this.gmfThemeManager.updateCurrentTheme(themeName, previousThemeName);
this.gmfThemeManager.updateCurrentTheme(themeName, previousThemeName, true);
}
this.setDefaultBackground_(null);
this.updateHasEditableLayers_();
Expand Down
1 change: 1 addition & 0 deletions contribs/gmf/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const COORDINATES_LAYER_NAME = 'gmfCoordinatesLayerName';
*/
export const PermalinkParam = {
BG_LAYER: 'baselayer_ref',
BG_LAYER_OPACITY: 'baselayer_opacity',
EXTERNAL_DATASOURCES_NAMES: 'eds_n',
EXTERNAL_DATASOURCES_URLS: 'eds_u',
FEATURES: 'rl_features',
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/layertree/TreeManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ LayertreeTreeManager.prototype.setFirstLevelGroups = function(firstLevelGroups)
* 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.
* @return{boolean} True if the group has been added. False otherwise.
* @return {boolean} True if the group has been added. False otherwise.
*/
LayertreeTreeManager.prototype.addFirstLevelGroups = function(firstLevelGroups,
opt_add, opt_silent) {
Expand Down
42 changes: 38 additions & 4 deletions contribs/gmf/src/permalink/Permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,8 @@ export function PermalinkService(
this.ngeoBackgroundLayerMgr_,
'change',
this.handleBackgroundLayerManagerChange_,
this);
this
);
}

// visibility
Expand Down Expand Up @@ -843,7 +844,6 @@ PermalinkService.prototype.setMap = function(map) {
this.registerMap_(map, null);
}
}

};


Expand Down Expand Up @@ -940,8 +940,7 @@ PermalinkService.prototype.unregisterMap_ = function() {


/**
* Get the background layer object to use to initialize the map from the
* state manager.
* Get the background layer object to use to initialize the map from the state manager.
* @param {!Array.<!import("ol/layer/Base.js").default>} layers Array of background layer objects.
* @return {?import("ol/layer/Base.js").default} Background layer.
*/
Expand All @@ -958,6 +957,16 @@ PermalinkService.prototype.getBackgroundLayer = function(layers) {
};


/**
* Get the background layer opacity to use to initialize the map from the state manager.
* @return {number} Opacity.
*/
PermalinkService.prototype.getBackgroundLayerOpacity = function() {
const opacity_ = this.ngeoStateManager_.getInitialNumberValue(PermalinkParam.BG_LAYER_OPACITY);
return opacity_ === undefined ? undefined : opacity_ / 100;
};


/**
* Called when the background layer changes. Update the state using the
* background layer label, i.e. its name.
Expand All @@ -978,6 +987,31 @@ PermalinkService.prototype.handleBackgroundLayerManagerChange_ = function() {
const object = {};
object[PermalinkParam.BG_LAYER] = layerName;
this.ngeoStateManager_.updateState(object);

const backgroundLayer = this.ngeoBackgroundLayerMgr_.getOpacityBgLayer(this.map_);
if (backgroundLayer) {
const opacity = this.getBackgroundLayerOpacity();
if (opacity !== undefined) {
backgroundLayer.setOpacity(opacity);
} else {
const opacity = backgroundLayer.getOpacity();
/** @type {Object<string, string>} */
const object = {};
object[PermalinkParam.BG_LAYER_OPACITY] = `${opacity * 100}`;
this.ngeoStateManager_.updateState(object);
}
olEvents.listen(
backgroundLayer,
'change:opacity',
() => {
const opacity = backgroundLayer.getOpacity();
/** @type {Object<string, string>} */
const object = {};
object[PermalinkParam.BG_LAYER_OPACITY] = `${opacity * 100}`;
this.ngeoStateManager_.updateState(object);
}
);
}
};


Expand Down
9 changes: 8 additions & 1 deletion contribs/gmf/src/query/window.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ div.ngeo-displaywindow {
flex-direction: column;
width: 100%;
height: 100%;
padding: $app-margin;
text-align: left;
white-space: nowrap;
overflow: hidden;
Expand All @@ -76,6 +75,14 @@ div.ngeo-displaywindow {
.content-template-container {
overflow: auto;
}
.header {
padding: $app-margin $app-margin 0 $app-margin;
}
.details {
padding: 0 $app-margin $app-margin $app-margin;
// small margin so that the scrollbar and the window resize are not in conflict.
margin-right: $half-app-margin;
}
}
}
.animation-container-detailed {
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/query/windowComponent.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
ng-animate-swap="ctrl.animate"
class="slide-animation gmf-animatable">

<div class="header">
<div class="header ui-draggable-handle">
<p
class="title"
>{{ctrl.source.label | translate}}</p>
Expand Down
13 changes: 7 additions & 6 deletions contribs/gmf/src/query/windowComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,15 @@ QueryWindowController.prototype.$onInit = function() {
}
highlightFeaturesOverlay.setStyle(highlightFeatureStyle);

const windowContainer = this.element_.find('.gmf-displayquerywindow .windowcontainer');
if (this.desktop) {
this.element_.find('.gmf-displayquerywindow .windowcontainer').draggable({
'cancel': 'input,textarea,button,select,option,tr',
'containment': this.draggableContainment
windowContainer.draggable({
handle: '.header',
containment: this.draggableContainment
});
this.element_.find('.gmf-displayquerywindow .windowcontainer').resizable({
'minHeight': 240,
'minWidth': 240
windowContainer.resizable({
minHeight: 240,
minWidth: 240
});
}
};
Expand Down
5 changes: 3 additions & 2 deletions contribs/gmf/src/theme/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,16 @@ ThemeManagerService.prototype.isLoading = function() {
/**
* @param {string} themeName wanted theme name.
* @param {string} fallbackThemeName fallback theme name.
* @param {boolean=} opt_silent if true notifyCantAddGroups_ is not called.
* @export
*/
ThemeManagerService.prototype.updateCurrentTheme = function(themeName, fallbackThemeName) {
ThemeManagerService.prototype.updateCurrentTheme = function(themeName, fallbackThemeName, opt_silent) {
this.gmfThemes_.getThemesObject().then((themes) => {
if (!themeName && this.modeFlush) {
// In flush mode load current theme private groups
const fallbackTheme = findThemeByName(themes, fallbackThemeName);
if (fallbackTheme) {
this.gmfTreeManager_.addFirstLevelGroups(fallbackTheme.children, false, false);
this.gmfTreeManager_.addFirstLevelGroups(fallbackTheme.children, false, opt_silent);
}
}
if (themeName) {
Expand Down
6 changes: 1 addition & 5 deletions src/statemanager/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ StatemanagerService.prototype.getInitialValue = function(key) {
* @return {string|undefined} State value.
*/
StatemanagerService.prototype.getInitialStringValue = function(key) {
const value = this.initialState[key];
if (value === undefined) {
return undefined;
}
return value;
return this.initialState[key];
};


Expand Down