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.3 into 2.4 #4913

Merged
merged 20 commits into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion contribs/gmf/examples/common_dependencies.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'gmf/sass/vars.scss'
import 'gmf/sass/vars.scss';
import 'jquery';
import 'angular';
import 'angular-gettext';
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/examples/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function MainController(gmfThemes, ngeoFeatureOverlayMgr, ngeoNotification) {
});

/**
* @type {function()}
* @type {function(): void}
*/
this.searchIsReady = () => {
ngeoNotification.notify({
Expand Down
6 changes: 3 additions & 3 deletions contribs/gmf/src/datasource/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,17 +358,17 @@ export class DatasourceManager {

// (2) Collect 'leaf' treeCtrls
const newTreeCtrls = [];
const visitor = (treeCtrls, treeCtrl) => {
const visitor = (treeCtrl) => {
const node = /** @type {!import('gmf/themes.js').GmfGroup|!import('gmf/themes.js').GmfLayer} */ (
treeCtrl.node);
const groupNode = /** @type {!import('gmf/themes.js').GmfGroup} */ (node);
const children = groupNode.children;
if (!children) {
treeCtrls.push(treeCtrl);
newTreeCtrls.push(treeCtrl);
}
};
for (let i = 0, ii = value.length; i < ii; i++) {
value[i].traverseDepthFirst(visitor.bind(this, newTreeCtrls));
value[i].traverseDepthFirst(visitor);
}

// (3) Add new 'treeCtrls'
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/editing/Snapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ EditingSnappingService.prototype.handleMapMoveEnd_ = function() {
* @property {?angular.IDeferred} requestDeferred
* @property {import('gmf/themes.js').GmfSnappingConfig} snappingConfig
* @property {Function} stateWatcherUnregister
* @property {ngeo.layertree.Controller} treeCtrl
* @property {import("ngeo/layertree/Controller.js").defaault} treeCtrl
* @property {WFSConfig} wfsConfig
*/

Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/src/editing/editFeatureSelectorComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.run(/* @ngInject */ ($templateCache) => {
* buffer in pixels to use when making queries to get the features.
* @htmlAttribute {import("ol/layer/Vector.js").default} gmf-editfeatureselector-vector The vector
* layer where the selected or created features are drawn.
* @htmlAttribute {ngeo.layertree.Controller} gmf-editfeatureselector-tree The
* @htmlAttribute {import("ngeo/layertree/Controller.js").default} gmf-editfeatureselector-tree The
* layertree controller handling the selectable editable layers list.
* @htmlAttribute {boolean} gmf-editfeatureselector-closeaftersave If true,
* immediately return to the main edit panel after save. Default is false.
Expand Down Expand Up @@ -174,7 +174,7 @@ function Controller($scope, $timeout, gmfThemes, gmfTreeManager) {
};

/**
* @type {function()}
* @type {function(): void}
* @private
*/
this.treeCtrlsWatcherUnregister_ = $scope.$watchCollection(() => {
Expand Down
1 change: 1 addition & 0 deletions contribs/gmf/src/objectediting/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,7 @@ Controller.prototype.setFeatureStyle_ = function() {
*
* @param {import("ngeo/layertree/Controller.js").LayertreeController} treeCtrl Layertree controller
* to register
* @return {void}
* @private
*/
Controller.prototype.registerTreeCtrl_ = function(treeCtrl) {
Expand Down
6 changes: 4 additions & 2 deletions contribs/gmf/src/raster/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ module.directive('gmfElevation', rasterComponent);
* @hidden
* @param {!angular.IScope} $scope Scope.
* @param {!angular.IFilterService} $filter Angular filter.
* @param {!import("ngeo/misc/debounce.js").miscDebounce<function(): void>} ngeoDebounce Ngeo debounce factory
* @param {!import("ngeo/misc/debounce.js").miscDebounce
* <function(import("ol/MapBrowserPointerEvent.js").default): void>} ngeoDebounce Ngeo debounce factory
* @param {!import("gmf/raster/RasterService.js").RasterService} gmfRaster Gmf Raster service
* @param {!angular.gettext.gettextCatalog} gettextCatalog Gettext catalog.
* @constructor
Expand All @@ -146,7 +147,8 @@ function Controller($scope, $filter, ngeoDebounce, gmfRaster, gettextCatalog) {
this.filter_ = $filter;

/**
* @type {import("ngeo/misc/debounce.js").miscDebounce<function(): void>}
* @type {import("ngeo/misc/debounce.js").miscDebounce
* <function(import("ol/MapBrowserPointerEvent.js").default): void>}
* @private
*/
this.ngeoDebounce_ = ngeoDebounce;
Expand Down
2 changes: 1 addition & 1 deletion examples/mapfishprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function MainController($timeout, ngeoCreatePrint, ngeoPrintUtils) {
this.printUtils_ = ngeoPrintUtils;

/**
* @type {function(import("ol/render/Event.js").default)}
* @type {function(import("ol/render/Event.js").default): void}
*/
const postcomposeListener = ngeoPrintUtils.createPrintMaskPostcompose(
/**
Expand Down
60 changes: 60 additions & 0 deletions examples/offline.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#map {
width: 600px;
height: 400px;
position: relative;
}
ngeo-offline div {
z-index: 1;
}
ngeo-offline .main-button {
position: absolute;
right: 1rem;
bottom: 5rem;
cursor: pointer;
}
ngeo-offline .main-button .no-data {
color: black;
}
ngeo-offline .main-button .with-data {
color: red;
}
ngeo-offline .main-button .no-data,
ngeo-offline .main-button .with-data {
background-color: white;
text-align: center;
font-size: 2.5rem;
line-height: 2rem;
border-radius: 2rem;
font-family: FontAwesome;
}

ngeo-offline .validate-extent {
position: absolute;
bottom: 0.5rem;
width: 10rem;
left: calc(50% - 5rem);
}
ngeo-offline .in-progress {
position: absolute;
left: calc(50% - 3.3rem);
top: calc(50% - 3rem);
color: white;
font-weight: bold;
background-color: #337ab7;
padding: 2rem 2rem;
border-radius: 1rem;
}
ngeo-offline .modal-content {
width: 30rem;
}
ngeo-offline .modal-body button {
display: block;
margin: 0.5rem auto;
width: 25rem;
}
.offline-msg {
display: none;
}
.offline .offline-msg {
display: block;
}
20 changes: 20 additions & 0 deletions examples/offline.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html ng-app='app'>
<head>
<title>Offline example</title>
<meta charset="utf-8">
<meta name="viewport"
content="initial-scale=1.0, user-scalable=no, width=device-width">
<meta name="mobile-web-app-capable" content="yes">
</head>
<body ng-controller="MainController as ctrl" ng-class="{offline: ctrl.ngeoNetworkStatus.isDisconnected()}">
<div class="offline-msg alert-danger" translate>You are currently offline.</div>
<div id="map" ngeo-map="ctrl.map">
<ngeo-offline
ngeo-offline-map="ctrl.map"
ngeo-offline-extentsize="ctrl.offlineExtentSize">
</ngeo-offline>
</div>
<p id="desc">This example shows how to use the <code><a href="../apidoc/ngeo.offline.component.html" title="Read our documentation">ngeo-offline</a></code> component.</p>
</body>
</html>
85 changes: 85 additions & 0 deletions examples/offline.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/**
* @module app.offline
*/
const exports = {};

import '@fortawesome/fontawesome-free/css/fontawesome.min.css';
import './offline.css';
import './common_dependencies.js';
import olMap from 'ol/Map.js';

import olView from 'ol/View.js';
import olLayerTile from 'ol/layer/Tile.js';
import olSourceOSM from 'ol/source/OSM.js';
import ngeoMapModule from 'ngeo/map/module.js';
import ngeoOfflineModule from 'ngeo/offline/module.js';
import ngeoOfflineConfiguration from 'ngeo/offline/Configuration.js';
import NgeoOfflineServiceManager from 'ngeo/offline/ServiceManager.js';
import angular from 'angular';


/** @type {!angular.IModule} **/
exports.module = angular.module('app', [
'gettext',
ngeoMapModule.name,
ngeoOfflineModule.name,
NgeoOfflineServiceManager.module.name,
]);

exports.module.value('ngeoOfflineTestUrl', '../../src/offline/component.html');

// Define the offline download configuration service
ngeoOfflineModule.service('ngeoOfflineConfiguration', ngeoOfflineConfiguration);

class MainController {

/**
* @param {import("ngeo/map/FeatureOverlayMgr.js").FeatureOverlayMgr} ngeoFeatureOverlayMgr
* ngeo feature overlay manager service.
* @param {import("ngeo/offline/NetworkStatus.js").default} ngeoNetworkStatus ngeo network status service.
* @param {NgeoOfflineServiceManager} ngeoOfflineServiceManager ngeo offline service.
* @ngInject
*/
constructor(ngeoFeatureOverlayMgr, ngeoNetworkStatus, ngeoOfflineServiceManager) {

/**
* Save a square of 10 km sideways (Map's unit is the meter).
* @type {number}
* @export
*/
this.offlineExtentSize = 10000;

/**
* @type {ngeoNetworkStatus}
* @export
*/
this.ngeoNetworkStatus = ngeoNetworkStatus;

/**
* @type {olMap}
* @export
*/
this.map = new olMap({
layers: [
new olLayerTile({
source: new olSourceOSM()
})
],
view: new olView({
center: [352379, 5172733],
zoom: 4
})
});

ngeoFeatureOverlayMgr.init(this.map);

ngeoOfflineServiceManager.setSaveService('offlineDownloader');
ngeoOfflineServiceManager.setRestoreService('ngeoOfflineRestorer');
}
}


exports.module.controller('MainController', MainController);


export default exports;
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "3.0.5",
"loader-utils": "1.2.3",
"localforage": "^1.7.3",
"ls": "0.2.1",
"moment": "2.22.2",
"node-sass": "4.12.0",
Expand All @@ -122,11 +123,10 @@
"ts-node": "8.1.0",
"tsconfig-paths": "3.8.0",
"typedoc": "0.14.2",
"typescript": "3.1.6",
"typescript": "^3.4.5",
"webpack": "4.30.0",
"webpack-cli": "3.3.0",
"webpack-dev-server": "3.3.1",
"webpack-merge": "4.2.1"
},
"dependencies": {}
}
}
2 changes: 1 addition & 1 deletion src/format/FeatureHash.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export default class extends olFormatTextFeature {
if (this.encodeStyles_) {
const styleFunction = feature.getStyleFunction();
if (styleFunction !== undefined) {
let styles = styleFunction.call(feature, 0);
let styles = styleFunction(feature, 0);
if (styles !== null) {
const encodedStyles = [];
styles = Array.isArray(styles) ? styles : [styles];
Expand Down
2 changes: 1 addition & 1 deletion src/layertree/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export const LayertreeVisitorDecision = {


/**
* @typedef {function(LayertreeController): (!LayertreeVisitorDecision|undefined)} Visitor
* @typedef {function(LayertreeController): (!LayertreeVisitorDecision|void)} Visitor
*/


Expand Down
2 changes: 1 addition & 1 deletion src/map/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function mapComponent($window) {
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
// Get the 'ol.Map' object from attributes and manage it accordingly
// Get the 'import("ol/Map.js").default' object from attributes and manage it accordingly
const attr = 'ngeoMap';
const prop = attrs[attr];

Expand Down
Loading