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.4 into master #4921

Merged
merged 12 commits into from
Jun 4, 2019
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ rules:
max-len:
- error
- code: 110
ignoreComments: true
2 changes: 1 addition & 1 deletion api/src/Themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ const capabilities = new Map();
* @return {Promise<Object>} Any
*/
function getWMTSCapability(url) {
if (!(url in capabilities)) {
if (!capabilities.has(url)) {
const request = fetch(url)
.then(response => response.text())
.then((capability) => {
Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/examples/layertree.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import appURL from './url.js';
import './layertree.css';
Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/examples/layertreeadd.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import appURL from './url.js';
import './layertreeadd.css';
Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/examples/xsdattributes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import appURL from './url.js';
import './xsdattributes.css';
Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/src/controllers/AbstractAppController.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import 'jquery';
import angular from 'angular';
import 'angular-gettext';
Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/src/datasource/ExternalDataSourcesManager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

// TODO - MaxScaleDenominator
// TODO - MinScaleDenominator

Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/src/datasource/Helper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import gmfEditingEnumerateAttribute from 'gmf/editing/EnumerateAttribute.js';
import ngeoDatasourceHelper from 'ngeo/datasource/Helper.js';
Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/src/editing/editFeatureComponent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import gmfEditingEditFeature from 'gmf/editing/EditFeature.js';

Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/src/filters/filterselectorComponent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import {CollectionEvent} from 'ol/Collection.js';
import gmfAuthenticationService from 'gmf/authentication/Service.js';
Expand Down
1 change: 0 additions & 1 deletion contribs/gmf/src/import/importdatasourceComponent.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */
/* global Bloodhound */

import angular from 'angular';
Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/src/layertree/component.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import {DATALAYERGROUP_NAME} from 'gmf/index.js';
import gmfDatasourceDataSourceBeingFiltered from 'gmf/datasource/DataSourceBeingFiltered.js';
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/src/lidarprofile/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ export class LidarprofileManager {
} catch (e) {
if (!this.isPlotSetup_) {
const canvas = d3select('#gmf-lidarprofile-container .lidar-canvas');
const canvasEl = canvas.node();
const ctx = canvasEl.getContext('2d');
const canvasEl = /** @type {HTMLCanvasElement} */ (canvas.node());
const ctx = /** @type {CanvasRenderingContext2D} */ (canvasEl.getContext('2d'));
ctx.clearRect(0, 0, canvasEl.getBoundingClientRect().width, canvasEl.getBoundingClientRect().height);
canvas.selectAll('*').remove();
const errorTxt = this.getHTMLError_();
Expand Down
8 changes: 6 additions & 2 deletions contribs/gmf/src/lidarprofile/Measure.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ export default class {
throw new Error('Missing manager.plot');
}
const svg = d3select('#gmf-lidarprofile-container svg.lidar-svg');
const svgCoordinates = d3mouse(svg.node());
const canvasCoordinates = d3mouse(d3select('#gmf-lidarprofile-container .lidar-canvas').node());
const svgEl = /** @type {HTMLElement} */ (svg.node());
const canvas = d3select('#gmf-lidarprofile-container .lidar-canvas');
const canvasEl = /** @type {HTMLCanvasElement} */ (canvas.node());

const svgCoordinates = d3mouse(svgEl);
const canvasCoordinates = d3mouse(canvasEl);
const margin = this.manager_.config.clientConfig.margin;
const xs = svgCoordinates[0];
const ys = svgCoordinates[1];
Expand Down
36 changes: 22 additions & 14 deletions contribs/gmf/src/lidarprofile/Plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ export default class {
let i = -1;
const nPoints = points.distance.length;
let cx, cy;
const ctx = d3select('#gmf-lidarprofile-container .lidar-canvas').node().getContext('2d');
const canvas = d3select('#gmf-lidarprofile-container .lidar-canvas');
const canvasEl = /** @type {HTMLCanvasElement} */ (canvas.node());
const ctx = /** @type {CanvasRenderingContext2D} */ (canvasEl.getContext('2d'));
const profileServerConfig = this.manager_.config.serverConfig;

while (++i < nPoints) {
Expand Down Expand Up @@ -151,12 +153,13 @@ export default class {
throw new Error('Missing manager_.config.serverConfig');
}
const canvas = d3select('#gmf-lidarprofile-container .lidar-canvas');
const canvasEl = canvas.node();
const ctx = canvasEl.getContext('2d');
const canvasEl = /** @type {HTMLCanvasElement} */ (canvas.node());
const ctx = /** @type {CanvasRenderingContext2D} */ (canvasEl.getContext('2d'));
ctx.clearRect(0, 0, canvasEl.getBoundingClientRect().width, canvasEl.getBoundingClientRect().height);

const margin = this.manager_.config.clientConfig.margin;
const containerEl = d3select('#gmf-lidarprofile-container').node();
const container = d3select('#gmf-lidarprofile-container');
const containerEl = /** @type {HTMLElement} */ (container.node());
const containerWidth = containerEl.getBoundingClientRect().width;
const containerHeight = containerEl.getBoundingClientRect().height;
this.width_ = containerWidth - (margin.left + margin.right);
Expand Down Expand Up @@ -217,7 +220,7 @@ export default class {

const svg = d3select('#gmf-lidarprofile-container svg.lidar-svg');

svg.call(zoom).on('dblclick.zoom', null);
svg.call(/** @type {any} */ (zoom)).on('dblclick.zoom', null);

svg.selectAll('*').remove();

Expand Down Expand Up @@ -261,8 +264,9 @@ export default class {
return;
}
this.moved_ = false;
const ctx = d3select('#gmf-lidarprofile-container .lidar-canvas')
.node().getContext('2d');
const canvas = d3select('#gmf-lidarprofile-container .lidar-canvas');
const canvasEl = /** @type {HTMLCanvasElement} */ (canvas.node());
const ctx = /** @type {CanvasRenderingContext2D} */ (canvasEl.getContext('2d'));
ctx.clearRect(0, 0, this.width_, this.height_);
this.manager_.updateData();
}
Expand Down Expand Up @@ -299,11 +303,12 @@ export default class {
const new_scaleX = tr.rescaleX(this.scaleX);
const new_scaleY = tr.rescaleY(this.scaleY);

svg.select('.x.axis').call(xAxis.scale(new_scaleX));
svg.select('.y.axis').call(yAxis.scale(new_scaleY));
svg.select('.x.axis').call(/** @type {any} */ (xAxis.scale(new_scaleX)));
svg.select('.y.axis').call(/** @type {any} */ (yAxis.scale(new_scaleY)));

const ctx = d3select('#gmf-lidarprofile-container .lidar-canvas')
.node().getContext('2d');
const canvas = d3select('#gmf-lidarprofile-container .lidar-canvas');
const canvasEl = /** @type {HTMLCanvasElement} */ (canvas.node());
const ctx = /** @type {CanvasRenderingContext2D} */ (canvasEl.getContext('2d'));
ctx.clearRect(0, 0, this.width_, this.height_);

svg.select('.y.axis').selectAll('g.tick line')
Expand Down Expand Up @@ -333,7 +338,9 @@ export default class {
const margin = this.manager_.config.clientConfig.margin;
const tolerance = this.manager_.config.clientConfig.tolerance || 0;

const canvasCoordinates = d3mouse(d3select('#gmf-lidarprofile-container .lidar-canvas').node());
const canvas = d3select('#gmf-lidarprofile-container .lidar-canvas');
const canvasEl = /** @type {HTMLCanvasElement} */ (canvas.node());
const canvasCoordinates = d3mouse(canvasEl);
const classification_colors = this.manager_.config.serverConfig.classification_colors;

let cx, cy;
Expand Down Expand Up @@ -443,8 +450,9 @@ export default class {
*/
changeStyle(material) {
this.material = material;
const canvasEl = d3select('#gmf-lidarprofile-container .lidar-canvas').node();
const ctx = canvasEl.getContext('2d');
const canvas = d3select('#gmf-lidarprofile-container .lidar-canvas');
const canvasEl = /** @type {HTMLCanvasElement} */ (canvas.node());
const ctx = /** @type {CanvasRenderingContext2D} */ (canvasEl.getContext('2d'));
ctx.clearRect(0, 0, canvasEl.width, canvasEl.height);
this.drawPoints(this.manager_.profilePoints);
}
Expand Down
10 changes: 5 additions & 5 deletions contribs/gmf/src/lidarprofile/Utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import olFeature from 'ol/Feature.js';
import olGeomLineString from 'ol/geom/LineString.js';
import olGeomPoint from 'ol/geom/Point.js';
Expand Down Expand Up @@ -250,14 +248,16 @@ export default class {
ctx.fillRect(0, 0, w, h);

// Draw the profile canvas (the points) into the new canvas.
const profileCanvas = d3select('#gmf-lidarprofile-container .lidar-canvas').node();
ctx.drawImage(profileCanvas, margin.left, margin.top,
const profileCanvas = d3select('#gmf-lidarprofile-container .lidar-canvas');
const profileCanvasEl = /** @type {HTMLCanvasElement} */ (profileCanvas.node());
ctx.drawImage(profileCanvasEl, margin.left, margin.top,
w - (margin.left + margin.right), h - (margin.top + margin.bottom));

// Add transforms the profile into an image.
const exportImage = new Image();
const serializer = new XMLSerializer();
const svgStr = serializer.serializeToString(profileSVG.node());
const profileSVGEl = /** @type {HTMLElement} */ (profileSVG.node());
const svgStr = serializer.serializeToString(profileSVGEl);

// Draw the image of the profile into the context of the new canvas.
const img_id = 'lidare_profile_for_export_uid';
Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/src/objectediting/component.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import gmfEditingEditFeature from 'gmf/editing/EditFeature.js';
import gmfLayertreeSyncLayertreeMap, {getLayer as syncLayertreeMapGetLayer}
Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/src/objectediting/toolsComponent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';

import gmfObjecteditingGetWMSFeatureComponent from 'gmf/objectediting/getWMSFeatureComponent.js';
Expand Down
12 changes: 6 additions & 6 deletions contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -1416,13 +1416,13 @@ export class PrintController {
}
}
}
if (!legendImage) {
throw new Error('Missing legendImage');

if (legendImage) {
return {
url: legendImage,
dpi: found_dpi,
};
}
return {
url: legendImage,
dpi: found_dpi,
};
}


Expand Down
8 changes: 1 addition & 7 deletions contribs/gmf/src/raster/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ module.directive('gmfElevation', rasterComponent);
* @hidden
* @param {angular.IScope} $scope Scope.
* @param {angular.IFilterService} $filter Angular filter.
* @param {import("ngeo/misc/debounce.js").miscDebounce<function(Event|import('ol/events/Event.js').default):
* void>} ngeoDebounce Ngeo debounce factory
* @param {import("ngeo/misc/debounce.js").miscDebounce<function(Event|import('ol/events/Event.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 @@ -148,26 +147,21 @@ module.directive('gmfElevation', rasterComponent);
function Controller($scope, $filter, ngeoDebounce, gmfRaster, gettextCatalog) {

/**
* @type {angular.IFilterService}
* @private
*/
this.filter_ = $filter;

/**
* @type {import("ngeo/misc/debounce.js").miscDebounce<
* function(Event|import('ol/events/Event.js').default): void>}
* @private
*/
this.ngeoDebounce_ = ngeoDebounce;

/**
* @type {import("gmf/raster/RasterService.js").RasterService}
* @private
*/
this.gmfRaster_ = gmfRaster;

/**
* @type {angular.gettext.gettextCatalog}
* @private
*/
this.gettextCatalog = gettextCatalog;
Expand Down
2 changes: 0 additions & 2 deletions contribs/gmf/src/search/component.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import {COORDINATES_LAYER_NAME} from 'gmf/index.js';
import gmfLayertreeTreeManager from 'gmf/layertree/TreeManager.js';
Expand Down
2 changes: 1 addition & 1 deletion examples/common_dependencies.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './common_dependencies.scss'
import './common_dependencies.scss';
import 'jquery';
import 'angular';
import 'angular-gettext';
Expand Down
2 changes: 0 additions & 2 deletions examples/locationsearch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import './locationsearch.css';
import angular from 'angular';

Expand Down
2 changes: 0 additions & 2 deletions examples/permalink.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import './permalink.css';
import angular from 'angular';
import ngeoFormatFeatureHash from 'ngeo/format/FeatureHash.js';
Expand Down
2 changes: 0 additions & 2 deletions examples/search.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import {SEARCH} from './url.js';
import './search.css';
Expand Down
2 changes: 0 additions & 2 deletions src/editing/createfeatureComponent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import ngeoMiscFilters from 'ngeo/misc/filters.js';
import ngeoGeometryType from 'ngeo/GeometryType.js';
Expand Down
2 changes: 0 additions & 2 deletions src/filter/RuleHelper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import ngeoFilterCondition from 'ngeo/filter/Condition.js';
import ngeoFormatAttributeType from 'ngeo/format/AttributeType.js';
Expand Down
2 changes: 0 additions & 2 deletions src/format/FeatureHash.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import ngeoFormatFeatureProperties from 'ngeo/format/FeatureProperties.js';
import ngeoFormatFeatureHashStyleType from 'ngeo/format/FeatureHashStyleType.js';
import {rgbArrayToHex} from 'ngeo/utils.js';
Expand Down
2 changes: 0 additions & 2 deletions src/interaction/Measure.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import ngeoCustomEvent from 'ngeo/CustomEvent.js';
import * as olDom from 'ol/dom.js';
import * as olProj from 'ol/proj.js';
Expand Down
2 changes: 0 additions & 2 deletions src/map/FeatureOverlay.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import * as olEvents from 'ol/events.js';
import {CollectionEvent} from 'ol/Collection.js';
Expand Down
2 changes: 0 additions & 2 deletions src/message/Disclaimer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import 'bootstrap/js/src/alert.js';

Expand Down
2 changes: 0 additions & 2 deletions src/message/Notification.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import 'bootstrap/js/src/alert.js';

Expand Down
2 changes: 0 additions & 2 deletions src/misc/filters.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import angular from 'angular';
import {modulo} from 'ol/math.js';
import {padNumber} from 'ol/string.js';
Expand Down
4 changes: 3 additions & 1 deletion src/misc/php-date-formatter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @ts-nocheck
/* eslint max-len: 0 */

/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2017
Expand All @@ -16,6 +15,9 @@
* For more Yii related demos visit http://demos.krajee.com
*/


/* eslint max-len: 0 */
/* eslint @openlayers/valid-tsdoc: 0 */
/* eslint valid-jsdoc: 0 */
/* eslint quotes: 0 */
/* eslint indent: 0 */
Expand Down
2 changes: 0 additions & 2 deletions src/print/VectorEncoder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint max-len: ["error", { "code": 110, "ignoreComments": true }] */

import {rgbArrayToHex} from 'ngeo/utils.js';
import {getUid as olUtilGetUid} from 'ol/util.js';
import olFormatGeoJSON from 'ol/format/GeoJSON.js';
Expand Down
Loading