Skip to content

Commit

Permalink
Merge pull request #4466 from camptocamp/less
Browse files Browse the repository at this point in the history
Code simplifications
  • Loading branch information
fredj committed Dec 15, 2018
2 parents b9af9ab + 4948217 commit 7f1ace1
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 284 deletions.
6 changes: 3 additions & 3 deletions contribs/gmf/apps/mobile/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</head>

<body ng-class="{'gmf-mobile-nav-is-visible': mainCtrl.navIsVisible(),
'gmf-mobile-nav-left-is-visible': mainCtrl.leftNavIsVisible(),
'gmf-mobile-nav-right-is-visible': mainCtrl.rightNavIsVisible()}">
'gmf-mobile-nav-left-is-visible': mainCtrl.leftNavVisible,
'gmf-mobile-nav-right-is-visible': mainCtrl.rightNavVisible}">
<div ng-show="mainCtrl.loading" class="loading-mask">
<i class="fa fa-spinner fa-spin spinner-loading-mask"></i>
&nbsp;
Expand Down Expand Up @@ -64,7 +64,7 @@
<div class="overlay" ng-click="mainCtrl.hideNav()"></div>
<div
class="gmf-search-overlay"
ng-click="mainCtrl.hideSearchOverlay()">
ng-click="mainCtrl.searchOverlayVisible = false()">
</div>
<button ngeo-mobile-geolocation=""
ngeo-mobile-geolocation-map="::mainCtrl.map"
Expand Down
6 changes: 3 additions & 3 deletions contribs/gmf/apps/mobile_alt/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<% } %>
</head>
<body ng-class="{'gmf-mobile-nav-is-visible': mainCtrl.navIsVisible(),
'gmf-mobile-nav-left-is-visible': mainCtrl.leftNavIsVisible(),
'gmf-mobile-nav-right-is-visible': mainCtrl.rightNavIsVisible()}">
'gmf-mobile-nav-left-is-visible': mainCtrl.leftNavVisible,
'gmf-mobile-nav-right-is-visible': mainCtrl.rightNavVisible}">
<div ng-show="mainCtrl.loading" class="loading-mask">
<i class="fa fa-spinner fa-spin spinner-loading-mask"></i>
&nbsp;
Expand Down Expand Up @@ -77,7 +77,7 @@
<div class="overlay" ng-click="mainCtrl.hideNav()"></div>
<div
class="gmf-search-overlay"
ng-click="mainCtrl.hideSearchOverlay()">
ng-click="mainCtrl.searchOverlayVisible = false()">
</div>
<button ngeo-mobile-geolocation=""
ngeo-mobile-geolocation-map="::mainCtrl.map"
Expand Down
29 changes: 0 additions & 29 deletions contribs/gmf/src/controllers/AbstractMobileController.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,35 +179,6 @@ exports.prototype.navIsVisible = function() {
};


/**
* Hide search overlay.
* @export
*/
exports.prototype.hideSearchOverlay = function() {
this.searchOverlayVisible = false;
};


/**
* @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.
Expand Down
42 changes: 2 additions & 40 deletions src/datasource/DataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) ===
Expand Down Expand Up @@ -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 ===
// =======================================
Expand Down
142 changes: 11 additions & 131 deletions src/datasource/OGC.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,41 +46,36 @@ 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.<!ngeo.rule.Rule>}
* @private
*/
this.filterRules_ = options.filterRules || null;
this.filterRules = options.filterRules || null;

/**
* Whether the data source is filtrable or not. When `null`, that means
* that we do not know if the data source if filtrable or not, yet. In
* 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) ===
Expand Down Expand Up @@ -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}
Expand All @@ -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.
Expand Down Expand Up @@ -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.<!ngeo.rule.Rule>} Filter rules
* @export
*/
get filterRules() {
return this.filterRules_;
}

/**
* @param {?Array.<!ngeo.rule.Rule>} 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
Expand Down Expand Up @@ -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 ===
// =======================================
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

/**
Expand All @@ -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;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/interaction/MeasureAreaMobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down
Loading

0 comments on commit 7f1ace1

Please sign in to comment.