From 974d131f248d29ef32ca158bec80c49b1386988b Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 4 Dec 2018 15:00:57 +0100 Subject: [PATCH 1/4] Remove (left|right)NavIsVisible function And use the variables directly. --- contribs/gmf/apps/mobile/index.html.ejs | 4 ++-- contribs/gmf/apps/mobile_alt/index.html.ejs | 4 ++-- .../controllers/AbstractMobileController.js | 20 ------------------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/contribs/gmf/apps/mobile/index.html.ejs b/contribs/gmf/apps/mobile/index.html.ejs index 0bdc2df9e05f..afd80331a7fe 100644 --- a/contribs/gmf/apps/mobile/index.html.ejs +++ b/contribs/gmf/apps/mobile/index.html.ejs @@ -15,8 +15,8 @@ + 'gmf-mobile-nav-left-is-visible': mainCtrl.leftNavVisible, + 'gmf-mobile-nav-right-is-visible': mainCtrl.rightNavVisible}">
  diff --git a/contribs/gmf/apps/mobile_alt/index.html.ejs b/contribs/gmf/apps/mobile_alt/index.html.ejs index c50ca189527b..c4f013e80c14 100644 --- a/contribs/gmf/apps/mobile_alt/index.html.ejs +++ b/contribs/gmf/apps/mobile_alt/index.html.ejs @@ -14,8 +14,8 @@ <% } %> + 'gmf-mobile-nav-left-is-visible': mainCtrl.leftNavVisible, + 'gmf-mobile-nav-right-is-visible': mainCtrl.rightNavVisible}">
  diff --git a/contribs/gmf/src/controllers/AbstractMobileController.js b/contribs/gmf/src/controllers/AbstractMobileController.js index 5402ae83fcfc..4c9096ed5b1d 100644 --- a/contribs/gmf/src/controllers/AbstractMobileController.js +++ b/contribs/gmf/src/controllers/AbstractMobileController.js @@ -188,26 +188,6 @@ exports.prototype.hideSearchOverlay = function() { }; -/** - * @return {boolean} Return true if the left navigation menus is visible, - * otherwise false. - * @export - */ -exports.prototype.leftNavIsVisible = function() { - return this.leftNavVisible; -}; - - -/** - * @return {boolean} Return true if the right navigation menus is visible, - * otherwise false. - * @export - */ -exports.prototype.rightNavIsVisible = function() { - return this.rightNavVisible; -}; - - /** * Open the menu with corresponding to the data-target attribute value. * @param {string} target the data-target value. From facb99b0d2c764fea5081e99f259c96b955a8369 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 4 Dec 2018 15:36:04 +0100 Subject: [PATCH 2/4] Remove unseless getters and setter The setters are only setting the value and the getters are only returning the value. --- src/datasource/DataSource.js | 42 +---------- src/datasource/OGC.js | 142 +++-------------------------------- src/rule/Rule.js | 80 +------------------- 3 files changed, 17 insertions(+), 247 deletions(-) diff --git a/src/datasource/DataSource.js b/src/datasource/DataSource.js index dd6e26028065..7154e784a14f 100644 --- a/src/datasource/DataSource.js +++ b/src/datasource/DataSource.js @@ -36,17 +36,15 @@ export default class { * service. * * @type {boolean} - * @private */ - this.inRange_ = options.inRange !== false; + this.inRange = options.inRange !== false; /** * Whether the data source is visible or not, i.e. whether its is ON or OFF. * Defaults to `false`. * @type {boolean} - * @private */ - this.visible_ = options.visible === true; + this.visible = options.visible === true; // === STATIC properties (i.e. that never change) === @@ -100,42 +98,6 @@ export default class { this.name_ = options.name; } - // ======================================== - // === Dynamic property getters/setters === - // ======================================== - - /** - * @return {boolean} In range - * @export - */ - get inRange() { - return this.inRange_; - } - - /** - * @param {boolean} inRange In range - * @export - */ - set inRange(inRange) { - this.inRange_ = inRange; - } - - /** - * @return {boolean} Visible - * @export - */ - get visible() { - return this.visible_; - } - - /** - * @param {boolean} visible Visible - * @export - */ - set visible(visible) { - this.visible_ = visible; - } - // ======================================= // === Static property getters/setters === // ======================================= diff --git a/src/datasource/OGC.js b/src/datasource/OGC.js index da545ebe3b9b..bf8ea0a4dd07 100644 --- a/src/datasource/OGC.js +++ b/src/datasource/OGC.js @@ -46,31 +46,27 @@ const exports = class extends ngeoDatasourceDataSource { /** * The dimensions configuration for the data source. * @type {?ngeox.Dimensions} - * @private */ - this.dimensionsConfig_ = options.dimensionsConfig || null; + this.dimensionsConfig = options.dimensionsConfig || null; /** * The dimensions applied by filters configuration for the data source. * @type {?ngeox.DimensionsFiltersConfig} - * @private */ - this.dimensionsFiltersConfig_ = options.dimensionsFiltersConfig || null; + this.dimensionsFiltersConfig = options.dimensionsFiltersConfig || null; /** * The filter condition to apply to the filter rules (if any). * @type {string} - * @private */ - this.filterCondition_ = options.filterCondition || ngeoFilterCondition.AND; + this.filterCondition = options.filterCondition || ngeoFilterCondition.AND; /** * A list of filter rules to apply to this data source using the filter * condition. * @type {?Array.} - * @private */ - this.filterRules_ = options.filterRules || null; + this.filterRules = options.filterRules || null; /** * Whether the data source is filtrable or not. When `null`, that means @@ -78,9 +74,8 @@ const exports = class extends ngeoDatasourceDataSource { * that case, the value of the property needs to be determined from an * external way. * @type {?boolean} - * @private */ - this.filtrable_ = options.filtrable || null; + this.filtrable = options.filtrable || null; // === STATIC properties (i.e. that never change) === @@ -179,10 +174,10 @@ const exports = class extends ngeoDatasourceDataSource { this.timeAttributeName_ = options.timeAttributeName; /** + * Time lower value. * @type {number|undefined} - * @private */ - this.timeLowerValue_ = options.timeLowerValue; + this.timeLowerValue = options.timeLowerValue; /** * @type {?ngeox.TimeProperty} @@ -191,10 +186,11 @@ const exports = class extends ngeoDatasourceDataSource { this.timeProperty_ = options.timeProperty !== undefined ? options.timeProperty : null; /** + * Time upper value. * @type {number|undefined} * @private */ - this.timeUpperValue_ = options.timeUpperValue; + this.timeUpperValue = options.timeUpperValue; /** * The feature namespace to use with WFS requests. @@ -323,88 +319,6 @@ const exports = class extends ngeoDatasourceDataSource { return this.dimensions_; } - /** - * @return {?ngeox.Dimensions} Dimensions configuration for this data source - * @export - */ - get dimensionsConfig() { - return this.dimensionsConfig_; - } - - /** - * @param {?ngeox.Dimensions} dimensionsConfig Dimensions configuration - * @export - */ - set dimensionsConfig(dimensionsConfig) { - this.dimensionsConfig_ = dimensionsConfig; - } - - /** - * @return {?ngeox.DimensionsFiltersConfig} dimensionsFiltersConfig Dimensions - * filters configuration for this data source - * @export - */ - get dimensionsFiltersConfig() { - return this.dimensionsFiltersConfig_; - } - - /** - * @param {?ngeox.DimensionsFiltersConfig}dimensionsFiltersConfig Dimensions - * filters configuration for this data source - * @export - */ - set dimensionsFiltersConfig(dimensionsFiltersConfig) { - this.dimensionsFiltersConfig_ = dimensionsFiltersConfig; - } - - /** - * @return {string} Filter condition - * @export - */ - get filterCondition() { - return this.filterCondition_; - } - - /** - * @param {string} filterCondition Filter condition - * @export - */ - set filterCondition(filterCondition) { - this.filterCondition_ = filterCondition; - } - - /** - * @return {?Array.} Filter rules - * @export - */ - get filterRules() { - return this.filterRules_; - } - - /** - * @param {?Array.} filterRules Filter rules - * @export - */ - set filterRules(filterRules) { - this.filterRules_ = filterRules; - } - - /** - * @return {number|undefined} Time lower value - * @export - */ - get timeLowerValue() { - return this.timeLowerValue_; - } - - /** - * @param {number|undefined} time Time lower value - * @export - */ - set timeLowerValue(time) { - this.timeLowerValue_ = time; - } - /** * @return {?ngeox.TimeRange} Time range value * @export @@ -436,22 +350,6 @@ const exports = class extends ngeoDatasourceDataSource { } } - /** - * @return {number|undefined} Time upper value - * @export - */ - get timeUpperValue() { - return this.timeUpperValue_; - } - - /** - * @param {number|undefined} time Time upper value - * @export - */ - set timeUpperValue(time) { - this.timeUpperValue_ = time; - } - // ======================================= // === Static property getters/setters === // ======================================= @@ -479,22 +377,6 @@ const exports = class extends ngeoDatasourceDataSource { return this.copyable_; } - /** - * @return {?boolean} Filtrable. - * @export - */ - get filtrable() { - return this.filtrable_; - } - - /** - * @param {?boolean} filtrable Filtrable. - * @export - */ - set filtrable(filtrable) { - this.filtrable_ = filtrable; - } - /** * @return {string} Geometry name * @export @@ -696,8 +578,7 @@ const exports = class extends ngeoDatasourceDataSource { * @override */ get combinableForWFS() { - return this.filterRules_ === null && - this.timeRangeValue === null; + return this.filterRules === null && this.timeRangeValue === null; } /** @@ -713,8 +594,7 @@ const exports = class extends ngeoDatasourceDataSource { * @override */ get combinableForWMS() { - return this.filterRules_ === null && - this.timeRangeValue === null; + return this.filterRules === null && this.timeRangeValue === null; } /** diff --git a/src/rule/Rule.js b/src/rule/Rule.js index 3c5d1f89477b..3a04b7832b88 100644 --- a/src/rule/Rule.js +++ b/src/rule/Rule.js @@ -40,9 +40,8 @@ const exports = class { * Whether the rule is active or not. Used by the `ngeo-rule` component. * Defaults to `false`. * @type {boolean} - * @private */ - this.active_ = options.active === true; + this.active = options.active === true; /** * The expression of the rule. The expression and boundaries are mutually @@ -63,26 +62,21 @@ const exports = class { * The lower boundary of the rule. The expression and boundaries are * mutually exclusives. * @type {?number} - * @private */ - this.lowerBoundary_ = options. lowerBoundary !== undefined ? - options.lowerBoundary : null; + this.lowerBoundary = options.lowerBoundary !== undefined ? options.lowerBoundary : null; /** * The rule operator. * @type {?string} - * @private */ - this.operator_ = options.operator || null; + this.operator = options.operator || null; /** * The upper boundary of the rule. The expression and boundaries are * mutually exclusives. * @type {?number} - * @private */ - this.upperBoundary_ = options. upperBoundary !== undefined ? - options.upperBoundary : null; + this.upperBoundary = options.upperBoundary !== undefined ? options.upperBoundary : null; // === STATIC properties (i.e. that never change) === @@ -133,24 +127,6 @@ const exports = class { } - // === Dynamic property getters/setters === - - /** - * @return {boolean} Active - * @export - */ - get active() { - return this.active_; - } - - /** - * @param {boolean} active Active - * @export - */ - set active(active) { - this.active_ = active; - } - /** * The `expression` property does not have conventionnal getter/setters * method because of a limitation of the compiler. It doesn't support @@ -173,54 +149,6 @@ const exports = class { this.expression = expression; } - /** - * @return {?number} Lower boundary - * @export - */ - get lowerBoundary() { - return this.lowerBoundary_; - } - - /** - * @param {?number} lowerBoundary Lower boundary - * @export - */ - set lowerBoundary(lowerBoundary) { - this.lowerBoundary_ = lowerBoundary; - } - - /** - * @return {?string} Operator - * @export - */ - get operator() { - return this.operator_; - } - - /** - * @param {?string} operator Operator - * @export - */ - set operator(operator) { - this.operator_ = operator; - } - - /** - * @return {?number} Upper boundary - * @export - */ - get upperBoundary() { - return this.upperBoundary_; - } - - /** - * @param {?number} upperBoundary Upper boundary - * @export - */ - set upperBoundary(upperBoundary) { - this.upperBoundary_ = upperBoundary; - } - // === Static property getters/setters === /** From 00750984e7540d60a0ae29058f0e2c4dee93b508 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Thu, 13 Dec 2018 15:16:56 +0100 Subject: [PATCH 3/4] Use Object.assign instead of ol/obj --- src/interaction/MeasureAreaMobile.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/interaction/MeasureAreaMobile.js b/src/interaction/MeasureAreaMobile.js index b0f5da33d204..1310fadeb7e2 100644 --- a/src/interaction/MeasureAreaMobile.js +++ b/src/interaction/MeasureAreaMobile.js @@ -4,7 +4,6 @@ import ngeoInteractionMeasureArea from 'ngeo/interaction/MeasureArea.js'; import ngeoInteractionMobileDraw from 'ngeo/interaction/MobileDraw.js'; import {inherits as olUtilInherits} from 'ol/util.js'; -import * as olObj from 'ol/obj.js'; /** * @classdesc @@ -20,7 +19,7 @@ const exports = function(format, gettextCatalog, opt_options) { const options = opt_options !== undefined ? opt_options : {}; - olObj.assign(options, {displayHelpTooltip: false}); + Object.assign(options, {displayHelpTooltip: false}); ngeoInteractionMeasureArea.call(this, format, gettextCatalog, options); From 4948217b39cee3e469f0037d78d038401dd78f0e Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Thu, 13 Dec 2018 16:22:24 +0100 Subject: [PATCH 4/4] Remove hideSearchOverlay function And use the variable directly. --- contribs/gmf/apps/mobile/index.html.ejs | 2 +- contribs/gmf/apps/mobile_alt/index.html.ejs | 2 +- contribs/gmf/src/controllers/AbstractMobileController.js | 9 --------- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/contribs/gmf/apps/mobile/index.html.ejs b/contribs/gmf/apps/mobile/index.html.ejs index afd80331a7fe..edc0c308c3ca 100644 --- a/contribs/gmf/apps/mobile/index.html.ejs +++ b/contribs/gmf/apps/mobile/index.html.ejs @@ -64,7 +64,7 @@
+ ng-click="mainCtrl.searchOverlayVisible = false()">
+ ng-click="mainCtrl.searchOverlayVisible = false()">