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 2.2 into master #3651

Merged
merged 36 commits into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d136514
Remove unused dimensions in backgroundlayerselector for app and examples
llienher Feb 20, 2018
bf7a0cf
Add config for bgOpacityLayer in desktop_alt, basic UI
llienher Feb 20, 2018
de3a620
Add bgOpacityLayer to map
llienher Feb 21, 2018
3ac6b09
Fix compiler errors
llienher Feb 21, 2018
76ba203
Use of getter/setter for the opacity slider ng-model
llienher Feb 22, 2018
52a120f
Make sure the lines from the contextual menu are never wrapped
fredj Feb 22, 2018
a668df5
Add a background group containing all background layers
llienher Feb 22, 2018
4fe22dd
Update tests
llienher Feb 22, 2018
ef5b2da
Merge pull request #3562 from camptocamp/f_3496
fredj Feb 26, 2018
53f42e3
Fix background group order issue
llienher Feb 26, 2018
74c1862
Getter for opacity background layer and tests
llienher Feb 26, 2018
b738e64
Add zIndex for background layers, better overlay background set
llienher Feb 27, 2018
5a022ab
Use fa-check icon
llienher Feb 27, 2018
8e06975
Remove completely preload param on ol.layer.Tile (#3583)
ger-benjamin Feb 27, 2018
9360ebf
Prevent reload of user object during logout for specific user role. (…
pfirpfel Feb 28, 2018
e23b2ea
Preload for Tiles is configurable now
ger-benjamin Feb 28, 2018
e457608
Merge pull request #3592 from camptocamp/Option_preload_for_tiles
ger-benjamin Feb 28, 2018
c2cb3b5
Fix set background method if layer is null for zindex property
llienher Mar 1, 2018
049057c
Fix ngRepeat track by displayquerygird
llienher Mar 1, 2018
3586eef
Merge pull request #3598 from camptocamp/fix_displayquerygrid
llienher Mar 1, 2018
c95d1e4
Merge pull request #3553 from camptocamp/backgroundlayerselector-opac…
llienher Mar 1, 2018
416d3ab
Add z-index to popover
llienher Mar 1, 2018
4824343
Merge pull request #3602 from camptocamp/popover_zindex
llienher Mar 1, 2018
d3cf5ee
Add support for ol.layer.Group ZIndex on first children layers
llienher Mar 2, 2018
8a6bd69
Add rollup to fix missing ol.ext dependencies
ger-benjamin Mar 6, 2018
869faa8
Merge pull request #3621 from camptocamp/fix_22
ger-benjamin Mar 6, 2018
38e6989
Use escaped label as id for querygrid, because id are not unique
ger-benjamin Mar 6, 2018
701ca96
Fix mergeTab usage (missing export tag)
ger-benjamin Mar 6, 2018
fdcdef9
Merge pull request #3622 from camptocamp/fix_displayquerygrid_display
ger-benjamin Mar 6, 2018
2f7a064
Merge pull request #3610 from camptocamp/backgroundopacityslider_grou…
llienher Mar 12, 2018
4fa181b
Add maxzoom for permalink search
llienher Mar 2, 2018
4957daf
Merge pull request #3648 from camptocamp/permalink-search-maxzoom
llienher Mar 12, 2018
484e609
Print - Selected scale must not be auto. adapted
ger-benjamin Mar 12, 2018
5ad6ec9
Merge pull request #3649 from camptocamp/selected_scale_must_not_change
ger-benjamin Mar 12, 2018
164c75d
Fix conflicts
llienher Mar 13, 2018
841cae4
Remove ununsed require and gmf dependency in ngeo
llienher Mar 14, 2018
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
1 change: 0 additions & 1 deletion contribs/gmf/apps/desktop/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@
<img src="image/background-layer-button.png" alt="" />
</button>
<gmf-backgroundlayerselector
gmf-backgroundlayerselector-dimensions="::mainCtrl.dimensions"
gmf-backgroundlayerselector-map="::mainCtrl.map"
class="dropdown-menu">
</gmf-backgroundlayerselector>
Expand Down
5 changes: 3 additions & 2 deletions contribs/gmf/apps/desktop_alt/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@
<img src="image/background-layer-button.png" alt="" />
</button>
<gmf-backgroundlayerselector
gmf-backgroundlayerselector-dimensions="::mainCtrl.dimensions"
gmf-backgroundlayerselector-map="::mainCtrl.map"
gmf-backgroundlayer-opacity-options="::mainCtrl.bgOpacityOptions"
class="dropdown-menu">
</gmf-backgroundlayerselector>
</div>
Expand Down Expand Up @@ -417,9 +417,10 @@
defaultFeatureNS: 'http://mapserver.gis.umn.edu/mapserver',
defaultFeaturePrefix: 'feature'
}));
module.constant('ngeoTilesPreloadingLimit', 0);
module.constant('ngeoQueryOptions', {
limit: 50
})
});
})();
</script>
</body>
Expand Down
6 changes: 6 additions & 0 deletions contribs/gmf/apps/desktop_alt/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ app.desktop_alt.Controller = function($scope, $injector, ngeoFile, gettext, $q)
gettextCatalog.getString('Add a theme');
gettextCatalog.getString('Add a sub theme');
gettextCatalog.getString('Add a layer');

