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.2' #3149

Merged
merged 42 commits into from
Nov 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8ae6470
Be able to correctly translate in french
sbrunner Nov 9, 2017
86411db
Merge pull request #3072 from camptocamp/typo
sbrunner Nov 9, 2017
2d1685a
Reset the theme name on login/logout
fredj Nov 10, 2017
15d8535
Remove forced dependencies and add comment
gberaudo Nov 7, 2017
90c594d
Fix examples using module templates
gberaudo Nov 9, 2017
6576930
Fix typo
gberaudo Nov 9, 2017
a6b9edc
Add ol-cesium and Cesium dependencies
gberaudo Nov 9, 2017
7b9215c
Add olcs module and example
gberaudo Nov 9, 2017
456540b
Fix (again) angular-gettext externs
gberaudo Oct 27, 2017
b70c7e5
Various fixes
gberaudo Nov 9, 2017
19986ab
Fix templateUrl handling
gberaudo Nov 10, 2017
717851b
Fix tests
gberaudo Nov 10, 2017
cd12f51
Remove excessively painful eslint rule
gberaudo Nov 10, 2017
8f026fd
Pass ol-cesium sources in ngeo-debug.json
gberaudo Nov 10, 2017
b055ed0
Make lint target reliable
gberaudo Nov 10, 2017
88b550c
Merge pull request #3077 from camptocamp/2845
fredj Nov 13, 2017
5296f0f
Clear query results on window/grid clear
fredj Nov 13, 2017
a15ae70
Merge pull request #3076 from camptocamp/reliable_lint_target
gberaudo Nov 13, 2017
9257904
Merge pull request #3083 from camptocamp/3029
fredj Nov 13, 2017
77b255c
Merge pull request #3073 from camptocamp/add_olcs_to_ngeo
gberaudo Nov 13, 2017
3e07c30
Better size for text stroke
ger-benjamin Nov 14, 2017
7a33229
Ignore ressource error from openstreetmap
fredj Nov 8, 2017
7051205
Merge pull request #3089 from camptocamp/size_text_stroke
ger-benjamin Nov 14, 2017
a6ed452
Allow to zoom with resolutions in metadata
ger-benjamin Nov 14, 2017
8f253ee
Merge pull request #3096 from camptocamp/use_metadata_resolution
ger-benjamin Nov 15, 2017
63e156c
Revert "Remove excessively painful eslint rule"
gberaudo Nov 15, 2017
0d0177c
Fix calls to constructor in dependent projects
gberaudo Nov 15, 2017
90e5503
Merge pull request #3102 from camptocamp/fix_olcs_manager_constructor
gberaudo Nov 16, 2017
861be8d
Better background layer computation on user change
fredj Nov 16, 2017
1c23d1e
Merge pull request #3106 from camptocamp/2878
fredj Nov 16, 2017
199c27c
Merge remote-tracking branch 'origin/2.1' into 2.2
sbrunner Nov 20, 2017
e79edfa
Fix bad merge
fredj Nov 21, 2017
f87bfd1
Merge pull request #3130 from camptocamp/bad_merge_2.2
fredj Nov 21, 2017
3e530eb
Add more lint rules in lint
sbrunner Nov 21, 2017
91ca88d
Merge pull request #3131 from camptocamp/lint-more
sbrunner Nov 22, 2017
c49e69d
Fix displayquerygrid doc typo
llienher Nov 22, 2017
42dce37
Merge pull request #3145 from camptocamp/fix-doc-typo
llienher Nov 22, 2017
73e552d
Do the release 2.1.11
sbrunner Nov 22, 2017
9596503
Merge remote-tracking branch 'origin/2.1' into 2.2
sbrunner Nov 22, 2017
2ca988b
Do the release 2.2.1
sbrunner Nov 22, 2017
a07c04f
Merge remote-tracking branch 'origin/2.2'
sbrunner Nov 22, 2017
0c71a2b
Fix tests
sbrunner Nov 23, 2017
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
2 changes: 2 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ rules:
no-console: 0
globals:
angular: false
Cesium: false
goog: false
google: false
d3: false
Bloodhound: false
ol: false
olcs: false
proj4: false
saveAs: false
ngeo: false
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ apidoc: .build/apidoc
dist: dist/ngeo.js dist/ngeo-debug.js dist/gmf.js

