Skip to content

Commit

Permalink
Merge pull request #4911 from camptocamp/less_ts-ignore
Browse files Browse the repository at this point in the history
Remove some ts-ignore
  • Loading branch information
fredj committed May 28, 2019
2 parents 63a4c32 + 0301ac3 commit 3232574
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 26 deletions.
2 changes: 1 addition & 1 deletion contribs/gmf/src/lidarprofile/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class LidarprofileManager {

/**
* Set the line for the profile
* @param {import("ol/geom/LineString.js").default} line that defines the profile
* @param {?import("ol/geom/LineString.js").default} line that defines the profile
*/
setLine(line) {
this.line_ = line;
Expand Down
1 change: 0 additions & 1 deletion contribs/gmf/src/lidarprofile/panelComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ class Controller {
*/
clearAll() {
this.line = null;
// @ts-ignore: OL issue
this.profile.setLine(null);
this.profile.cartoHighlight.setPosition(undefined);
this.clearMeasure();
Expand Down
15 changes: 5 additions & 10 deletions src/olcs/Service.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* global Cesium */

import angular from 'angular';
import ngeoMiscDebounce from 'ngeo/misc/debounce.js';
import ngeoStatemanagerLocation from 'ngeo/statemanager/Location.js';
import {Permalink3dParam} from 'ngeo/olcs/constants.js';
import ngeoStatemanagerService from 'ngeo/statemanager/Service.js';
import {toDegrees} from 'ol/math.js';

/**
* @hidden
Expand Down Expand Up @@ -112,15 +111,11 @@ export const OlcsService = class {
const position = camera.positionCartographic;
this.ngeoStateManager_.updateState({
[Permalink3dParam.ENABLED]: true,
// @ts-ignore: Cesium
[Permalink3dParam.LON]: Cesium.Math.toDegrees(position.longitude).toFixed(5),
// @ts-ignore: Cesium
[Permalink3dParam.LAT]: Cesium.Math.toDegrees(position.latitude).toFixed(5),
[Permalink3dParam.LON]: toDegrees(position.longitude).toFixed(5),
[Permalink3dParam.LAT]: toDegrees(position.latitude).toFixed(5),
[Permalink3dParam.ELEVATION]: position.height.toFixed(0),
// @ts-ignore: Cesium
[Permalink3dParam.HEADING]: Cesium.Math.toDegrees(camera.heading).toFixed(3),
// @ts-ignore: Cesium
[Permalink3dParam.PITCH]: Cesium.Math.toDegrees(camera.pitch).toFixed(3)
[Permalink3dParam.HEADING]: toDegrees(camera.heading).toFixed(3),
[Permalink3dParam.PITCH]: toDegrees(camera.pitch).toFixed(3)
});
}, 1000, true));

Expand Down
8 changes: 3 additions & 5 deletions src/olcs/controls3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import angular from 'angular';
import * as olEasing from 'ol/easing.js';
import {toRadians} from 'ol/math.js';
import olcsCore from 'olcs/core.js';


Expand Down Expand Up @@ -205,9 +206,7 @@ const Controller = class {
if (!this.ol3dm) {
throw new Error('Missing ol3dm');
}
// @ts-ignore: Cesium
angle = Cesium.Math.toRadians(angle);
this.ol3dm.setHeading(angle);
this.ol3dm.setHeading(toRadians(angle));
}


Expand All @@ -218,8 +217,7 @@ const Controller = class {
if (!this.ol3dm) {
throw new Error('Missing ol3dm');
}
// @ts-ignore: Cesium
angle = Cesium.Math.toRadians(angle);
angle = toRadians(angle);
const tiltOnGlobe = this.ol3dm.getTiltOnGlobe();
if (tiltOnGlobe == undefined) {
throw new Error('Missing tiltOnGlobe');
Expand Down
12 changes: 6 additions & 6 deletions src/routing/NominatimService.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import ngeoMiscDebounce from 'ngeo/misc/debounce.js';
/**
* @typedef {Object} NominatimSearchResult
* @property {string} name
* @property {string} label
* @property {import("ol/coordinate.js").Coordinate} coordinate
* @property {string} [label]
* @property {Array<string>} coordinate
*/


/**
* @typedef {Object} NominatimSearchResponseResult
* @property {string} display_name
* @property {number} lon
* @property {number} lat
* @property {string} lon
* @property {string} lat
*/


Expand Down Expand Up @@ -168,10 +168,10 @@ NominatimService.prototype.typeaheadSource_ = function(query, syncResults, async
* @return {NominatimSearchResult} Parsed result
*/
const parse = function(result) {
return /** @type {NominatimSearchResult} */({
return {
coordinate: [result.lon, result.lat],
name: result.display_name
});
};
};
if (asyncResults) {
asyncResults(resp.data.map(parse));
Expand Down
5 changes: 2 additions & 3 deletions src/routing/RoutingFeatureComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ class Controller {
if (!this.feature || !this.map) {
return;
}
// @ts-ignore: If types are not respected
const coordinate = selected.coordinate.map(parseFloat);
const label = selected.label;
this.setFeature_(coordinate, label);
Expand All @@ -353,8 +352,8 @@ class Controller {
* @param {angular.IHttpResponse<import('./NominatimService').NominatimSearchResponseResult>} resp
*/
const onSuccess = (resp) => {
const lon = resp.data.lon;
const lat = resp.data.lat;
const lon = parseFloat(resp.data.lon);
const lat = parseFloat(resp.data.lat);
const coordinate = [lon, lat];
const label = resp.data.display_name;
this.setFeature_(coordinate, label);
Expand Down

0 comments on commit 3232574

Please sign in to comment.