/**
* @type {string}
* @export
*/
this.bgOpacityOptions = 'Test aus Olten';
};
ol.inherits(app.desktop_alt.Controller, gmf.controllers.AbstractDesktopController);

Expand Down
1 change: 0 additions & 1 deletion contribs/gmf/apps/mobile/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
id="background"
class="gmf-mobile-nav-slide"
data-header-title="{{'Background' | translate}}"
gmf-backgroundlayerselector-dimensions="::mainCtrl.dimensions"
gmf-backgroundlayerselector-map="::mainCtrl.map"
gmf-backgroundlayerselector-select="mainCtrl.hideNav()">
</gmf-backgroundlayerselector>
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/apps/mobile_alt/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
id="background"
class="gmf-mobile-nav-slide"
data-header-title="{{'Background' | translate}}"
gmf-backgroundlayerselector-dimensions="::mainCtrl.dimensions"
gmf-backgroundlayerselector-map="::mainCtrl.map"
gmf-backgroundlayerselector-select="mainCtrl.hideNav()">
</gmf-backgroundlayerselector>
Expand Down Expand Up @@ -240,6 +239,7 @@
defaultFeatureNS: 'http://mapserver.gis.umn.edu/mapserver',
defaultFeaturePrefix: 'feature'
}));
module.constant('ngeoTilesPreloadingLimit', 0);
})();
</script>
</body>
Expand Down
1 change: 0 additions & 1 deletion contribs/gmf/examples/backgroundlayerselector.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
directive to select the map background layer.</p>
<div>
<gmf-backgroundlayerselector
gmf-backgroundlayerselector-dimensions="::ctrl.dimensions"
gmf-backgroundlayerselector-map="::ctrl.map">
</gmf-backgroundlayerselector>
</div>
Expand Down
6 changes: 0 additions & 6 deletions contribs/gmf/examples/backgroundlayerselector.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ gmfapp.backgroundlayerselector.MainController = function(gmfThemes) {

gmfThemes.loadThemes();

/**
* @type {Object.<string, string>}
* @export
*/
this.dimensions = {};

/**
* @type {ol.Map}
* @export
Expand Down
5 changes: 5 additions & 0 deletions contribs/gmf/less/contextualdata.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@

table {
width: 100%;
tr {
td {
white-space: nowrap;
}
}
}
}
20 changes: 20 additions & 0 deletions contribs/gmf/less/map.less
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ button[ngeo-mobile-geolocation] {
content: @fa-var-check;
}
}

&.gmf-backgroundlayerselector-disabled{
border-top-color: @map-tools-color;
pointer-events: none;
}

span.gmf-backgroundlayerselector-opacity-check {
&::after {
width: (18em / 14);
font-family: FontAwesome;
content: @fa-var-check;
text-align: center;
}
}
}

.gmf-text {
Expand All @@ -108,6 +122,12 @@ button[ngeo-mobile-geolocation] {
height: @map-tools-size;
margin: 0 @half-app-margin;
}

input.gmf-backgroundlayerselector-opacity-slider {
margin: 1rem 0 2rem 0;
padding-left: @half-app-margin !important;
padding-right: @half-app-margin !important;
}
}

/** Disclaimer and tablet redirect */
Expand Down
1 change: 1 addition & 0 deletions contribs/gmf/less/popover.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

.popover {
border-radius: 0;
z-index: @above-content-index;
.popover-content {
ul {
margin-bottom: 0;
Expand Down
28 changes: 23 additions & 5 deletions contribs/gmf/src/authentication/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ gmf.authentication.Service = class extends ol.events.EventTarget {

/**
* @param {angular.$http} $http Angular http service.
* @param {angular.$injector} $injector Main injector.
* @param {angular.Scope} $rootScope The directive's scope.
* @param {string} authenticationBaseUrl URL to "authentication" web service.
* @param {gmfx.User} gmfUser User.
* @ngInject
*/
constructor($http, $rootScope, authenticationBaseUrl, gmfUser) {
constructor($http, $injector, $rootScope, authenticationBaseUrl, gmfUser) {

super();

Expand Down Expand Up @@ -55,6 +56,16 @@ gmf.authentication.Service = class extends ol.events.EventTarget {
*/
this.user_ = gmfUser;

/**
* Don't request a new user object from the back-end after
* logging out if the logged-in user's role has this role.
* @type {?string}
* @private
*/
this.noReloadRole_ = $injector.has('gmfAuthenticationNoReloadRole')
? $injector.get('gmfAuthenticationNoReloadRole')
: null;

this.load_();
}

Expand Down Expand Up @@ -114,9 +125,11 @@ gmf.authentication.Service = class extends ol.events.EventTarget {
* @export
*/
logout() {
const noReload = this.user_['role_name'] === this.noReloadRole_;
const url = `${this.baseUrl_}/${gmf.authentication.Service.RouteSuffix.LOGOUT}`;
return this.$http_.get(url, {withCredentials: true}).then(
this.resetUser_.bind(this));
return this.$http_.get(url, {withCredentials: true}).then(() => {
this.resetUser_(noReload);
});
}

/**
Expand Down Expand Up @@ -191,15 +204,20 @@ gmf.authentication.Service = class extends ol.events.EventTarget {

/**
* @private
* @param {boolean} noReload Don't request a new user object from
* the back-end after logging out, defaults to false.
*/
resetUser_() {
resetUser_(noReload) {
noReload = noReload || false;
for (const key in this.user_) {
this.user_[key] = null;
}
/** @type {gmfx.AuthenticationEvent} */
const event = new ngeo.CustomEvent('logout', {user: this.user_});
this.dispatchEvent(event);
this.load_();
if (!noReload) {
this.load_();
}
}
};

Expand Down
13 changes: 12 additions & 1 deletion contribs/gmf/src/backgroundlayerselector/component.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
<ul class="gmf-backgroundlayerselector">
<li ng-repeat="layer in ctrl.bgLayers"
ng-click="ctrl.setLayer(layer)"
ng-class="{'gmf-backgroundlayerselector-active': ctrl.bgLayer == layer}">
ng-class="{'gmf-backgroundlayerselector-active': ctrl.bgLayer == layer, 'gmf-backgroundlayerselector-disabled': ctrl.opacityLayer == layer}">
<img class="gmf-thumb"
ng-src="{{::layer.get('metadata')['thumbnail']}}" />
<span class="gmf-text">{{layer.get("label") | translate}}</span>
<span ng-class="{'gmf-backgroundlayerselector-opacity-check': ctrl.opacityLayer == layer}"></span>
</li>

<input ng-if="ctrl.opacityLayer"
class="input-action gmf-backgroundlayerselector-opacity-slider"
name="bg-layer-opacity"
type="range"
min="0"
max="1"
step="0.01"
ng-model="ctrl.getSetBgLayerOpacity"
ng-model-options="{getterSetter: true}">
</ul>
55 changes: 45 additions & 10 deletions contribs/gmf/src/backgroundlayerselector/component.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
goog.provide('gmf.backgroundlayerselector.component');

goog.require('gmf'); // nowebpack
goog.require('goog.asserts');
goog.require('gmf.theme.Themes');
goog.require('ngeo.map.BackgroundLayerMgr');
goog.require('ol.events');
Expand Down Expand Up @@ -54,18 +53,17 @@ function gmfBackgroundlayerselectorTemplateUrl($element, $attrs, gmfBackgroundla
* Example:
*
* <gmf-backgroundlayerselector
* gmf-backgroundlayerselector-dimensions="::ctrl.dimensions"
* gmf-backgroundlayerselector-map="::ctrl.map"
* gmf-backgroundlayer-opacity-options="::ctrl.bgOpacityOptions"
* gmf-backgroundlayerselector-select="onBackgroundSelected()">
* </gmf-backgroundlayerselector>
*
* Used UI metadata:
*
* * thumbnail: The URL used for the icon.
*
* @htmlAttribute {Object.<string, string>} gmf-backgroundlayerselector-dimensions
* The dimensions.
* @htmlAttribute {ol.Map=} gmf-backgroundlayerselector-map The map.
* @htmlAttribute {string} gmf-backgroundlayer-opacity-options The opacity slider options.
* @htmlAttribute {Function} gmf-backgroundlayerselector-select Function called
* when a layer was selected by the user.
*
Expand All @@ -75,8 +73,8 @@ function gmfBackgroundlayerselectorTemplateUrl($element, $attrs, gmfBackgroundla
gmf.backgroundlayerselector.component.component_ = {
controller: 'GmfBackgroundlayerselectorController as ctrl',
bindings: {
'dimensions': '=gmfBackgroundlayerselectorDimensions',
'map': '=gmfBackgroundlayerselectorMap',
'opacityOptions': '=gmfBackgroundlayerOpacityOptions',
'select': '&?gmfBackgroundlayerselectorSelect'
},
templateUrl: gmfBackgroundlayerselectorTemplateUrl
Expand All @@ -101,16 +99,16 @@ gmf.backgroundlayerselector.component.component('gmfBackgroundlayerselector',
gmf.backgroundlayerselector.component.Controller_ = function($scope, ngeoBackgroundLayerMgr, gmfThemes) {

/**
* @type {!Object.<string, string>}
* @type {?ol.Map}
* @export
*/
this.dimensions;
this.map;

/**
* @type {?ol.Map}
* @type {!string|undefined}
* @export
*/
this.map;
this.opacityOptions;

/**
* Function called when a layer was selected by the user.
Expand All @@ -131,6 +129,12 @@ gmf.backgroundlayerselector.component.Controller_ = function($scope, ngeoBackgro
*/
this.bgLayers;

/**
* @type {ol.layer.Base}
* @export
*/
this.opacityLayer;

/**
* @type {!gmf.theme.Themes}
* @private
Expand Down Expand Up @@ -167,7 +171,6 @@ gmf.backgroundlayerselector.component.Controller_ = function($scope, ngeoBackgro
* Initialise the controller.
*/
gmf.backgroundlayerselector.component.Controller_.prototype.$onInit = function() {
goog.asserts.assert(this.dimensions, 'The dimensions object is required');
this.handleThemesChange_();
};

Expand All @@ -179,9 +182,34 @@ gmf.backgroundlayerselector.component.Controller_.prototype.$onInit = function()
gmf.backgroundlayerselector.component.Controller_.prototype.handleThemesChange_ = function() {
this.gmfThemes_.getBgLayers().then((layers) => {
this.bgLayers = layers;

if (this.opacityOptions !== undefined) {
const opacityLayer = layers.find(layer => layer.get('label') === this.opacityOptions);
if (opacityLayer !== undefined) {
this.setOpacityBgLayer(opacityLayer);
this.opacityLayer = opacityLayer;

// Reorder for the UI the bgArray copy with the opacity layer at the end
this.bgLayers = this.bgLayers.slice();
const indexOpa = this.bgLayers.findIndex(layer => layer === this.opacityLayer);
this.bgLayers.splice(indexOpa, 1);
this.bgLayers.push(opacityLayer);
}
}
});
};

/**
* Getter/setter for background layer overlay, used by opacity slider.
* @param {?number} val The opacity.
* @returns {number} The background layer opacity.
*/
gmf.backgroundlayerselector.component.Controller_.prototype.getSetBgLayerOpacity = function(val) {
if (val) {
this.opacityLayer.setOpacity(val);
}
return this.opacityLayer.getOpacity();
};

/**
* @param {ol.layer.Base} layer Layer.
Expand All @@ -196,6 +224,13 @@ gmf.backgroundlayerselector.component.Controller_.prototype.setLayer = function(
}
};

/**
* Set a background layer overlay, used by the opacity slider.
* @param {ol.layer.Base} layer The opacity background layer.
*/
gmf.backgroundlayerselector.component.Controller_.prototype.setOpacityBgLayer = function(layer) {
this.backgroundLayerMgr_.setOpacityBgLayer(this.map, layer);
};

/**
* @private
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/controllers/AbstractAppController.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ gmf.controllers.AbstractAppController.prototype.setDefaultBackground_ = function
// get the background from the permalink
layer = this.permalink_.getBackgroundLayer(layers);

if (!layer) {
if (!layer && this.gmfUser.functionalities) {
// get the background from the user settings
layer = gmf.controllers.AbstractAppController.getLayerByLabels(layers, this.gmfUser.functionalities.default_basemap);
}
Expand Down
6 changes: 6 additions & 0 deletions contribs/gmf/src/gmf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ goog.provide('gmf');
*/
gmf.baseModuleTemplateUrl = 'gmf'; // nowebpack

/**
* @const
* @export
*/
gmf.BACKGROUNDLAYERGROUP_NAME = 'background';

/**
* @const
* @export
Expand Down
Loading