.PHONY: check
check: git-attributes eof-newline lint check-examples test dist build-gmf-apps check-ngeox
check: lint check-examples test dist build-gmf-apps

.PHONY: check-ngeox
check-ngeox: options/ngeox.js
Expand All @@ -214,7 +214,10 @@ build-gmf-apps: $(foreach APP,$(GMF_APPS),$(addprefix contribs/gmf/build/$(APP),
check-examples: $(BUILD_EXAMPLES_CHECK_TIMESTAMP_FILES)

.PHONY: lint
lint: .build/eslint.timestamp
lint: .build/eslint.timestamp git-attributes eof-newline check-ngeox

.PHONY: eslint
eslint: .build/eslint.timestamp

.PHONY: git-attributes
git-attributes:
Expand Down Expand Up @@ -289,7 +292,7 @@ gh-pages:
$(GMF_SRC_JS_FILES) \
$(GMF_EXAMPLES_JS_FILES) \
$(GMF_APPS_JS_FILES)
./node_modules/.bin/eslint $(filter-out .build/node_modules.timestamp .eslintrc.yaml .eslintrc-es6.yaml, $?)
./node_modules/.bin/eslint $(filter-out .build/node_modules.timestamp .eslintrc.yaml .eslintrc-es6.yaml, $^)
touch $@

dist/ngeo.js: .build/ngeo.json \
Expand Down
5 changes: 4 additions & 1 deletion buildtools/mako_build.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ _ngeo_folder = '' if ngeo_folder is UNDEFINED else ngeo_folder
"${_ngeo_folder}contribs/gmf/src/**/*.js",
% endif
"node_modules/openlayers/src/**/*.js",
"node_modules/openlayers/build/ol.ext/*.js"
"node_modules/openlayers/build/ol.ext/*.js",
"node_modules/ol-cesium/src/**/*.js"
],
"compile": {
% if entry_point:
Expand All @@ -49,6 +50,8 @@ _ngeo_folder = '' if ngeo_folder is UNDEFINED else ngeo_folder
"node_modules/openlayers/externs/proj4js.js",
"node_modules/openlayers/externs/tilejson.js",
"node_modules/openlayers/externs/topojson.js",
"node_modules/ol-cesium/Cesium.externs.js",
"node_modules/ol-cesium/externs/olcsx.js",
"${_ngeo_folder}externs/angular-gettext.js",
"${_ngeo_folder}externs/d3.js",
"${_ngeo_folder}externs/google_maps_api_v3_27.js",
Expand Down
1 change: 1 addition & 0 deletions buildtools/ngeo-debug.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"src": [
"node_modules/openlayers/src/**/*.js",
"node_modules/openlayers/build/ol.ext/*.js",
"node_modules/ol-cesium/src/**/*.js",
"src/**/*.js",
".build/templatecache.js"
]
Expand Down
1 change: 1 addition & 0 deletions buildtools/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ let manager = new closure.Manager({
'contribs/**/src/**/*.js',
'externs/*.js',
'node_modules/openlayers/src/**/*.js',
'node_modules/ol-cesium/src/**/*.js',
'node_modules/openlayers/build/ol.ext/*.js'
],
main: ['examples/*.js', 'contribs/**/examples/*.js', 'contribs/**/apps/**/*.js']
Expand Down
4 changes: 3 additions & 1 deletion contribs/gmf/apps/mobile/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
<gmf-disclaimer gmf-disclaimer-map="::mainCtrl.map"></gmf-disclaimer>
<div class="alert alert-info alert-dismissible fade in hidden-xs" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="{{'Close' | translate }}"><span aria-hidden="true" class="fa fa-times"></span></button>
<span>{{"You're using the mobile application. Check out the" | translate }} <a href="http://camptocamp.github.io/ngeo/master/examples/contribs/gmf/apps/desktop/?no_redirect">{{'standard application' | translate}}</a>.</span>
<span translate
translate-params-url="'http://camptocamp.github.io/ngeo/master/examples/contribs/gmf/apps/desktop/?no_redirect'">
You're using the mobile application. Check out the <a href="{{url}}">standard application</a>.</span>
</div>
</div>
</main>
Expand Down
4 changes: 3 additions & 1 deletion contribs/gmf/apps/mobile_alt/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
<gmf-disclaimer gmf-disclaimer-map="::mainCtrl.map"></gmf-disclaimer>
<div class="alert alert-info alert-dismissible fade in hidden-xs" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="{{'Close' | translate }}"><span aria-hidden="true" class="fa fa-times"></span></button>
<span>{{"You're using the mobile application. Check out the" | translate }} <a href="http://camptocamp.github.io/ngeo/master/examples/contribs/gmf/apps/desktop/?no_redirect">{{'standard application' | translate}}</a>.</span>
<span translate
translate-params-url="'http://camptocamp.github.io/ngeo/master/examples/contribs/gmf/apps/desktop/?no_redirect'">
You're using the mobile application. Check out the <a href="{{url}}">standard application</a>.</span>
</div>
</div>
</main>
Expand Down
77 changes: 56 additions & 21 deletions contribs/gmf/src/controllers/abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ gmf.AbstractController = function(config, $scope, $injector) {
/**
* @param {gmfx.AuthenticationEvent} evt Event.
*/
const userChange = function(evt) {
const userChange = (evt) => {
const user = evt.detail.user;
const roleId = (user.username !== null) ? user.role_id : undefined;

Expand All @@ -151,14 +151,18 @@ gmf.AbstractController = function(config, $scope, $injector) {
});

// Reload theme and background layer when login status changes.
const previousThemeName = this.gmfThemeManager.getThemeName();
this.gmfThemeManager.setThemeName('', true);
if (evt.type !== 'ready') {
this.updateCurrentTheme_();
this.updateCurrentBackgroundLayer_(true);
this.updateCurrentTheme_(previousThemeName);
} else {
// initialize default background layer
this.setDefaultBackground_(null, true);
}
// Reload themes when login status changes.
this.gmfThemes_.loadThemes(roleId);
this.updateHasEditableLayers_();
}.bind(this);
};

ol.events.listen(gmfAuthentication, 'ready', userChange);
ol.events.listen(gmfAuthentication, 'login', userChange);
Expand Down Expand Up @@ -201,15 +205,19 @@ gmf.AbstractController = function(config, $scope, $injector) {
}
}

const backgroundLayerMgr = $injector.get('ngeoBackgroundLayerMgr');
/**
* @type {ngeo.BackgroundLayerMgr}
* @private
*/
this.backgroundLayerMgr_ = $injector.get('ngeoBackgroundLayerMgr');

// watch any change on dimensions object to refresh the background layer
$scope.$watchCollection(() => this.dimensions, () => {
backgroundLayerMgr.updateDimensions(this.map, this.dimensions);
this.backgroundLayerMgr_.updateDimensions(this.map, this.dimensions);
});

backgroundLayerMgr.on('change', () => {
backgroundLayerMgr.updateDimensions(this.map, this.dimensions);
this.backgroundLayerMgr_.on('change', () => {
this.backgroundLayerMgr_.updateDimensions(this.map, this.dimensions);
});

/**
Expand Down Expand Up @@ -416,19 +424,9 @@ gmf.AbstractController = function(config, $scope, $injector) {
ngeoToolActivateMgr.registerTool(mapTools, printPanelActivate, false);

$scope.$root.$on(gmf.ThemeManagerEventType.THEME_NAME_SET, (event, name) => {
const map = this.map;
this.gmfThemes_.getThemeObject(name).then((theme) => {
if (theme) {
const backgrounds = theme.functionalities.default_basemap;
if (backgrounds && backgrounds.length > 0) {
const background = backgrounds[0];
this.gmfThemes_.getBgLayers(this.dimensions).then((layers) => {
const layer = ol.array.find(layers, layer => layer.get('label') === background);
if (layer) {
backgroundLayerMgr.set(map, layer);
}
});
}
this.setDefaultBackground_(theme, false);
}
});
});
Expand Down Expand Up @@ -463,7 +461,7 @@ gmf.AbstractController = function(config, $scope, $injector) {
}

if (background) {
backgroundLayerMgr.set(this.map, background);
this.backgroundLayerMgr_.set(this.map, background);
}
});
}.bind(this);
Expand Down Expand Up @@ -648,16 +646,53 @@ gmf.AbstractController.prototype.initLanguage = function() {


/**
* @param {gmfThemes.GmfTheme} theme Theme.
* @param {boolean} use_permalink Get background from the permalink.
* @private
*/
gmf.AbstractController.prototype.setDefaultBackground_ = function(theme, use_permalink) {
this.gmfThemes_.getBgLayers(this.dimensions).then((layers) => {
let default_basemap;
let layer;

if (use_permalink) {
// get the background from the permalink
layer = this.permalink_.getBackgroundLayer(layers);
}
if (!layer) {
if (this.gmfUser.functionalities) {
// get the background from the user settings
default_basemap = this.gmfUser.functionalities.default_basemap;
} else if (theme) {
// get the background from the theme
default_basemap = theme.functionalities.default_basemap;
}
if (default_basemap && default_basemap.length > 0) {
layer = ol.array.find(layers, layer => layer.get('label') === default_basemap[0]);
}
}
// fallback to the layers list, use the second one because the first is the blank layer.
layer = layer || layers[1];
goog.asserts.assert(layer);

this.backgroundLayerMgr_.set(this.map, layer);
});
};

/**
* @param {string} fallbackThemeName fallback theme name.
* @private
*/
gmf.AbstractController.prototype.updateCurrentTheme_ = function() {
gmf.AbstractController.prototype.updateCurrentTheme_ = function(fallbackThemeName) {
this.gmfThemes_.getThemesObject().then((themes) => {
const themeName = this.permalink_.defaultThemeNameFromFunctionalities();
if (themeName) {
const theme = gmf.Themes.findThemeByName(themes, /** @type {string} */ (themeName));
if (theme) {
this.gmfThemeManager.addTheme(theme, true);
}
} else {
this.gmfThemeManager.setThemeName(fallbackThemeName, true);
}
});
};
Expand Down
3 changes: 2 additions & 1 deletion contribs/gmf/src/datasource/externaldatasourcesmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ goog.provide('gmf.datasource.ExternalDataSourcesManager');

goog.require('ol.events');
goog.require('gmf');
goog.require('ngeo.File');
/** @suppress {extraRequire} */
goog.require('ngeo.fileService');
goog.require('ngeo.datasource.DataSources');
goog.require('ngeo.datasource.File');
goog.require('ngeo.datasource.FileGroup');
Expand Down
24 changes: 16 additions & 8 deletions contribs/gmf/src/directives/displayquerygrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ goog.require('ol.style.Style');

ngeo.module.value('gmfDisplayquerygridTemplateUrl',
/**
* @param {!angular.JQLite} $element Element.
* @param {!angular.Attributes} $attrs Attributes.
* @return {string} Template URL.
*/
* @param {!angular.JQLite} $element Element.
* @param {!angular.Attributes} $attrs Attributes.
* @return {string} Template URL.
*/
($element, $attrs) => {
const templateUrl = $attrs['gmfDisplayquerygridTemplateurl'];
return templateUrl !== undefined ? templateUrl :
Expand Down Expand Up @@ -75,7 +75,7 @@ function gmfDisplayquerygridTemplateUrl($element, $attrs, gmfDisplayquerygridTem
* empty columns be hidden? Default: `false`.
* @htmlAttribute {number?} gmf-displayquerygrid-maxrecenterzoom Optional. Maximum
* zoom-level to use when zooming to selected features.
* @htmlAttribute {gmfx.GridMergeTabs?} gmf-displayquerygrid-gridmergetabas Optional.
* @htmlAttribute {gmfx.GridMergeTabs?} gmf-displayquerygrid-gridmergetabs Optional.
* Configuration to merge grids with the same attributes into a single grid.
*
* @ngdoc component
Expand Down Expand Up @@ -106,6 +106,7 @@ gmf.module.component('gmfDisplayquerygrid', gmf.displayquerygridComponent);
* @param {angular.$injector} $injector Main injector.
* @param {!angular.Scope} $scope Angular scope.
* @param {ngeox.QueryResult} ngeoQueryResult ngeo query result.
* @param {ngeo.MapQuerent} ngeoMapQuerent ngeo map querent service.
* @param {ngeo.FeatureOverlayMgr} ngeoFeatureOverlayMgr The ngeo feature
* overlay manager service.
* @param {angular.$timeout} $timeout Angular timeout service.
Expand All @@ -117,7 +118,7 @@ gmf.module.component('gmfDisplayquerygrid', gmf.displayquerygridComponent);
* @ngdoc controller
* @ngname GmfDisplayquerygridController
*/
gmf.DisplayquerygridController = function($injector, $scope, ngeoQueryResult,
gmf.DisplayquerygridController = function($injector, $scope, ngeoQueryResult, ngeoMapQuerent,
ngeoFeatureOverlayMgr, $timeout, ngeoCsvDownload, $element) {

const queryOptions = /** @type {ngeox.QueryOptions} */ (
Expand All @@ -142,6 +143,12 @@ gmf.DisplayquerygridController = function($injector, $scope, ngeoQueryResult,
*/
this.ngeoQueryResult = ngeoQueryResult;

/**
* @type {ngeo.MapQuerent}
* @private
*/
this.ngeoMapQuerent_ = ngeoMapQuerent;

/**
* @type {ngeo.CsvDownload}
* @private
Expand Down Expand Up @@ -244,8 +251,8 @@ gmf.DisplayquerygridController = function($injector, $scope, ngeoQueryResult,
* @type {string}
* @private
*/
this.filename_ = $injector.has('gmfCsvFilename') ?
$injector.get('gmfCsvFilename') : 'query-results.csv';
this.filename_ = $injector.has('gmfCsvFilename') ?
$injector.get('gmfCsvFilename') : 'query-results.csv';

/**
* @type {ol.Map}
Expand Down Expand Up @@ -655,6 +662,7 @@ gmf.DisplayquerygridController.prototype.clear = function() {
this.tooManyResults = false;
this.features_.clear();
this.highlightFeatures_.clear();
this.ngeoMapQuerent_.clear();
this.featuresForSources_ = {};
if (this.unregisterSelectWatcher_) {
this.unregisterSelectWatcher_();
Expand Down
10 changes: 9 additions & 1 deletion contribs/gmf/src/directives/displayquerywindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ gmf.module.component('gmfDisplayquerywindow', gmf.displayquerywindowComponent);
* @param {!jQuery} $element Element.
* @param {!angular.Scope} $scope Angular scope.
* @param {!ngeox.QueryResult} ngeoQueryResult ngeo query result.
* @param {!ngeo.MapQuerent} ngeoMapQuerent ngeo map querent service.
* @param {!ngeo.FeatureOverlayMgr} ngeoFeatureOverlayMgr The ngeo feature
* overlay manager service.
* @constructor
Expand All @@ -98,7 +99,7 @@ gmf.module.component('gmfDisplayquerywindow', gmf.displayquerywindowComponent);
* @ngdoc controller
* @ngname GmfDisplayquerywindowController
*/
gmf.DisplayquerywindowController = function($element, $scope, ngeoQueryResult,
gmf.DisplayquerywindowController = function($element, $scope, ngeoQueryResult, ngeoMapQuerent,
ngeoFeatureOverlayMgr) {

/**
Expand Down Expand Up @@ -138,6 +139,12 @@ gmf.DisplayquerywindowController = function($element, $scope, ngeoQueryResult,
pending: false
};

/**
* @type {ngeo.MapQuerent}
* @private
*/
this.ngeoMapQuerent_ = ngeoMapQuerent;

/**
* @type {?ngeox.QueryResultSource}
* @export
Expand Down Expand Up @@ -500,6 +507,7 @@ function(opt_lastFeature) {
gmf.DisplayquerywindowController.prototype.close = function() {
this.open = false;
this.clear();
this.ngeoMapQuerent_.clear();
};


Expand Down
Loading