From 9b3eae2a126ba2e1b5b2d9dc2604259de0d78a0f Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 18 Feb 2019 16:12:26 +0100 Subject: [PATCH 1/4] Use undefined to check opacity value --- contribs/gmf/src/backgroundlayerselector/component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contribs/gmf/src/backgroundlayerselector/component.js b/contribs/gmf/src/backgroundlayerselector/component.js index f72c6f9d9d99..57d36868eac8 100644 --- a/contribs/gmf/src/backgroundlayerselector/component.js +++ b/contribs/gmf/src/backgroundlayerselector/component.js @@ -204,7 +204,7 @@ exports.Controller_.prototype.handleThemesChange_ = function() { * @export */ exports.Controller_.prototype.getSetBgLayerOpacity = function(val) { - if (val) { + if (val !== undefined) { this.opacityLayer.setOpacity(val); } return this.opacityLayer.getOpacity(); From 6e0a90af7b65e4e9cd522c642e00f4f7695e481a Mon Sep 17 00:00:00 2001 From: "arnaud.morvan@camptocamp.com" Date: Thu, 11 Apr 2019 15:43:15 +0200 Subject: [PATCH 2/4] In flush mode load current theme private groups on login --- .../src/controllers/AbstractAppController.js | 21 ++------------- contribs/gmf/src/theme/Manager.js | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/contribs/gmf/src/controllers/AbstractAppController.js b/contribs/gmf/src/controllers/AbstractAppController.js index a94cf848d70e..184d3cfda813 100644 --- a/contribs/gmf/src/controllers/AbstractAppController.js +++ b/contribs/gmf/src/controllers/AbstractAppController.js @@ -33,7 +33,6 @@ import olStyleFill from 'ol/style/Fill.js'; import olStyleStroke from 'ol/style/Stroke.js'; import olStyleStyle from 'ol/style/Style.js'; import gmfThemeManager from 'gmf/theme/Manager.js'; -import gmfThemeThemes from 'gmf/theme/Themes.js'; /** * Application abstract controller. @@ -191,7 +190,8 @@ const exports = function(config, $scope, $injector) { this.gmfThemes_.loadThemes(roleId); if (evt.type !== 'ready') { - this.updateCurrentTheme_(previousThemeName); + const themeName = this.permalink_.defaultThemeNameFromFunctionalities(); + this.gmfThemeManager.updateCurrentTheme(themeName, previousThemeName); } this.setDefaultBackground_(null); this.updateHasEditableLayers_(); @@ -737,23 +737,6 @@ exports.prototype.setDefaultBackground_ = function(theme) { }); }; -/** - * @param {string} fallbackThemeName fallback theme name. - * @private - */ -exports.prototype.updateCurrentTheme_ = function(fallbackThemeName) { - this.gmfThemes_.getThemesObject().then((themes) => { - const themeName = this.permalink_.defaultThemeNameFromFunctionalities(); - if (themeName) { - const theme = gmfThemeThemes.findThemeByName(themes, /** @type {string} */ (themeName)); - if (theme) { - this.gmfThemeManager.addTheme(theme, true); - } - } else { - this.gmfThemeManager.setThemeName(fallbackThemeName); - } - }); -}; /** * @protected diff --git a/contribs/gmf/src/theme/Manager.js b/contribs/gmf/src/theme/Manager.js index 239d42832a96..637590d579cf 100644 --- a/contribs/gmf/src/theme/Manager.js +++ b/contribs/gmf/src/theme/Manager.js @@ -107,6 +107,33 @@ exports.prototype.isLoading = function() { return !this.gmfThemes_.loaded; }; + +/** + * @param {string} themeName wanted theme name. + * @param {string} fallbackThemeName fallback theme name. + * @export + */ +exports.prototype.updateCurrentTheme = function(themeName, fallbackThemeName) { + this.gmfThemes_.getThemesObject().then((themes) => { + if (!themeName && this.modeFlush) { + // In flush mode load current theme private groups + const fallbackTheme = gmfThemeThemes.findThemeByName(themes, /** @type {string} */ (fallbackThemeName)); + if (fallbackTheme) { + this.gmfTreeManager_.addFirstLevelGroups(fallbackTheme.children, false, false); + } + } + if (themeName) { + const theme = gmfThemeThemes.findThemeByName(themes, /** @type {string} */ (themeName)); + if (theme) { + this.addTheme(theme, true); + } + } else { + this.setThemeName(fallbackThemeName); + } + }); +}; + + /** * @param {string} name The new theme name. * @param {boolean=} opt_silent Don't emit a theme change event, default is false. From 755f2ea886da7206d8e941df10ec618671a80df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Tue, 16 Apr 2019 15:19:58 +0200 Subject: [PATCH 3/4] Don't print QGIS layer legend URL at 300 DPI --- contribs/gmf/src/print/component.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contribs/gmf/src/print/component.js b/contribs/gmf/src/print/component.js index 08ef9a5677b9..b249b31ab8c7 100644 --- a/contribs/gmf/src/print/component.js +++ b/contribs/gmf/src/print/component.js @@ -1176,14 +1176,16 @@ exports.Controller_ = class { this.gmfLegendOptions_.params[layer.getSource().serverType_] ); } + const type = icons ? 'image' : source.serverType_; + // Don't add classes without legend url or from layers without any // active name. if (icons && name.length !== 0) { classes.push(Object.assign({ - 'name': this.gmfLegendOptions_.label[layer.getSource().serverType_] === false ? '' : + 'name': this.gmfLegendOptions_.label[type] === false ? '' : gettextCatalog.getString(name), 'icons': [icons] - }, layer.getSource().serverType_ === 'qgis' ? { + }, type === 'qgis' ? { 'dpi': dpi, } : {})); } From 3bb89cf57420dd595bf6339e8096d43a8a660a4a Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Fri, 26 Apr 2019 15:43:29 +0200 Subject: [PATCH 4/4] Update the rotation input from the map rotation events --- contribs/gmf/src/print/component.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/contribs/gmf/src/print/component.js b/contribs/gmf/src/print/component.js index b249b31ab8c7..5846f9769142 100644 --- a/contribs/gmf/src/print/component.js +++ b/contribs/gmf/src/print/component.js @@ -524,6 +524,11 @@ exports.Controller_ = class { * Init the controller */ $onInit() { + + olEvents.listen(this.map.getView(), 'change:rotation', (event) => { + this.updateRotation_(Math.round(olMath.toDegrees(event.target.getRotation()))); + }); + // Clear the capabilities if the roleId changes this.$scope_.$watch(() => this.gmfAuthenticationService_.getRoleId(), () => { this.gmfPrintState_.state = exports.PrintStateEnum.CAPABILITIES_NOT_LOADED; @@ -794,11 +799,7 @@ exports.Controller_ = class { * @param {number} rotation The optional new rotation value in degrees. */ setRotation(rotation) { - this.rotation = olMath.clamp(rotation, -180, 180); - - // sync all the inputs - this.rotationInput_.val(this.rotation.toString()); - + this.updateRotation_(rotation); // Render the map to update the postcompose mask or rotate the map. if (this.rotateMask) { this.map.render(); @@ -807,6 +808,15 @@ exports.Controller_ = class { } } + /** + * Set the current rotation value. + * @param {number} rotation The optional new rotation value in degrees. + */ + updateRotation_(rotation) { + this.rotation = olMath.clamp(rotation, -180, 180); + // sync all the inputs + this.rotationInput_.val(this.rotation.toString()); + } /** * Calculate the angle and the sense of rotation between two lines. One from the