diff --git a/README.md b/README.md index 52a3777f..fb4aeded 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Refer to the [Examples](https://github.com/mapillary/mapillary-js#examples) and - [Change filters](https://bl.ocks.org/oscarlorentzon/10dad7582268312b1adac2c3a869c5c5) - [Get center and zoom](https://bl.ocks.org/oscarlorentzon/752ffc27a31299f4ec9eb5b4e09b2d82) - [Set center and zoom](https://bl.ocks.org/oscarlorentzon/54ef2277ce60e62f51891af699fad871) -- [LatLon, computedLatLon and originalLatLon explained](https://bl.ocks.org/oscarlorentzon/16946cb9eedfad2a64669cb1121e6c75) +- [LngLat, computedLngLat and originalLngLat explained](https://bl.ocks.org/oscarlorentzon/16946cb9eedfad2a64669cb1121e6c75) - [Get bearing](https://bl.ocks.org/oscarlorentzon/ca9cee671156c685aca3e1f0f52a230e) - [Side by side compare](https://bl.ocks.org/oscarlorentzon/1f2992f9f510d908a0a2c7212f0359cf) diff --git a/docs/landing.md b/docs/landing.md index 9d52c13a..60fa3e03 100644 --- a/docs/landing.md +++ b/docs/landing.md @@ -55,7 +55,7 @@ Refer to the [Examples](#examples) section below and the [Index](./modules.html) - [Change filters](https://bl.ocks.org/oscarlorentzon/10dad7582268312b1adac2c3a869c5c5) - [Get center and zoom](https://bl.ocks.org/oscarlorentzon/752ffc27a31299f4ec9eb5b4e09b2d82) - [Set center and zoom](https://bl.ocks.org/oscarlorentzon/54ef2277ce60e62f51891af699fad871) -- [LatLon, computedLatLon and originalLatLon explained](https://bl.ocks.org/oscarlorentzon/16946cb9eedfad2a64669cb1121e6c75) +- [LngLat, computedLngLat and originalLngLat explained](https://bl.ocks.org/oscarlorentzon/16946cb9eedfad2a64669cb1121e6c75) - [Get bearing](https://bl.ocks.org/oscarlorentzon/ca9cee671156c685aca3e1f0f52a230e) - [Side by side compare](https://bl.ocks.org/oscarlorentzon/1f2992f9f510d908a0a2c7212f0359cf) diff --git a/examples/leaflet.html b/examples/leaflet.html index 182e643d..070e4508 100644 --- a/examples/leaflet.html +++ b/examples/leaflet.html @@ -68,7 +68,7 @@ (e) => { console.error(e); }); - // Show original latLon and latLon (if computed exist it will differ) of current + // Show original lngLat and lngLat (if computed exist it will differ) of current // viewer image on map. Show line linking the two points together const mapimagePosition = { line: L.polyline([[0, 0], [0, 0]], { color: '#0ff', weight: 1 }), @@ -78,14 +78,14 @@ mly.on('image', (event) => { const image = event.node; - const latLon = [image.latLon.lat, node.latLon.lon]; - const originalLatLon = [image.originalLatLon.lat, node.originalLatLon.lon]; + const lngLat = [image.lngLat.lat, node.lngLat.lng]; + const originalLngLat = [image.originalLngLat.lat, node.originalLngLat.lng]; - mapimagePosition.line.setLatLngs([originalLatLon, latLon]); - mapimagePosition.originalPos.setLatLng(originalLatLon); - mapimagePosition.pos.setLatLng(latLon); + mapimagePosition.line.setLatLngs([originalLngLat, lngLat]); + mapimagePosition.originalPos.setLatLng(originalLngLat); + mapimagePosition.pos.setLatLng(lngLat); - map.setView(latLon); + map.setView(lngLat); if (!map.hasLayer(mapimagePosition.line)) { mapimagePosition.line.addTo(map); @@ -162,10 +162,10 @@ } } - const setViewerIndicatorMarker = (latLon) => { + const setViewerIndicatorMarker = (lngLat) => { const viewerMarker = new Marker.CircleMarker( indicator.id, - latLon, + lngLat, { color: '#0f0' }); markerComponent.add([viewerMarker]); @@ -173,10 +173,10 @@ indicator.viewerMarker = viewerMarker; } - const moveIndicatorMarker = (latLon) => { + const moveIndicatorMarker = (lngLat) => { if (indicator.state.dragging) { return; } - if (latLon == null) { + if (lngLat == null) { removeMapIndicator(); removeViewerIndicator(); return; @@ -185,24 +185,24 @@ const posLatLng = mapimagePosition.pos.getLatLng(); const lineString = [ [posLatLng.lat, posLatLng.lng], - [latLon.lat, latLon.lon], + [lngLat.lat, lngLat.lng], [ - posLatLng.lat + 5 * (latLon.lat - posLatLng.lat), - posLatLng.lng + 5 * (latLon.lon - posLatLng.lng), + posLatLng.lat + 5 * (lngLat.lat - posLatLng.lat), + posLatLng.lng + 5 * (lngLat.lng - posLatLng.lng), ], ]; indicator.mapLine.setLatLngs(lineString); - indicator.mapMarker.setLatLng([latLon.lat, latLon.lon]); + indicator.mapMarker.setLatLng([lngLat.lat, lngLat.lng]); - setViewerIndicatorMarker({ lat: latLon.lat, lon: latLon.lon }); + setViewerIndicatorMarker({ lat: lngLat.lat, lng: lngLat.lng }); addMapIndicator(); } const onViewerMouseEvent = (event) => { indicator.state.lastPos = event.pixelPoint; - moveIndicatorMarker(event.latLon); + moveIndicatorMarker(event.lngLat); } mly.on('mouseup', onViewerMouseEvent); @@ -215,7 +215,7 @@ if (indicator.state.moving || indicator.state.dragging) { return; } - moveIndicatorMarker(event.latLon); + moveIndicatorMarker(event.lngLat); }); @@ -231,7 +231,7 @@ if (!indicator.state.lastPos) { return; } - // Unproject the last position and move indicator marker if latLon exist + // Unproject the last position and move indicator marker if lngLat exist mly.unproject(indicator.state.lastPos).then(moveIndicatorMarker); }); @@ -247,7 +247,7 @@ if (!indicator.state.lastPos) { return; } - // Unproject the last position and move indicator marker if latLon exist + // Unproject the last position and move indicator marker if lngLat exist mly.unproject(indicator.state.lastPos).then(moveIndicatorMarker); }); @@ -256,12 +256,12 @@ let addedMarkerId = 0; const mapMarkers = {}; - const addOrReplaceViewerMarker = (id, latLon) => { + const addOrReplaceViewerMarker = (id, lngLat) => { // Create an interactive marker to be able to drag it in viewer // and retrieve it with getMarkerIdAt method const marker = new Marker.SimpleMarker( id, - latLon, + lngLat, { ballColor: '#f00', color: '#f00', interactive: true }); markerComponent.add([marker]); @@ -302,14 +302,14 @@ }); } - const createMarker = (latLon) => { + const createMarker = (lngLat) => { const id = (addedMarkerId++).toString(); - addOrReplaceViewerMarker(id, latLon); + addOrReplaceViewerMarker(id, lngLat); const mapMarker = L.circleMarker( - [latLon.lat, latLon.lon], + [lngLat.lat, lngLat.lng], { radius: 5, color: '#f00', draggable: 'true', id: id }) .addTo(map); @@ -318,13 +318,13 @@ } mly.on('click', (e) => { - if (!e.latLon) { return; } + if (!e.lngLat) { return; } markerComponent.getMarkerIdAt(e.pixelPoint).then((markerId) => { // Only create a new marker if no interactive markers are hovered if (markerId != null) { return; } - createMarker(e.latLon); + createMarker(e.lngLat); }); }); @@ -337,7 +337,7 @@ map.on('click', mapOnClick); - // Update map marker when latLon changes for a + // Update map marker when lngLat changes for a // marker by dragging in the viewer. markerComponent.on("markerposition", (e) => { const mapMarker = mapMarkers[e.marker.id]; @@ -345,7 +345,7 @@ return; } - mapMarker.setLatLng([e.marker.latLon.lat, e.marker.latLon.lon]); + mapMarker.setLatLng([e.marker.lngLat.lat, e.marker.lngLat.lng]); }); diff --git a/examples/marker.html b/examples/marker.html index 013e020a..16e88d11 100644 --- a/examples/marker.html +++ b/examples/marker.html @@ -68,8 +68,8 @@ console.log("Average marker add time:", (totalAddTime / addTimes.length / batchSize).toFixed(4)); }; - // Create markers in a bounding box with center at latLon - const createRandomMarkers = function (start, count, latLon) { + // Create markers in a bounding box with center at lngLat + const createRandomMarkers = function (start, count, lngLat) { const getRandomUniform = function (min, max) { return Math.random() * (max - min) + min; }; @@ -77,10 +77,10 @@ const t0 = window.performance.now(); const boxWidth = 0.1; - const minLat = latLon.lat - boxWidth / 2; - const maxLat = latLon.lat + boxWidth / 2; - const minLon = latLon.lon - boxWidth / 2; - const maxLon = latLon.lon + boxWidth / 2; + const minLat = lngLat.lat - boxWidth / 2; + const maxLat = lngLat.lat + boxWidth / 2; + const minLon = lngLat.lng - boxWidth / 2; + const maxLon = lngLat.lng + boxWidth / 2; const markers = []; for (let i = start; i < start + count; i++) { @@ -110,7 +110,7 @@ .then( function (n) { let intervalId = window.setInterval(function () { - const markers = createRandomMarkers(markerCount, batchSize, n.latLon); + const markers = createRandomMarkers(markerCount, batchSize, n.lngLat); addMarkers(markers); markerCount += batchSize; diff --git a/src/api/GeohashGeometryProvider.ts b/src/api/GeohashGeometryProvider.ts index 9913b8c9..e8a614ab 100644 --- a/src/api/GeohashGeometryProvider.ts +++ b/src/api/GeohashGeometryProvider.ts @@ -1,7 +1,7 @@ import * as geohash from "latlon-geohash"; import { GeometryProviderBase } from "./GeometryProviderBase"; -import { LatLon } from "./interfaces/LatLon"; +import { LngLat } from "./interfaces/LngLat"; /** @@ -34,22 +34,22 @@ export class GeohashGeometryProvider extends GeometryProviderBase { * The method currently uses the largest side as the threshold leading to * more tiles being returned than needed in edge cases. * - * @param {LatLon} sw - South west corner of bounding box. - * @param {LatLon} ne - North east corner of bounding box. + * @param {LngLat} sw - South west corner of bounding box. + * @param {LngLat} ne - North east corner of bounding box. * * @returns {string} The geohash tiles containing the bounding box. */ - public bboxToCellIds(sw: LatLon, ne: LatLon): string[] { + public bboxToCellIds(sw: LngLat, ne: LngLat): string[] { return this._approxBboxToCellIds(sw, ne); } /** @inheritdoc */ - public getVertices(cellId: string): LatLon[] { + public getVertices(cellId: string): LngLat[] { const bounds = geohash.bounds(cellId); - const nw = { lat: bounds.ne.lat, lon: bounds.sw.lon }; - const ne = { lat: bounds.ne.lat, lon: bounds.ne.lon }; - const se = { lat: bounds.sw.lat, lon: bounds.ne.lon }; - const sw = { lat: bounds.sw.lat, lon: bounds.sw.lon }; + const nw: LngLat = { lat: bounds.ne.lat, lng: bounds.sw.lon }; + const ne: LngLat = { lat: bounds.ne.lat, lng: bounds.ne.lon }; + const se: LngLat = { lat: bounds.sw.lat, lng: bounds.ne.lon }; + const sw: LngLat = { lat: bounds.sw.lat, lng: bounds.sw.lon }; return [nw, ne, se, sw]; } @@ -71,15 +71,15 @@ export class GeohashGeometryProvider extends GeometryProviderBase { /** * Encode the geohash tile for geodetic coordinates. * - * @param {LatLon} latlon - Latitude and longitude to encode. + * @param {LngLat} lngLat - Latitude and longitude to encode. * @param {number} precision - Precision of the encoding. * * @returns {string} The geohash tile for the lat, lon and precision. */ - public latLonToCellId(latLon: LatLon): string { + public lngLatToCellId(lngLat: LngLat): string { return geohash.encode( - latLon.lat, - latLon.lon, + lngLat.lat, + lngLat.lng, this._level); } } diff --git a/src/api/GeometryProviderBase.ts b/src/api/GeometryProviderBase.ts index c7b2eb9a..474cec4e 100644 --- a/src/api/GeometryProviderBase.ts +++ b/src/api/GeometryProviderBase.ts @@ -3,7 +3,7 @@ import { enuToGeodetic, geodeticToEnu, } from "../geo/GeoCoords"; -import { LatLon } from "./interfaces/LatLon"; +import { LngLat } from "./interfaces/LngLat"; /** * @class GeometryProviderBase @@ -32,12 +32,12 @@ export abstract class GeometryProviderBase { * to be sufficiently small to be contained in an area with the size * of maximally four tiles. Up to nine adjacent tiles may be returned. * - * @param {LatLon} sw - South west corner of bounding box. - * @param {LatLon} ne - North east corner of bounding box. + * @param {LngLat} sw - South west corner of bounding box. + * @param {LngLat} ne - North east corner of bounding box. * * @returns {Array} Array of cell ids. */ - public bboxToCellIds(sw: LatLon, ne: LatLon): string[] { + public bboxToCellIds(sw: LngLat, ne: LngLat): string[] { throw new MapillaryError("Not implemented"); } @@ -61,36 +61,36 @@ export abstract class GeometryProviderBase { * vertex relative to the others can be made. * * @param {string} cellId - Id of cell. - * @returns {Array} Unclosed clockwise polygon. + * @returns {Array} Unclosed clockwise polygon. */ - public getVertices(cellId: string): LatLon[] { + public getVertices(cellId: string): LngLat[] { throw new MapillaryError("Not implemented"); } /** * Convert geodetic coordinates to a cell id. * - * @param {LatLon} latlon - Latitude and longitude to convert. + * @param {LngLat} lngLat - Latitude and longitude to convert. * @returns {string} Cell id for the latitude, longitude. */ - public latLonToCellId(latLon: LatLon): string { + public lngLatToCellId(lngLat: LngLat): string { throw new MapillaryError("Not implemented"); } /** @ignore */ - protected _approxBboxToCellIds(sw: LatLon, ne: LatLon): string[] { - if (ne.lat <= sw.lat || ne.lon <= sw.lon) { + protected _approxBboxToCellIds(sw: LngLat, ne: LngLat): string[] { + if (ne.lat <= sw.lat || ne.lng <= sw.lng) { throw new MapillaryError( "North east needs to be top right of south west"); } const centerLat = (sw.lat + ne.lat) / 2; - const centerLon = (sw.lon + ne.lon) / 2; + const centerLon = (sw.lng + ne.lng) / 2; const enu = geodeticToEnu( ne.lat, - ne.lon, + ne.lng, 0, centerLat, centerLon, @@ -98,29 +98,29 @@ export abstract class GeometryProviderBase { const threshold = Math.max(enu[0], enu[1]); - return this._latLonToCellIds( - { lat: centerLat, lon: centerLon }, + return this._lngLatToCellIds( + { lat: centerLat, lng: centerLon }, threshold); } /** @ignore */ - private _enuToGeodetic(point: number[], reference: LatLon): LatLon { + private _enuToGeodetic(point: number[], reference: LngLat): LngLat { const [lat, lon] = enuToGeodetic( point[0], point[1], point[2], reference.lat, - reference.lon, + reference.lng, 0); - return { lat, lon }; + return { lat, lng: lon }; } /** @ignore */ - private _getLatLonBoundingBoxCorners( - latLon: LatLon, + private _getLngLatBoundingBoxCorners( + lngLat: LngLat, threshold: number) - : LatLon[] { + : LngLat[] { return [ [-threshold, threshold, 0], @@ -128,8 +128,8 @@ export abstract class GeometryProviderBase { [threshold, -threshold, 0], [-threshold, -threshold, 0], ].map( - (point: number[]): LatLon => { - return this._enuToGeodetic(point, latLon); + (point: number[]): LngLat => { + return this._enuToGeodetic(point, lngLat); }); } @@ -140,7 +140,7 @@ export abstract class GeometryProviderBase { * The square is specified as a latitude, longitude * and a threshold from the position using Manhattan distance. * - * @param {LatLon} latlon - Latitude and longitude. + * @param {LngLat} lngLat - Latitude and longitude. * @param {number} threshold - Threshold of the conversion in meters. * * @returns {Array} Array of cell ids reachable within @@ -148,15 +148,15 @@ export abstract class GeometryProviderBase { * * @ignore */ - private _latLonToCellIds( - latLon: LatLon, + private _lngLatToCellIds( + lngLat: LngLat, threshold: number) : string[] { - const cellId = this.latLonToCellId(latLon); + const cellId = this.lngLatToCellId(lngLat); const bboxCorners = - this._getLatLonBoundingBoxCorners(latLon, threshold); + this._getLngLatBoundingBoxCorners(lngLat, threshold); for (const corner of bboxCorners) { - const cid = this.latLonToCellId(corner); + const cid = this.lngLatToCellId(corner); if (cid !== cellId) { return [cellId, ...this.getAdjacent(cellId)]; } diff --git a/src/api/S2GeometryProvider.ts b/src/api/S2GeometryProvider.ts index 55d50bbb..fc855238 100644 --- a/src/api/S2GeometryProvider.ts +++ b/src/api/S2GeometryProvider.ts @@ -1,7 +1,7 @@ import { S2 } from "s2-geometry"; import { GeometryProviderBase } from "./GeometryProviderBase"; -import { LatLon } from "./interfaces/LatLon"; +import { LngLat } from "./interfaces/LngLat"; /** * @class S2GeometryProvider @@ -25,7 +25,7 @@ export class S2GeometryProvider extends GeometryProviderBase { constructor(private readonly _level: number = 17) { super(); } /** @inheritdoc */ - public bboxToCellIds(sw: LatLon, ne: LatLon): string[] { + public bboxToCellIds(sw: LngLat, ne: LngLat): string[] { return this._approxBboxToCellIds(sw, ne); } @@ -61,20 +61,20 @@ export class S2GeometryProvider extends GeometryProviderBase { } /** @inheritdoc */ - public getVertices(cellId: string): LatLon[] { + public getVertices(cellId: string): LngLat[] { const key = S2.idToKey(cellId); const cell = S2.S2Cell.FromHilbertQuadKey(key); return cell .getCornerLatLngs() .map( - (c: S2.ILatLng): LatLon => { - return { lat: c.lat, lon: c.lng }; + (c: S2.ILatLng): LngLat => { + return { lat: c.lat, lng: c.lng }; }); } /** @inheritdoc */ - public latLonToCellId(latLon: LatLon): string { - return this._latLonToId(latLon, this._level); + public lngLatToCellId(lngLat: LngLat): string { + return this._lngLatToId(lngLat, this._level); } private _getNeighbors(s2key: string, level: number): string[] { @@ -87,10 +87,10 @@ export class S2GeometryProvider extends GeometryProviderBase { return neighbors; } - private _latLonToId(latLon: LatLon, level: number): string { + private _lngLatToId(lngLat: LngLat, level: number): string { const s2key = S2.latLngToKey( - latLon.lat, - latLon.lon, + lngLat.lat, + lngLat.lng, level); return S2.keyToId(s2key); diff --git a/src/api/ents/CoreImageEnt.ts b/src/api/ents/CoreImageEnt.ts index e67f4931..6aff0dd8 100644 --- a/src/api/ents/CoreImageEnt.ts +++ b/src/api/ents/CoreImageEnt.ts @@ -1,5 +1,5 @@ import { IDEnt } from "./IDEnt"; -import { LatLon } from "../interfaces/LatLon"; +import { LngLat } from "../interfaces/LngLat"; /** * Interface that describes the raw core image properties. @@ -13,12 +13,12 @@ export interface CoreImageEnt extends IDEnt { * @description Optional - no 3D interaction available * if unset. */ - computed_geometry?: LatLon; + computed_geometry?: LngLat; /** * Original EXIF latitude longitude in WGS84 datum, measured in degrees. */ - geometry: LatLon; + geometry: LngLat; /** * Sequence that the image is part of. diff --git a/src/api/falcor/FalcorConverter.ts b/src/api/falcor/FalcorConverter.ts index 1c31205f..167f6a9e 100644 --- a/src/api/falcor/FalcorConverter.ts +++ b/src/api/falcor/FalcorConverter.ts @@ -14,6 +14,7 @@ import { LatLonAlt } from "../interfaces/LatLonAlt"; import { CameraEnt } from "../ents/CameraEnt"; import { FalcorClusterReconstructionContract } from "./FalcorContracts"; import { isSpherical } from "../../geo/Geo"; +import { LngLat } from "../interfaces/LngLat"; function convertCameraType(falcorProjectionType: string): string { return falcorProjectionType === "equirectangular" ? @@ -95,7 +96,7 @@ export class FalcorConverter { const reference: LatLonAlt = { alt: lla.altitude, lat: lla.latitude, - lon: lla.longitude, + lng: lla.longitude, }; const shots = item.shots; return { @@ -108,8 +109,12 @@ export class FalcorConverter { } public core(item: T): CoreImageEnt { - const computedGeometry = item.cl; - const geometry = item.l; + const cl = item.cl; + const computedGeometry: LngLat = cl ? { + lat: cl.lat, + lng: cl.lon, + } : null; + const geometry: LngLat = { lat: item.l.lat, lng: item.l.lon }; const id = item.key; const sequence: IDEnt = { id: item.sequence_key }; return { diff --git a/src/api/interfaces/LatLonAlt.ts b/src/api/interfaces/LatLonAlt.ts index 1d7ec0cb..6922d3f5 100644 --- a/src/api/interfaces/LatLonAlt.ts +++ b/src/api/interfaces/LatLonAlt.ts @@ -1,4 +1,4 @@ -import { LatLon } from "./LatLon"; +import { LngLat } from "./LngLat"; /** * Interface that represents a latitude-longitude reference @@ -7,7 +7,7 @@ import { LatLon } from "./LatLon"; * * @interface LatLonAlt */ -export interface LatLonAlt extends LatLon { +export interface LatLonAlt extends LngLat { /** * Altitude, measured in meters. */ diff --git a/src/api/interfaces/LatLon.ts b/src/api/interfaces/LngLat.ts similarity index 80% rename from src/api/interfaces/LatLon.ts rename to src/api/interfaces/LngLat.ts index 3e6a7a27..4debd706 100644 --- a/src/api/interfaces/LatLon.ts +++ b/src/api/interfaces/LngLat.ts @@ -1,10 +1,8 @@ /** * Interface that represents a latitude and longitude coordinate, * measured in degrees. Coordinates are defined in the WGS84 datum. - * - * @interface LatLon */ -export interface LatLon { +export interface LngLat { /** * Latitude, measured in degrees. */ @@ -13,5 +11,5 @@ export interface LatLon { /** * Longitude, measured in degrees. */ - lon: number; + lng: number; } diff --git a/src/component/marker/MarkerComponent.ts b/src/component/marker/MarkerComponent.ts index b1ad55f5..5861d8eb 100644 --- a/src/component/marker/MarkerComponent.ts +++ b/src/component/marker/MarkerComponent.ts @@ -25,7 +25,7 @@ import { Component } from "../Component"; import { Image } from "../../graph/Image"; import { Container } from "../../viewer/Container"; import { Navigator } from "../../viewer/Navigator"; -import { LatLon } from "../../api/interfaces/LatLon"; +import { LngLat } from "../../api/interfaces/LngLat"; import { LatLonAlt } from "../../api/interfaces/LatLonAlt"; import { ViewportCoords } from "../../geo/ViewportCoords"; import { GraphCalculator } from "../../graph/GraphCalculator"; @@ -370,18 +370,18 @@ export class MarkerComponent extends Component { return { visibleBBoxSize: Math.max(1, Math.min(200, configuration.visibleBBoxSize)) }; })); - const currentlatLon$ = this._navigator.stateService.currentImage$.pipe( - map((image: Image): LatLon => { return image.latLon; }), + const currentLngLat$ = this._navigator.stateService.currentImage$.pipe( + map((image: Image): LngLat => { return image.lngLat; }), publishReplay(1), refCount()); const visibleBBox$ = observableCombineLatest( clampedConfiguration$, - currentlatLon$).pipe( + currentLngLat$).pipe( map( - ([configuration, latLon]: [MarkerConfiguration, LatLon]): [LatLon, LatLon] => { + ([configuration, lngLat]: [MarkerConfiguration, LngLat]): [LngLat, LngLat] => { return this._graphCalculator - .boundingBoxCorners(latLon, configuration.visibleBBoxSize / 2); + .boundingBoxCorners(lngLat, configuration.visibleBBoxSize / 2); }), publishReplay(1), refCount()); @@ -392,7 +392,7 @@ export class MarkerComponent extends Component { this._markerSet.changed$), visibleBBox$).pipe( map( - ([set, bbox]: [MarkerSet, [LatLon, LatLon]]): Marker[] => { + ([set, bbox]: [MarkerSet, [LngLat, LngLat]]): Marker[] => { return set.search(bbox); })); @@ -418,11 +418,11 @@ export class MarkerComponent extends Component { } else { const point3d = geodeticToEnu( - marker.latLon.lat, - marker.latLon.lon, + marker.lngLat.lat, + marker.lngLat.lng, reference.alt + alt, reference.lat, - reference.lon, + reference.lng, reference.alt); markerScene.add(marker, point3d); @@ -440,7 +440,7 @@ export class MarkerComponent extends Component { subs.push(geoInitiated$.pipe( switchMap( - (): Observable<[Marker[], [LatLon, LatLon], LatLonAlt, number]> => { + (): Observable<[Marker[], [LngLat, LngLat], LatLonAlt, number]> => { return this._markerSet.updated$.pipe( withLatestFrom( visibleBBox$, @@ -448,24 +448,24 @@ export class MarkerComponent extends Component { groundAltitude$)); })) .subscribe( - ([markers, [sw, ne], reference, alt]: [Marker[], [LatLon, LatLon], LatLonAlt, number]): void => { + ([markers, [sw, ne], reference, alt]: [Marker[], [LngLat, LngLat], LatLonAlt, number]): void => { const markerScene: MarkerScene = this._markerScene; for (const marker of markers) { const exists: boolean = markerScene.has(marker.id); - const visible: boolean = marker.latLon.lat > sw.lat && - marker.latLon.lat < ne.lat && - marker.latLon.lon > sw.lon && - marker.latLon.lon < ne.lon; + const visible: boolean = marker.lngLat.lat > sw.lat && + marker.lngLat.lat < ne.lat && + marker.lngLat.lng > sw.lng && + marker.lngLat.lng < ne.lng; if (visible) { const point3d = geodeticToEnu( - marker.latLon.lat, - marker.latLon.lon, + marker.lngLat.lat, + marker.lngLat.lng, reference.alt + alt, reference.lat, - reference.lon, + reference.lng, reference.alt); markerScene.add(marker, point3d); @@ -485,11 +485,11 @@ export class MarkerComponent extends Component { for (const marker of markerScene.getAll()) { const point3d = geodeticToEnu( - marker.latLon.lat, - marker.latLon.lon, + marker.lngLat.lat, + marker.lngLat.lng, reference.alt + alt, reference.lat, - reference.lon, + reference.lng, reference.alt); markerScene.update(marker.id, point3d); @@ -500,28 +500,28 @@ export class MarkerComponent extends Component { skip(1), withLatestFrom( this._navigator.stateService.reference$, - currentlatLon$)) + currentLngLat$)) .subscribe( - ([alt, reference, latLon]: [number, LatLonAlt, LatLon]): void => { + ([alt, reference, lngLat]: [number, LatLonAlt, LngLat]): void => { const markerScene: MarkerScene = this._markerScene; const position = geodeticToEnu( - latLon.lat, - latLon.lon, + lngLat.lat, + lngLat.lng, reference.alt + alt, reference.lat, - reference.lon, + reference.lng, reference.alt); for (const marker of markerScene.getAll()) { const point3d = geodeticToEnu( - marker.latLon.lat, - marker.latLon.lon, + marker.lngLat.lat, + marker.lngLat.lng, reference.alt + alt, reference.lat, - reference.lon, + reference.lng, reference.alt); const distanceX: number = point3d[0] - position[0]; @@ -722,14 +722,14 @@ export class MarkerComponent extends Component { intersection.y, intersection.z, reference.lat, - reference.lon, + reference.lng, reference.alt); this._markerScene .update( marker.id, intersection.toArray(), - { lat: lat, lon: lon }); + { lat: lat, lng: lon }); this._markerSet.update(marker); diff --git a/src/component/marker/MarkerScene.ts b/src/component/marker/MarkerScene.ts index 495e8065..807a5a00 100644 --- a/src/component/marker/MarkerScene.ts +++ b/src/component/marker/MarkerScene.ts @@ -1,5 +1,5 @@ import * as THREE from "three"; -import { LatLon } from "../../api/interfaces/LatLon"; +import { LngLat } from "../../api/interfaces/LngLat"; import { Marker } from "./marker/Marker"; export class MarkerScene { @@ -111,13 +111,13 @@ export class MarkerScene { this._needsRender = false; } - public update(id: string, position: number[], latLon?: LatLon): void { + public update(id: string, position: number[], lngLat?: LngLat): void { if (!(id in this._markers)) { return; } const marker: Marker = this._markers[id]; - marker.updatePosition(position, latLon); + marker.updatePosition(position, lngLat); this._needsRender = true; } diff --git a/src/component/marker/MarkerSet.ts b/src/component/marker/MarkerSet.ts index 367b237f..b8dbde80 100644 --- a/src/component/marker/MarkerSet.ts +++ b/src/component/marker/MarkerSet.ts @@ -2,12 +2,12 @@ import { Observable, Subject, } from "rxjs"; -import { LatLon } from "../../api/interfaces/LatLon"; +import { LngLat } from "../../api/interfaces/LngLat"; import { Marker } from "./marker/Marker"; type MarkerIndexItem = { lat: number; - lon: number; + lng: number; marker: Marker; }; @@ -54,8 +54,8 @@ export class MarkerSet { } const item: MarkerIndexItem = { - lat: marker.latLon.lat, - lon: marker.latLon.lon, + lat: marker.lngLat.lat, + lng: marker.lngLat.lng, marker: marker, }; @@ -117,13 +117,13 @@ export class MarkerSet { this._indexChanged$.next(this); } - public search([sw, ne]: [LatLon, LatLon]): Marker[] { + public search([sw, ne]: [LngLat, LngLat]): Marker[] { return this._index .search({ - maxX: ne.lat, - maxY: ne.lon, - minX: sw.lat, - minY: sw.lon, + maxX: ne.lng, + maxY: ne.lat, + minX: sw.lng, + minY: sw.lat, }) .map( (indexItem: MarkerIndexItem): Marker => { @@ -143,8 +143,8 @@ export class MarkerSet { index.remove(hash[id]); const item: MarkerIndexItem = { - lat: marker.latLon.lat, - lon: marker.latLon.lon, + lat: marker.lngLat.lat, + lng: marker.lngLat.lng, marker: marker, }; diff --git a/src/component/marker/marker/CircleMarker.ts b/src/component/marker/marker/CircleMarker.ts index b0663a2f..c3f278d5 100644 --- a/src/component/marker/marker/CircleMarker.ts +++ b/src/component/marker/marker/CircleMarker.ts @@ -1,5 +1,5 @@ import * as THREE from "three"; -import { LatLon } from "../../../api/interfaces/LatLon"; +import { LngLat } from "../../../api/interfaces/LngLat"; import { CircleMarkerOptions } from "../interfaces/CircleMarkerOptions"; import { Marker } from "./Marker"; @@ -18,11 +18,11 @@ import { Marker } from "./Marker"; * ```js * var defaultMarker = new mapillary.MarkerComponent.CircleMarker( * "id-1", - * { lat: 0, lon: 0, }); + * { lat: 0, lng: 0, }); * * var configuredMarker = new mapillary.MarkerComponent.CircleMarker( * "id-2", - * { lat: 0, lon: 0, }, + * { lat: 0, lng: 0, }, * { * color: "#0Ff", * opacity: 0.3, @@ -37,8 +37,8 @@ export class CircleMarker extends Marker { private _opacity: number; private _radius: number; - constructor(id: string, latLon: LatLon, options?: CircleMarkerOptions) { - super(id, latLon); + constructor(id: string, lngLat: LngLat, options?: CircleMarkerOptions) { + super(id, lngLat); options = !!options ? options : {}; this._color = options.color != null ? options.color : 0xffffff; diff --git a/src/component/marker/marker/Marker.ts b/src/component/marker/marker/Marker.ts index 52cdc7a2..fcbc6ab6 100644 --- a/src/component/marker/marker/Marker.ts +++ b/src/component/marker/marker/Marker.ts @@ -1,5 +1,5 @@ import * as THREE from "three"; -import { LatLon } from "../../../api/interfaces/LatLon"; +import { LngLat } from "../../../api/interfaces/LngLat"; /** * @class Marker @@ -10,11 +10,11 @@ import { LatLon } from "../../../api/interfaces/LatLon"; export abstract class Marker { protected _id: string; protected _geometry: THREE.Object3D; - protected _latLon: LatLon; + protected _lngLat: LngLat; - constructor(id: string, latLon: LatLon) { + constructor(id: string, lngLat: LngLat) { this._id = id; - this._latLon = latLon; + this._lngLat = lngLat; } /** @@ -35,11 +35,11 @@ export abstract class Marker { } /** - * Get lat lon. - * @returns {LatLon} The geographic coordinates of the marker. + * Get lngLat. + * @returns {LngLat} The geographic coordinates of the marker. */ - public get latLon(): LatLon { - return this._latLon; + public get lngLat(): LngLat { + return this._lngLat; } /** @ignore */ @@ -84,10 +84,10 @@ export abstract class Marker { } /** @ignore */ - public updatePosition(position: number[], latLon?: LatLon): void { - if (!!latLon) { - this._latLon.lat = latLon.lat; - this._latLon.lon = latLon.lon; + public updatePosition(position: number[], lngLat?: LngLat): void { + if (!!lngLat) { + this._lngLat.lat = lngLat.lat; + this._lngLat.lng = lngLat.lng; } if (!this._geometry) { diff --git a/src/component/marker/marker/SimpleMarker.ts b/src/component/marker/marker/SimpleMarker.ts index b60d9e1c..01abe334 100644 --- a/src/component/marker/marker/SimpleMarker.ts +++ b/src/component/marker/marker/SimpleMarker.ts @@ -1,5 +1,5 @@ import * as THREE from "three"; -import { LatLon } from "../../../api/interfaces/LatLon"; +import { LngLat } from "../../../api/interfaces/LngLat"; import { SimpleMarkerOptions } from "../interfaces/SimpleMarkerOptions"; import { Marker } from "./Marker"; @@ -18,11 +18,11 @@ import { Marker } from "./Marker"; * ```js * var defaultMarker = new mapillary.MarkerComponent.SimpleMarker( * "id-1", - * { lat: 0, lon: 0, }); + * { lat: 0, lng: 0, }); * * var interactiveMarker = new mapillary.MarkerComponent.SimpleMarker( * "id-2", - * { lat: 0, lon: 0, }, + * { lat: 0, lng: 0, }, * { * ballColor: "#00f", * ballOpacity: 0.5, @@ -44,8 +44,8 @@ export class SimpleMarker extends Marker { private _opacity: number; private _radius: number; - constructor(id: string, latLon: LatLon, options?: SimpleMarkerOptions) { - super(id, latLon); + constructor(id: string, lngLat: LngLat, options?: SimpleMarkerOptions) { + super(id, lngLat); options = !!options ? options : {}; this._ballColor = options.ballColor != null ? options.ballColor : 0xff0000; diff --git a/src/component/spatialdata/SpatialDataComponent.ts b/src/component/spatialdata/SpatialDataComponent.ts index cd50ad40..976ad406 100644 --- a/src/component/spatialdata/SpatialDataComponent.ts +++ b/src/component/spatialdata/SpatialDataComponent.ts @@ -52,7 +52,7 @@ import { SpatialDataScene } from "./SpatialDataScene"; import { SpatialDataCache } from "./SpatialDataCache"; import { CameraType } from "../../geo/interfaces/CameraType"; import { geodeticToEnu } from "../../geo/GeoCoords"; -import { LatLon } from "../../api/interfaces/LatLon"; +import { LngLat } from "../../api/interfaces/LngLat"; type IntersectEvent = MouseEvent | FocusEvent; @@ -124,7 +124,7 @@ export class SpatialDataComponent extends Component { map( (image: Image): string => { return this._navigator.api.data.geometry - .latLonToCellId(image.latLon); + .lngLatToCellId(image.lngLat); }), distinctUntilChanged(), publishReplay(1), @@ -175,7 +175,7 @@ export class SpatialDataComponent extends Component { : Observable => { if (earth) { const cellId = this._navigator.api.data.geometry - .latLonToCellId(image.latLon); + .lngLatToCellId(image.lngLat); const cells = sequencePlay ? [cellId] : this._adjacentComponent(cellId, 1) @@ -587,7 +587,7 @@ export class SpatialDataComponent extends Component { : string[] { const spatial = this._spatial; const geometry = this._navigator.api.data.geometry; - const cell = geometry.latLonToCellId(image.latLon); + const cell = geometry.lngLatToCellId(image.lngLat); const cells = [cell]; const threshold = fov / 2; const adjacent = geometry.getAdjacent(cell); @@ -597,10 +597,10 @@ export class SpatialDataComponent extends Component { const [x, y] = geodeticToEnu( vertex.lat, - vertex.lon, + vertex.lng, 0, - image.latLon.lat, - image.latLon.lon, + image.lngLat.lat, + image.lngLat.lng, 0); const azimuthal = Math.atan2(y, x); const vertexBearing = spatial.radToDeg( @@ -616,11 +616,11 @@ export class SpatialDataComponent extends Component { private _computeOriginalPosition(image: Image, reference: LatLonAlt): number[] { return geodeticToEnu( - image.originalLatLon.lat, - image.originalLatLon.lon, + image.originalLngLat.lat, + image.originalLngLat.lng, image.originalAltitude != null ? image.originalAltitude : image.computedAltitude, reference.lat, - reference.lon, + reference.lng, reference.alt); } @@ -629,13 +629,13 @@ export class SpatialDataComponent extends Component { this._navigator.api.data.geometry .getVertices(cellId) .map( - (vertex: LatLon): number[] => { + (vertex: LngLat): number[] => { return geodeticToEnu( vertex.lat, - vertex.lon, + vertex.lng, 0, reference.lat, - reference.lon, + reference.lng, reference.alt); }); @@ -648,16 +648,16 @@ export class SpatialDataComponent extends Component { : number[] { return geodeticToEnu( reconstruction.reference.lat, - reconstruction.reference.lon, + reconstruction.reference.lng, reconstruction.reference.alt, reference.lat, - reference.lon, + reference.lng, reference.alt); } private _createTransform(image: Image, reference: LatLonAlt): Transform { const translation: number[] = Geo.computeTranslation( - { alt: image.computedAltitude, lat: image.latLon.lat, lon: image.latLon.lon }, + { alt: image.computedAltitude, lat: image.lngLat.lat, lng: image.lngLat.lng }, image.rotation, reference); diff --git a/src/export/APINamespace.ts b/src/export/APINamespace.ts index c32c2f15..200c5cc2 100644 --- a/src/export/APINamespace.ts +++ b/src/export/APINamespace.ts @@ -45,5 +45,5 @@ export { SpatialImageEnt } from "../api/ents/SpatialImageEnt"; export { URLEnt } from "../api/ents/URLEnt"; // Type -export { LatLon } from "../api/interfaces/LatLon"; +export { LngLat } from "../api/interfaces/LngLat"; export { LatLonAlt } from "../api/interfaces/LatLonAlt"; diff --git a/src/geo/Geo.ts b/src/geo/Geo.ts index 99013972..4de3c2fe 100644 --- a/src/geo/Geo.ts +++ b/src/geo/Geo.ts @@ -19,10 +19,10 @@ export function isFisheye(cameraType: string): boolean { export function computeTranslation(position: LatLonAlt, rotation: number[], reference: LatLonAlt): number[] { const C = geodeticToEnu( position.lat, - position.lon, + position.lng, position.alt, reference.lat, - reference.lon, + reference.lng, reference.alt); const RC: THREE.Vector3 = spatial.rotate(C, rotation); diff --git a/src/geo/GeoCoords.ts b/src/geo/GeoCoords.ts index 8d677c75..11d4c3a6 100644 --- a/src/geo/GeoCoords.ts +++ b/src/geo/GeoCoords.ts @@ -6,24 +6,25 @@ const wgs84b = 6356752.31424518; * (ENU) reference. * * @param {number} lat Latitude in degrees. - * @param {number} lon Longitude in degrees. + * @param {number} lng Longitude in degrees. * @param {number} alt Altitude in meters. * @param {number} refLat Reference latitude in degrees. - * @param {number} refLon Reference longitude in degrees. + * @param {number} refLng Reference longitude in degrees. * @param {number} refAlt Reference altitude in meters. * @returns {Array} The x, y, z local topocentric ENU coordinates. */ export function geodeticToEnu( lat: number, - lon: number, + lng: number, alt: number, refLat: number, - refLon: number, - refAlt: number): number[] { + refLng: number, + refAlt: number) + : number[] { - let ecef: number[] = geodeticToEcef(lat, lon, alt); + let ecef: number[] = geodeticToEcef(lat, lng, alt); - return ecefToEnu(ecef[0], ecef[1], ecef[2], refLat, refLon, refAlt); + return ecefToEnu(ecef[0], ecef[1], ecef[2], refLat, refLng, refAlt); } /** @@ -34,7 +35,7 @@ export function geodeticToEnu( * @param {number} y Topocentric ENU coordinate in North direction. * @param {number} z Topocentric ENU coordinate in Up direction. * @param {number} refLat Reference latitude in degrees. - * @param {number} refLon Reference longitude in degrees. + * @param {number} refLng Reference longitude in degrees. * @param {number} refAlt Reference altitude in meters. * @returns {Array} The latitude and longitude in degrees * as well as altitude in meters. @@ -44,10 +45,11 @@ export function enuToGeodetic( y: number, z: number, refLat: number, - refLon: number, - refAlt: number): number[] { + refLng: number, + refAlt: number) + : number[] { - let ecef: number[] = enuToEcef(x, y, z, refLat, refLon, refAlt); + let ecef: number[] = enuToEcef(x, y, z, refLat, refLng, refAlt); return ecefToGeodetic(ecef[0], ecef[1], ecef[2]); } @@ -60,7 +62,7 @@ export function enuToGeodetic( * @param {number} Y ECEF Y-value. * @param {number} Z ECEF Z-value. * @param {number} refLat Reference latitude in degrees. - * @param {number} refLon Reference longitude in degrees. + * @param {number} refLng Reference longitude in degrees. * @param {number} refAlt Reference altitude in meters. * @returns {Array} The x, y, z topocentric ENU coordinates in East, North * and Up directions respectively. @@ -70,24 +72,25 @@ export function ecefToEnu( Y: number, Z: number, refLat: number, - refLon: number, - refAlt: number): number[] { + refLng: number, + refAlt: number) + : number[] { - let refEcef: number[] = geodeticToEcef(refLat, refLon, refAlt); + let refEcef: number[] = geodeticToEcef(refLat, refLng, refAlt); let V: number[] = [X - refEcef[0], Y - refEcef[1], Z - refEcef[2]]; refLat = refLat * Math.PI / 180.0; - refLon = refLon * Math.PI / 180.0; + refLng = refLng * Math.PI / 180.0; let cosLat: number = Math.cos(refLat); let sinLat: number = Math.sin(refLat); - let cosLon: number = Math.cos(refLon); - let sinLon: number = Math.sin(refLon); + let cosLng: number = Math.cos(refLng); + let sinLng: number = Math.sin(refLng); - let x: number = -sinLon * V[0] + cosLon * V[1]; - let y: number = -sinLat * cosLon * V[0] - sinLat * sinLon * V[1] + cosLat * V[2]; - let z: number = cosLat * cosLon * V[0] + cosLat * sinLon * V[1] + sinLat * V[2]; + let x: number = -sinLng * V[0] + cosLng * V[1]; + let y: number = -sinLat * cosLng * V[0] - sinLat * sinLng * V[1] + cosLat * V[2]; + let z: number = cosLat * cosLng * V[0] + cosLat * sinLng * V[1] + sinLat * V[2]; return [x, y, z]; } @@ -100,7 +103,7 @@ export function ecefToEnu( * @param {number} y Topocentric ENU coordinate in North direction. * @param {number} z Topocentric ENU coordinate in Up direction. * @param {number} refLat Reference latitude in degrees. - * @param {number} refLon Reference longitude in degrees. + * @param {number} refLng Reference longitude in degrees. * @param {number} refAlt Reference altitude in meters. * @returns {Array} The X, Y, Z ECEF coordinates. */ @@ -109,21 +112,22 @@ export function enuToEcef( y: number, z: number, refLat: number, - refLon: number, - refAlt: number): number[] { + refLng: number, + refAlt: number) + : number[] { - let refEcef: number[] = geodeticToEcef(refLat, refLon, refAlt); + let refEcef: number[] = geodeticToEcef(refLat, refLng, refAlt); refLat = refLat * Math.PI / 180.0; - refLon = refLon * Math.PI / 180.0; + refLng = refLng * Math.PI / 180.0; let cosLat: number = Math.cos(refLat); let sinLat: number = Math.sin(refLat); - let cosLon: number = Math.cos(refLon); - let sinLon: number = Math.sin(refLon); + let cosLng: number = Math.cos(refLng); + let sinLng: number = Math.sin(refLng); - let X: number = -sinLon * x - sinLat * cosLon * y + cosLat * cosLon * z + refEcef[0]; - let Y: number = cosLon * x - sinLat * sinLon * y + cosLat * sinLon * z + refEcef[1]; + let X: number = -sinLng * x - sinLat * cosLng * y + cosLat * cosLng * z + refEcef[0]; + let Y: number = cosLng * x - sinLat * sinLng * y + cosLat * sinLng * z + refEcef[1]; let Z: number = cosLat * y + sinLat * z + refEcef[2]; return [X, Y, Z]; @@ -134,21 +138,25 @@ export function enuToEcef( * Earth-Fixed (ECEF) reference. * * @param {number} lat Latitude in degrees. - * @param {number} lon Longitude in degrees. + * @param {number} lng Longitude in degrees. * @param {number} alt Altitude in meters. * @returns {Array} The X, Y, Z ECEF coordinates. */ -export function geodeticToEcef(lat: number, lon: number, alt: number): number[] { +export function geodeticToEcef( + lat: number, + lng: number, + alt: number) + : number[] { let a: number = wgs84a; let b: number = wgs84b; lat = lat * Math.PI / 180.0; - lon = lon * Math.PI / 180.0; + lng = lng * Math.PI / 180.0; let cosLat: number = Math.cos(lat); let sinLat: number = Math.sin(lat); - let cosLon: number = Math.cos(lon); - let sinLon: number = Math.sin(lon); + let cosLng: number = Math.cos(lng); + let sinLng: number = Math.sin(lng); let a2: number = a * a; let b2: number = b * b; @@ -157,8 +165,8 @@ export function geodeticToEcef(lat: number, lon: number, alt: number): number[] let nhcl: number = (a2 * L + alt) * cosLat; - let X: number = nhcl * cosLon; - let Y: number = nhcl * sinLon; + let X: number = nhcl * cosLng; + let Y: number = nhcl * sinLng; let Z: number = (b2 * L + alt) * sinLat; return [X, Y, Z]; @@ -174,7 +182,11 @@ export function geodeticToEcef(lat: number, lon: number, alt: number): number[] * @returns {Array} The latitude and longitude in degrees * as well as altitude in meters. */ -export function ecefToGeodetic(X: number, Y: number, Z: number): number[] { +export function ecefToGeodetic( + X: number, + Y: number, + Z: number) + : number[] { let a: number = wgs84a; let b: number = wgs84b; @@ -192,7 +204,7 @@ export function ecefToGeodetic(X: number, Y: number, Z: number): number[] { let sinTheta: number = Math.sin(theta); let cosTheta: number = Math.cos(theta); - let lon: number = Math.atan2(Y, X); + let lng: number = Math.atan2(Y, X); let lat: number = Math.atan2( Z + eb * eb * b * sinTheta * sinTheta * sinTheta, p - ea * ea * a * cosTheta * cosTheta * cosTheta); @@ -203,5 +215,5 @@ export function ecefToGeodetic(X: number, Y: number, Z: number): number[] { let N: number = a / Math.sqrt(1 - ea * ea * sinLat * sinLat); let alt: number = p / cosLat - N; - return [lat * 180.0 / Math.PI, lon * 180.0 / Math.PI, alt]; + return [lat * 180.0 / Math.PI, lng * 180.0 / Math.PI, alt]; } diff --git a/src/geo/GeoRBush.ts b/src/geo/GeoRBush.ts index 25cdf38e..ca1b8fab 100644 --- a/src/geo/GeoRBush.ts +++ b/src/geo/GeoRBush.ts @@ -1,14 +1,14 @@ import { BBox } from "rbush"; import RBush from "rbush"; -import { LatLon } from "../api/interfaces/LatLon"; +import { LngLat } from "../api/interfaces/LngLat"; -export class GeoRBush extends RBush { +export class GeoRBush extends RBush { public compareMinX(a: T, b: T): number { return a.lat - b.lat; } - public compareMinY(a: T, b: T): number { return a.lon - b.lon; } + public compareMinY(a: T, b: T): number { return a.lng - b.lng; } public toBBox(item: T): BBox { - return { minX: item.lat, minY: item.lon, maxX: item.lat, maxY: item.lon }; + return { minX: item.lat, minY: item.lng, maxX: item.lat, maxY: item.lng }; } } diff --git a/src/geo/Spatial.ts b/src/geo/Spatial.ts index 5eeef821..78bec3a4 100644 --- a/src/geo/Spatial.ts +++ b/src/geo/Spatial.ts @@ -254,12 +254,12 @@ export class Spatial { public distanceFromLatLon(lat1: number, lon1: number, lat2: number, lon2: number): number { let r: number = 6371000; let dLat: number = this.degToRad(lat2 - lat1); - let dLon: number = this.degToRad(lon2 - lon1); + let dLng: number = this.degToRad(lon2 - lon1); let hav: number = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(this.degToRad(lat1)) * Math.cos(this.degToRad(lat2)) * - Math.sin(dLon / 2) * Math.sin(dLon / 2); + Math.sin(dLng / 2) * Math.sin(dLng / 2); let d: number = 2 * r * Math.atan2(Math.sqrt(hav), Math.sqrt(1 - hav)); diff --git a/src/geo/Transform.ts b/src/geo/Transform.ts index d06673a4..35e4d1a7 100644 --- a/src/geo/Transform.ts +++ b/src/geo/Transform.ts @@ -378,11 +378,11 @@ export class Transform { */ private _sfmToBearing(sfm: number[]): number[] { if (isSpherical(this._cameraType)) { - let lon: number = sfm[0] * 2 * Math.PI; + let lng: number = sfm[0] * 2 * Math.PI; let lat: number = -sfm[1] * 2 * Math.PI; - let x: number = Math.cos(lat) * Math.sin(lon); + let x: number = Math.cos(lat) * Math.sin(lng); let y: number = -Math.sin(lat); - let z: number = Math.cos(lat) * Math.cos(lon); + let z: number = Math.cos(lat) * Math.cos(lng); return [x, y, z]; } else if (isFisheye(this._cameraType)) { let [dxn, dyn]: number[] = [sfm[0] / this._focal, sfm[1] / this._focal]; @@ -440,9 +440,9 @@ export class Transform { let x: number = bearing[0]; let y: number = bearing[1]; let z: number = bearing[2]; - let lon: number = Math.atan2(x, z); + let lng: number = Math.atan2(x, z); let lat: number = Math.atan2(-y, Math.sqrt(x * x + z * z)); - return [lon / (2 * Math.PI), -lat / (2 * Math.PI)]; + return [lng / (2 * Math.PI), -lat / (2 * Math.PI)]; } else if (isFisheye(this._cameraType)) { if (bearing[2] > 0) { const [x, y, z]: number[] = bearing; diff --git a/src/graph/Graph.ts b/src/graph/Graph.ts index da332a15..cd06ed1d 100644 --- a/src/graph/Graph.ts +++ b/src/graph/Graph.ts @@ -36,7 +36,7 @@ import { PotentialEdge } from "./edge/interfaces/PotentialEdge"; import { APIWrapper } from "../api/APIWrapper"; import { SpatialImageEnt } from "../api/ents/SpatialImageEnt"; -import { LatLon } from "../api/interfaces/LatLon"; +import { LngLat } from "../api/interfaces/LngLat"; import { GraphMapillaryError } from "../error/GraphMapillaryError"; import { SpatialImagesContract } from "../api/contracts/SpatialImagesContract"; import { ImagesContract } from "../api/contracts/ImagesContract"; @@ -71,7 +71,7 @@ type SequenceAccess = { export type NodeIndexItem = { lat: number; - lon: number; + lng: number; node: Image; }; @@ -308,12 +308,12 @@ export class Graph { * * @description The node assets are not cached. * - * @param {LatLon} sw - South west corner of bounding box. - * @param {LatLon} ne - North east corner of bounding box. + * @param {LngLat} sw - South west corner of bounding box. + * @param {LngLat} ne - North east corner of bounding box. * @returns {Observable>} Observable emitting * the full nodes in the bounding box. */ - public cacheBoundingBox$(sw: LatLon, ne: LatLon): Observable { + public cacheBoundingBox$(sw: LngLat, ne: LngLat): Observable { const cacheTiles$ = this._api.data.geometry.bboxToCellIds(sw, ne) .filter( (h: string): boolean => { @@ -337,10 +337,10 @@ export class Graph { (): Observable => { const nodes = this._nodeIndex .search({ - maxX: ne.lat, - maxY: ne.lon, - minX: sw.lat, - minY: sw.lon, + maxX: ne.lng, + maxY: ne.lat, + minX: sw.lng, + minY: sw.lat, }) .map( (item: NodeIndexItem): Image => { @@ -568,7 +568,7 @@ export class Graph { this._makeFull(node, item.node); const cellId = this._api.data.geometry - .latLonToCellId(node.originalLatLon); + .lngLatToCellId(node.originalLngLat); this._preStore(cellId, node); this._setNode(node); @@ -722,7 +722,7 @@ export class Graph { this._makeFull(node, item.node); const cellId = this._api.data.geometry - .latLonToCellId(node.originalLatLon); + .lngLatToCellId(node.originalLngLat); this._preStore(cellId, node); this._setNode(node); } @@ -1183,18 +1183,24 @@ export class Graph { } if (key in this._requiredSpatialArea) { - return Object.keys(this._requiredSpatialArea[key].cacheNodes).length === 0; + return Object + .keys(this._requiredSpatialArea[key].cacheNodes) + .length === 0; } - let node: Image = this.getNode(key); - let bbox: [LatLon, LatLon] = this._graphCalculator.boundingBoxCorners(node.latLon, this._tileThreshold); + let node = this.getNode(key); + let bbox = this._graphCalculator + .boundingBoxCorners( + node.lngLat, + this._tileThreshold); - let spatialItems: NodeIndexItem[] = this._nodeIndex.search({ - maxX: bbox[1].lat, - maxY: bbox[1].lon, - minX: bbox[0].lat, - minY: bbox[0].lon, - }); + let spatialItems = this._nodeIndex + .search({ + maxX: bbox[1].lng, + maxY: bbox[1].lat, + minX: bbox[0].lng, + minY: bbox[0].lat, + }); let spatialNodes: SpatialArea = { all: {}, @@ -1243,7 +1249,7 @@ export class Graph { const node = this.getNode(key); const [sw, ne] = this._graphCalculator .boundingBoxCorners( - node.latLon, + node.lngLat, this._tileThreshold) nodeTiles.cache = this._api.data.geometry @@ -1352,7 +1358,7 @@ export class Graph { for (const node of nodes) { this._nodes[node.id] = node; - const h: string = this._api.data.geometry.latLonToCellId(node.originalLatLon); + const h: string = this._api.data.geometry.lngLatToCellId(node.originalLngLat); this._preStore(h, node); } @@ -1420,7 +1426,7 @@ export class Graph { const node = this._nodes[id]; const [sw, ne] = calculator .boundingBoxCorners( - node.latLon, + node.lngLat, tileThreshold, ) const nodeCells = geometry.bboxToCellIds(sw, ne) @@ -1690,8 +1696,8 @@ export class Graph { delete preStored[core.id]; hCache.push(preStoredNode); const preStoredNodeIndexItem: NodeIndexItem = { - lat: preStoredNode.latLon.lat, - lon: preStoredNode.latLon.lon, + lat: preStoredNode.lngLat.lat, + lng: preStoredNode.lngLat.lng, node: preStoredNode, }; this._nodeIndex.insert(preStoredNodeIndexItem); @@ -1704,8 +1710,8 @@ export class Graph { const node = new Image(core); hCache.push(node); const nodeIndexItem: NodeIndexItem = { - lat: node.latLon.lat, - lon: node.latLon.lon, + lat: node.lngLat.lat, + lng: node.lngLat.lng, node: node, }; @@ -1888,8 +1894,8 @@ export class Graph { const node = new Image(core); cellNodes.push(node); const nodeIndexItem: NodeIndexItem = { - lat: node.latLon.lat, - lon: node.latLon.lon, + lat: node.lngLat.lat, + lng: node.lngLat.lng, node: node, }; nodeIndex.insert(nodeIndexItem); diff --git a/src/graph/GraphCalculator.ts b/src/graph/GraphCalculator.ts index 18656cd2..ccc46620 100644 --- a/src/graph/GraphCalculator.ts +++ b/src/graph/GraphCalculator.ts @@ -1,6 +1,6 @@ import * as THREE from "three"; -import { LatLon } from "../api/interfaces/LatLon"; +import { LngLat } from "../api/interfaces/LngLat"; import { enuToGeodetic } from "../geo/GeoCoords"; /** @@ -13,35 +13,35 @@ export class GraphCalculator { * Get the bounding box corners for a circle with radius of a threshold * with center in a geodetic position. * - * @param {LatLon} latlon - Latitude and longitude to encode. + * @param {LngLat} lngLat - Latitude and longitude to encode. * @param {number} threshold - Threshold distance from the position in meters. * - * @returns {Array} The south west and north east corners of the + * @returns {Array} The south west and north east corners of the * bounding box. */ public boundingBoxCorners( - latLon: LatLon, + lngLat: LngLat, threshold: number) - : [LatLon, LatLon] { + : [LngLat, LngLat] { let bl = enuToGeodetic( -threshold, -threshold, 0, - latLon.lat, - latLon.lon, + lngLat.lat, + lngLat.lng, 0); let tr = enuToGeodetic( threshold, threshold, 0, - latLon.lat, - latLon.lon, + lngLat.lat, + lngLat.lng, 0); return [ - { lat: bl[0], lon: bl[1] }, - { lat: tr[0], lon: tr[1] }, + { lat: bl[0], lng: bl[1] }, + { lat: tr[0], lng: tr[1] }, ]; } diff --git a/src/graph/GraphService.ts b/src/graph/GraphService.ts index d65bb29c..8b2f64f9 100644 --- a/src/graph/GraphService.ts +++ b/src/graph/GraphService.ts @@ -29,7 +29,7 @@ import { GraphMode } from "./GraphMode"; import { Image } from "./Image"; import { Sequence } from "./Sequence"; -import { LatLon } from "../api/interfaces/LatLon"; +import { LngLat } from "../api/interfaces/LngLat"; import { SubscriptionHolder } from "../util/SubscriptionHolder"; import { DataAddedProviderEvent } from "../api/interfaces/DataAddedProviderEvent"; @@ -135,13 +135,13 @@ export class GraphService { * retrieved, {@link cacheImage$} needs to be called for caching * assets. * - * @param {LatLon} sw - South west corner of bounding box. - * @param {LatLon} ne - North east corner of bounding box. + * @param {LngLat} sw - South west corner of bounding box. + * @param {LngLat} ne - North east corner of bounding box. * @return {Observable>} Observable emitting a single item, * the images of the bounding box, when they have all been retrieved. * @throws {Error} Propagates any IO image caching errors to the caller. */ - public cacheBoundingBox$(sw: LatLon, ne: LatLon): Observable { + public cacheBoundingBox$(sw: LngLat, ne: LngLat): Observable { return this._graph$.pipe( first(), mergeMap( diff --git a/src/graph/Image.ts b/src/graph/Image.ts index c8295c8f..641d7959 100644 --- a/src/graph/Image.ts +++ b/src/graph/Image.ts @@ -7,7 +7,7 @@ import { NavigationEdgeStatus } from "./interfaces/NavigationEdgeStatus"; import { CoreImageEnt } from "../api/ents/CoreImageEnt"; import { SpatialImageEnt } from "../api/ents/SpatialImageEnt"; -import { LatLon } from "../api/interfaces/LatLon"; +import { LngLat } from "../api/interfaces/LngLat"; import { MeshContract } from "../api/contracts/MeshContract"; /** @@ -18,23 +18,23 @@ import { MeshContract } from "../api/contracts/MeshContract"; * Explanation of position and bearing properties: * * When images are uploaded they will have GPS information in the EXIF, this is what - * is called `originalLatLon` {@link Image.originalLatLon}. + * is called `originalLngLat` {@link Image.originalLngLat}. * - * When Structure from Motions has been run for a image a `computedLatLon` that - * differs from the `originalLatLon` will be created. It is different because + * When Structure from Motions has been run for a image a `computedLngLat` that + * differs from the `originalLngLat` will be created. It is different because * GPS positions are not very exact and SfM aligns the camera positions according - * to the 3D reconstruction {@link Image.computedLatLon}. + * to the 3D reconstruction {@link Image.computedLngLat}. * - * At last there exist a `latLon` property which evaluates to - * the `computedLatLon` from SfM if it exists but falls back - * to the `originalLatLon` from the EXIF GPS otherwise {@link Image.latLon}. + * At last there exist a `lngLat` property which evaluates to + * the `computedLngLat` from SfM if it exists but falls back + * to the `originalLngLat` from the EXIF GPS otherwise {@link Image.lngLat}. * * Everything that is done in in the Viewer is based on the SfM positions, - * i.e. `computedLatLon`. That is why the smooth transitions go in the right + * i.e. `computedLngLat`. That is why the smooth transitions go in the right * direction (nd not in strange directions because of bad GPS). * * E.g. when placing a marker in the Viewer it is relative to the SfM - * position i.e. the `computedLatLon`. + * position i.e. the `computedLngLat`. * * The same concept as above also applies to the compass angle (or bearing) properties * `originalCa`, `computedCa` and `ca`. @@ -207,14 +207,14 @@ export class Image { } /** - * Get computedLatLon. + * Get computedLngLat. * * @description Will not be set if SfM has not been run. * - * @returns {LatLon} SfM computed latitude longitude in WGS84 datum, + * @returns {LngLat} SfM computed latitude longitude in WGS84 datum, * measured in degrees. */ - public get computedLatLon(): LatLon { + public get computedLngLat(): LngLat { return this._core.computed_geometry; } @@ -291,16 +291,16 @@ export class Image { } /** - * Get latLon. + * Get lngLat. * * @description If the SfM computed latitude longitude exist * it will be returned, otherwise the original EXIF latitude * longitude. * - * @returns {LatLon} Latitude longitude in WGS84 datum, + * @returns {LngLat} Latitude longitude in WGS84 datum, * measured in degrees. */ - public get latLon(): LatLon { + public get lngLat(): LngLat { return this._core.computed_geometry != null ? this._core.computed_geometry : this._core.geometry; @@ -373,12 +373,12 @@ export class Image { } /** - * Get originalLatLon. + * Get originalLngLat. * - * @returns {LatLon} Original EXIF latitude longitude in + * @returns {LngLat} Original EXIF latitude longitude in * WGS84 datum, measured in degrees. */ - public get originalLatLon(): LatLon { + public get originalLngLat(): LngLat { return this._core.geometry; } diff --git a/src/graph/edge/EdgeCalculator.ts b/src/graph/edge/EdgeCalculator.ts index ff5ab815..7f555290 100644 --- a/src/graph/edge/EdgeCalculator.ts +++ b/src/graph/edge/EdgeCalculator.ts @@ -83,11 +83,11 @@ export class EdgeCalculator { } let enu = geodeticToEnu( - potential.latLon.lat, - potential.latLon.lon, + potential.lngLat.lat, + potential.lngLat.lng, potential.computedAltitude, - node.latLon.lat, - node.latLon.lon, + node.lngLat.lat, + node.lngLat.lng, node.computedAltitude); let motion: THREE.Vector3 = new THREE.Vector3(enu[0], enu[1], enu[2]); diff --git a/src/state/StateContext.ts b/src/state/StateContext.ts index 296f7e24..4f999cd1 100644 --- a/src/state/StateContext.ts +++ b/src/state/StateContext.ts @@ -78,7 +78,7 @@ export class StateContext implements IStateContext { alpha: 1, camera: new Camera(), currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: transitionMode == null ? TransitionMode.Default : transitionMode, zoom: 0, diff --git a/src/state/StateService.ts b/src/state/StateService.ts index 53cace24..dfcf2bb3 100644 --- a/src/state/StateService.ts +++ b/src/state/StateService.ts @@ -29,7 +29,7 @@ import { AnimationFrame } from "./interfaces/AnimationFrame"; import { EulerRotation } from "./interfaces/EulerRotation"; import { IStateContext } from "./interfaces/IStateContext"; -import { LatLon } from "../api/interfaces/LatLon"; +import { LngLat } from "../api/interfaces/LngLat"; import { Camera } from "../geo/Camera"; import { Image } from "../graph/Image"; import { Transform } from "../geo/Transform"; @@ -200,11 +200,11 @@ export class StateService { return f.state.reference; }), distinctUntilChanged( - (r1: LatLon, r2: LatLon): boolean => { - return r1.lat === r2.lat && r1.lon === r2.lon; + (r1: LngLat, r2: LngLat): boolean => { + return r1.lat === r2.lat && r1.lng === r2.lng; }, - (reference: LatLonAlt): LatLon => { - return { lat: reference.lat, lon: reference.lon }; + (reference: LatLonAlt): LngLat => { + return { lat: reference.lat, lng: reference.lng }; }), publishReplay(1), refCount()); diff --git a/src/state/state/StateBase.ts b/src/state/state/StateBase.ts index 8d5edb24..864aadf3 100644 --- a/src/state/state/StateBase.ts +++ b/src/state/state/StateBase.ts @@ -304,8 +304,8 @@ export abstract class StateBase implements IStateBase { private _setReference(image: Image): boolean { // do not reset reference if image is within threshold distance - if (Math.abs(image.latLon.lat - this.reference.lat) < this._referenceThreshold && - Math.abs(image.latLon.lon - this.reference.lon) < this._referenceThreshold) { + if (Math.abs(image.lngLat.lat - this.reference.lat) < this._referenceThreshold && + Math.abs(image.lngLat.lng - this.reference.lng) < this._referenceThreshold) { return false; } @@ -314,8 +314,8 @@ export abstract class StateBase implements IStateBase { return false; } - this._reference.lat = image.latLon.lat; - this._reference.lon = image.latLon.lon; + this._reference.lat = image.lngLat.lat; + this._reference.lng = image.lngLat.lng; this._reference.alt = image.computedAltitude; return true; @@ -402,7 +402,7 @@ export abstract class StateBase implements IStateBase { private _imageToTranslation(image: Image, reference: LatLonAlt): number[] { return Geo.computeTranslation( - { alt: image.computedAltitude, lat: image.latLon.lat, lon: image.latLon.lon }, + { alt: image.computedAltitude, lat: image.lngLat.lat, lng: image.lngLat.lng }, image.rotation, reference); } @@ -425,10 +425,10 @@ export abstract class StateBase implements IStateBase { // 50 km/h moves 28m in 2s let distance: number = this._spatial.distanceFromLatLon( - current.originalLatLon.lat, - current.originalLatLon.lon, - previous.originalLatLon.lat, - previous.originalLatLon.lon); + current.originalLngLat.lat, + current.originalLngLat.lng, + previous.originalLngLat.lat, + previous.originalLngLat.lng); return distance < 25; } diff --git a/src/viewer/Observer.ts b/src/viewer/Observer.ts index 46754c48..22ad0ec3 100644 --- a/src/viewer/Observer.ts +++ b/src/viewer/Observer.ts @@ -21,7 +21,7 @@ import { Projection } from "./Projection"; import { Unprojection } from "./interfaces/Unprojection"; import { ViewerMouseEvent } from "./events/ViewerMouseEvent"; -import { LatLon } from "../api/interfaces/LatLon"; +import { LngLat } from "../api/interfaces/LngLat"; import { Transform } from "../geo/Transform"; import { LatLonAlt } from "../api/interfaces/LatLonAlt"; import { Image } from "../graph/Image"; @@ -122,7 +122,7 @@ export class Observer { } public project$( - latLon: LatLon) + lngLat: LngLat) : Observable { return observableCombineLatest( this._container.renderService.renderCamera$, @@ -133,16 +133,17 @@ export class Observer { ([render, image, reference]: [RenderCamera, Image, LatLonAlt]): number[] => { if (this._projection .distanceBetweenLatLons( - latLon, - image.latLon) > 1000) { + lngLat, + image.lngLat) > 1000) { return null; } - const canvasPoint: number[] = this._projection.latLonToCanvas( - latLon, - this._container.container, - render, - reference); + const canvasPoint: number[] = + this._projection.lngLatToCanvas( + lngLat, + this._container.container, + render, + reference); return !!canvasPoint ? [Math.round(canvasPoint[0]), Math.round(canvasPoint[1])] : @@ -308,7 +309,7 @@ export class Observer { return { basicPoint: unprojection.basicPoint, - latLon: unprojection.latLon, + lngLat: unprojection.lngLat, originalEvent: event, pixelPoint: unprojection.pixelPoint, target: this._viewer, @@ -384,14 +385,14 @@ export class Observer { this._started = false; } - public unproject$(canvasPoint: number[]): Observable { + public unproject$(canvasPoint: number[]): Observable { return observableCombineLatest( this._container.renderService.renderCamera$, this._navigator.stateService.reference$, this._navigator.stateService.currentTransform$).pipe( first(), map( - ([render, reference, transform]: [RenderCamera, LatLonAlt, Transform]): LatLon => { + ([render, reference, transform]: [RenderCamera, LatLonAlt, Transform]): LngLat => { const unprojection: Unprojection = this._projection.canvasToUnprojection( canvasPoint, @@ -400,7 +401,7 @@ export class Observer { reference, transform); - return unprojection.latLon; + return unprojection.lngLat; })); } diff --git a/src/viewer/PanService.ts b/src/viewer/PanService.ts index cf285086..f47d6206 100644 --- a/src/viewer/PanService.ts +++ b/src/viewer/PanService.ts @@ -22,7 +22,7 @@ import { import * as Geo from "../geo/Geo"; -import { LatLon } from "../api/interfaces/LatLon"; +import { LngLat } from "../api/interfaces/LngLat"; import { Spatial } from "../geo/Spatial"; import { Transform } from "../geo/Transform"; import { ViewportCoords } from "../geo/ViewportCoords"; @@ -130,7 +130,7 @@ export class PanService { const current$: Observable = observableOf(current); - const bounds: LatLon[] = this._graphCalculator.boundingBoxCorners(current.latLon, 20); + const bounds: LngLat[] = this._graphCalculator.boundingBoxCorners(current.lngLat, 20); const adjacent$: Observable = this._graphService .cacheBoundingBox$(bounds[0], bounds[1]).pipe( @@ -177,7 +177,7 @@ export class PanService { ([[cn, adjacent], reference]: [[Image, Image[]], LatLonAlt]): [Image, Transform, number][] => { const currentDirection: THREE.Vector3 = this._spatial.viewingDirection(cn.rotation); const currentTranslation: number[] = Geo.computeTranslation( - { lat: cn.latLon.lat, lon: cn.latLon.lon, alt: cn.computedAltitude }, + { lat: cn.lngLat.lat, lng: cn.lngLat.lng, alt: cn.computedAltitude }, cn.rotation, reference); const currentTransform: Transform = this._createTransform(cn, currentTranslation); @@ -198,7 +198,7 @@ export class PanService { for (const a of adjacent) { const translation: number[] = Geo.computeTranslation( - { lat: a.latLon.lat, lon: a.latLon.lon, alt: a.computedAltitude }, + { lat: a.lngLat.lat, lng: a.lngLat.lng, alt: a.computedAltitude }, a.rotation, reference); @@ -317,11 +317,11 @@ export class PanService { private _distance(image: Image, reference: Image): number { const [x, y, z] = geodeticToEnu( - image.latLon.lat, - image.latLon.lon, + image.lngLat.lat, + image.lngLat.lng, image.computedAltitude, - reference.latLon.lat, - reference.latLon.lon, + reference.lngLat.lat, + reference.lngLat.lng, reference.computedAltitude); return Math.sqrt(x * x + y * y + z * z); diff --git a/src/viewer/Projection.ts b/src/viewer/Projection.ts index cdaf3414..2a8a3d38 100644 --- a/src/viewer/Projection.ts +++ b/src/viewer/Projection.ts @@ -2,7 +2,7 @@ import * as THREE from "three"; import { Unprojection } from "./interfaces/Unprojection"; -import { LatLon } from "../api/interfaces/LatLon"; +import { LngLat } from "../api/interfaces/LngLat"; import { Spatial } from "../geo/Spatial"; import { Transform } from "../geo/Transform"; import { ViewportCoords } from "../geo/ViewportCoords"; @@ -81,55 +81,55 @@ export class Projection { const direction3d: THREE.Vector3 = point3d.clone().sub(render.camera.position).normalize(); const dist: number = -2 / direction3d.z; - let latLon: LatLon = null; + let lngLat: LngLat = null; if (dist > 0 && dist < 100 && !!basicPoint) { const point: THREE.Vector3 = direction3d.clone().multiplyScalar(dist).add(render.camera.position); - const latLonArray: number[] = enuToGeodetic( + const lngLatArray: number[] = enuToGeodetic( point.x, point.y, point.z, reference.lat, - reference.lon, + reference.lng, reference.alt) .slice(0, 2); - latLon = { lat: latLonArray[0], lon: latLonArray[1] }; + lngLat = { lat: lngLatArray[0], lng: lngLatArray[1] }; } const unprojection: Unprojection = { basicPoint: basicPoint, - latLon: latLon, + lngLat: lngLat, pixelPoint: [canvasX, canvasY], }; return unprojection; } - public cameraToLatLon(render: RenderCamera, reference: LatLonAlt): LatLon { + public cameraToLngLat(render: RenderCamera, reference: LatLonAlt): LngLat { const position: THREE.Vector3 = render.camera.position; const [lat, lon]: number[] = enuToGeodetic( position.x, position.y, position.z, reference.lat, - reference.lon, + reference.lng, reference.alt); - return { lat: lat, lon: lon }; + return { lat: lat, lng: lon }; } - public latLonToCanvas( - latLon: LatLon, + public lngLatToCanvas( + lngLat: LngLat, container: HTMLElement, render: RenderCamera, reference: LatLonAlt): number[] { const point3d: number[] = geodeticToEnu( - latLon.lat, - latLon.lon, + lngLat.lat, + lngLat.lng, 0, reference.lat, - reference.lon, + reference.lng, reference.alt); const canvas: number[] = this._viewportCoords.projectToCanvasSafe( @@ -140,11 +140,11 @@ export class Projection { return canvas; } - public distanceBetweenLatLons(latLon1: LatLon, latLon2: LatLon): number { + public distanceBetweenLatLons(lngLat1: LngLat, lngLat2: LngLat): number { return this._spatial.distanceFromLatLon( - latLon1.lat, - latLon1.lon, - latLon2.lat, - latLon2.lon); + lngLat1.lat, + lngLat1.lng, + lngLat2.lat, + lngLat2.lng); } } diff --git a/src/viewer/Viewer.ts b/src/viewer/Viewer.ts index a3705d62..ba30f209 100644 --- a/src/viewer/Viewer.ts +++ b/src/viewer/Viewer.ts @@ -7,7 +7,7 @@ import { first, } from "rxjs/operators"; -import { LatLon } from "../api/interfaces/LatLon"; +import { LngLat } from "../api/interfaces/LngLat"; import { Component } from "../component/Component"; import { ComponentConfiguration } from "../component/interfaces/ComponentConfiguration"; @@ -459,7 +459,7 @@ export class Viewer extends EventEmitter implements IViewer { /** * Get the viewer's current position * - * @returns {Promise} Promise to the viewers's current + * @returns {Promise} Promise to the viewers's current * position. * * @example @@ -467,16 +467,16 @@ export class Viewer extends EventEmitter implements IViewer { * viewer.getPosition().then((pos) => { console.log(pos); }); * ``` */ - public getPosition(): Promise { - return new Promise( - (resolve: (value: LatLon) => void, reject: (reason: Error) => void): void => { + public getPosition(): Promise { + return new Promise( + (resolve: (value: LngLat) => void, reject: (reason: Error) => void): void => { observableCombineLatest( this._container.renderService.renderCamera$, this._navigator.stateService.reference$).pipe( first()) .subscribe( ([render, reference]: [RenderCamera, LatLonAlt]): void => { - resolve(this._observer.projection.cameraToLatLon(render, reference)); + resolve(this._observer.projection.cameraToLngLat(render, reference)); }, (error: Error): void => { reject(error); @@ -1014,7 +1014,7 @@ export class Viewer extends EventEmitter implements IViewer { } /** - * Project an ILatLon representing geographicalcoordinates to + * Project an LngLat representing geographicalcoordinates to * canvas pixel coordinates. * * @description The geographical coordinates may not always correspond to pixel @@ -1032,13 +1032,13 @@ export class Viewer extends EventEmitter implements IViewer { * Note that whenever the camera moves, the result of the method will be * different. * - * @param {LatLon} latLon - Geographical coordinates to project. + * @param {LngLat} lngLat - Geographical coordinates to project. * @returns {Promise>} Promise to the pixel coordinates corresponding - * to the latLon. + * to the lngLat. * * @example * ```js - * viewer.project({ lat: 0, lon: 0 }) + * viewer.project({ lat: 0, lng: 0 }) * .then((pixelPoint) => { * if (!pixelPoint) { * console.log("no correspondence"); @@ -1048,10 +1048,10 @@ export class Viewer extends EventEmitter implements IViewer { * }); * ``` */ - public project(latLon: LatLon): Promise { + public project(lngLat: LngLat): Promise { return new Promise( (resolve: (value: number[]) => void, reject: (reason: Error) => void): void => { - this._observer.project$(latLon) + this._observer.project$(lngLat) .subscribe( (pixelPoint: number[]): void => { resolve(pixelPoint); @@ -1388,25 +1388,25 @@ export class Viewer extends EventEmitter implements IViewer { * coordinates. In the case of no correspondence the returned value will * be `null`. * - * The unprojection to a latLon will be performed towards the ground plane, i.e. - * the altitude with respect to the ground plane for the returned latLon is zero. + * The unprojection to a lngLat will be performed towards the ground plane, i.e. + * the altitude with respect to the ground plane for the returned lngLat is zero. * * @param {Array} pixelPoint - Pixel coordinates to unproject. - * @returns {Promise} Promise to the latLon corresponding to the pixel point. + * @returns {Promise} Promise to the lngLat corresponding to the pixel point. * * @example * ```js * viewer.unproject([100, 100]) - * .then((latLon) => { console.log(latLon); }); + * .then((lngLat) => { console.log(lngLat); }); * ``` */ - public unproject(pixelPoint: number[]): Promise { - return new Promise( - (resolve: (value: LatLon) => void, reject: (reason: Error) => void): void => { + public unproject(pixelPoint: number[]): Promise { + return new Promise( + (resolve: (value: LngLat) => void, reject: (reason: Error) => void): void => { this._observer.unproject$(pixelPoint) .subscribe( - (latLon: LatLon): void => { - resolve(latLon); + (lngLat: LngLat): void => { + resolve(lngLat); }, (error: Error): void => { reject(error); @@ -1423,7 +1423,7 @@ export class Viewer extends EventEmitter implements IViewer { * be `null`. * * @param {Array} pixelPoint - Pixel coordinates to unproject. - * @returns {Promise} Promise to the basic coordinates corresponding + * @returns {Promise} Promise to the basic coordinates corresponding * to the pixel point. * * @example diff --git a/src/viewer/events/ViewerMouseEvent.ts b/src/viewer/events/ViewerMouseEvent.ts index 4c0ceb64..c3640996 100644 --- a/src/viewer/events/ViewerMouseEvent.ts +++ b/src/viewer/events/ViewerMouseEvent.ts @@ -1,4 +1,4 @@ -import { LatLon } from "../../api/interfaces/LatLon"; +import { LngLat } from "../../api/interfaces/LngLat"; import { ViewerEvent } from "./ViewerEvent"; /** @@ -14,7 +14,7 @@ import { ViewerEvent } from "./ViewerEvent"; * viewer.on('click', function(e) { * // The event object (e) contains information like the * // coordinates of the point in the viewer that was clicked. - * console.log('A click event has occurred at ' + e.latLon); + * console.log('A click event has occurred at ' + e.lngLat); * }); * ``` */ @@ -41,7 +41,7 @@ export interface ViewerMouseEvent extends ViewerEvent { * geographic location for the mouse event target. In that case the * geographic coordinates will be `null`. */ - latLon: LatLon; + lngLat: LngLat; /** * The pixel coordinates of the mouse event target, relative to diff --git a/src/viewer/interfaces/IViewer.ts b/src/viewer/interfaces/IViewer.ts index 85f901da..685cca88 100644 --- a/src/viewer/interfaces/IViewer.ts +++ b/src/viewer/interfaces/IViewer.ts @@ -1,4 +1,4 @@ -import { LatLon } from "../../api/interfaces/LatLon"; +import { LngLat } from "../../api/interfaces/LngLat"; import { Component } from "../../component/Component"; import { ComponentConfiguration } from "../../component/interfaces/ComponentConfiguration"; @@ -33,7 +33,7 @@ export interface IViewer { getContainer(): HTMLElement; getFieldOfView(): Promise; getPointOfView(): Promise; - getPosition(): Promise; + getPosition(): Promise; getZoom(): Promise; hasCustomRenderer(rendererId: string): boolean; moveDir(direction: NavigationDirection): Promise; @@ -44,7 +44,7 @@ export interface IViewer { on( type: ViewerEventType, handler: (event: T) => void): void; - project(latLon: LatLon): Promise; + project(lngLat: LngLat): Promise; projectFromBasic(basicPoint: number[]): Promise; remove(): void; removeCustomRenderer(rendererId: string): void; @@ -57,6 +57,6 @@ export interface IViewer { setUserToken(userToken?: string): Promise; setZoom(zoom: number): void; triggerRerender(): void; - unproject(pixelPoint: number[]): Promise; + unproject(pixelPoint: number[]): Promise; unprojectToBasic(pixelPoint: number[]): Promise; } diff --git a/src/viewer/interfaces/Unprojection.ts b/src/viewer/interfaces/Unprojection.ts index 42e7502d..114d9491 100644 --- a/src/viewer/interfaces/Unprojection.ts +++ b/src/viewer/interfaces/Unprojection.ts @@ -1,7 +1,7 @@ -import { LatLon } from "../../api/interfaces/LatLon"; +import { LngLat } from "../../api/interfaces/LngLat"; export interface Unprojection { basicPoint: number[]; - latLon: LatLon; + lngLat: LngLat; pixelPoint: number[]; } diff --git a/test/Bootstrap.ts b/test/Bootstrap.ts index 0ee91be1..a397a53b 100644 --- a/test/Bootstrap.ts +++ b/test/Bootstrap.ts @@ -6,7 +6,7 @@ import { Interpolator } from "../src/state/interfaces/IInterpolator"; type Item = { lat: number; - lon: number; + lng: number; }; type BBox = { @@ -29,10 +29,10 @@ class SpatialIndexMock { return this._items .filter( item => { - return item.lat > bbox.minX && - item.lat < bbox.maxX && - item.lon > bbox.minY && - item.lon < bbox.maxY; + return item.lng > bbox.minX && + item.lng < bbox.maxX && + item.lat > bbox.minY && + item.lat < bbox.maxY; }); } } diff --git a/test/api/GeohashGeometryProvider.test.ts b/test/api/GeohashGeometryProvider.test.ts index 7061e89c..31803806 100644 --- a/test/api/GeohashGeometryProvider.test.ts +++ b/test/api/GeohashGeometryProvider.test.ts @@ -1,6 +1,6 @@ import * as geohash from "latlon-geohash"; import { GeohashGeometryProvider } from "../../src/api/GeohashGeometryProvider"; -import { LatLon } from "../../src/api/interfaces/LatLon"; +import { LngLat } from "../../src/api/interfaces/LngLat"; import { MapillaryError } from "../../src/error/MapillaryError"; import * as GeoCoords from "../../src/geo/GeoCoords"; @@ -11,7 +11,7 @@ describe("GeohashGeometryProvider.ctor", () => { }); }); -describe("GeohashGeometryProvider.latLonToCellId", () => { +describe("GeohashGeometryProvider.lngLatToCellId", () => { test("should call encoder correctly", () => { const mockEncode = spyOn(geohash, "encode").and.returnValue("0/0"); @@ -19,7 +19,7 @@ describe("GeohashGeometryProvider.latLonToCellId", () => { const geometry = new GeohashGeometryProvider(level); const lat = -1; const lon = 1; - geometry.latLonToCellId({ lat, lon }); + geometry.lngLatToCellId({ lat, lng: lon }); expect(mockEncode).toHaveBeenCalledTimes(1); expect(mockEncode).toHaveBeenCalledWith(lat, lon, level); @@ -96,8 +96,8 @@ describe("GeohashGeometryProvider.bboxToCellIds", () => { const tileSize = 1; setupSpies(tileSize); - const sw: LatLon = { lat: -0.1, lon: -0.1 }; - const ne: LatLon = { lat: 0.1, lon: 0.1 }; + const sw: LngLat = { lat: -0.1, lng: -0.1 }; + const ne: LngLat = { lat: 0.1, lng: 0.1 }; const cellIds = geometry.bboxToCellIds(sw, ne); expect(cellIds.length).toBe(1); @@ -109,8 +109,8 @@ describe("GeohashGeometryProvider.bboxToCellIds", () => { const tileSize = 1; setupSpies(tileSize); - const sw: LatLon = { lat: -0.6, lon: -0.6 }; - const ne: LatLon = { lat: 0.6, lon: 0.6 }; + const sw: LngLat = { lat: -0.6, lng: -0.6 }; + const ne: LngLat = { lat: 0.6, lng: 0.6 }; const cellIds = geometry.bboxToCellIds(sw, ne); expect(cellIds.length).toBe(9); @@ -133,22 +133,22 @@ describe("GeohashGeometryProvider.bboxToCellIds", () => { expect(() => { geometry .bboxToCellIds( - { lat: 0, lon: 0 }, - { lat: -1, lon: 1 }); + { lat: 0, lng: 0 }, + { lat: -1, lng: 1 }); }).toThrowError(MapillaryError); expect(() => { geometry .bboxToCellIds( - { lat: 0, lon: 0 }, - { lat: 1, lon: -1 }); + { lat: 0, lng: 0 }, + { lat: 1, lng: -1 }); }).toThrowError(MapillaryError); expect(() => { geometry .bboxToCellIds( - { lat: 0, lon: 0 }, - { lat: -1, lon: -1 }); + { lat: 0, lng: 0 }, + { lat: -1, lng: -1 }); }).toThrowError(MapillaryError); }); @@ -156,23 +156,23 @@ describe("GeohashGeometryProvider.bboxToCellIds", () => { it("should always be 8", () => { const geometry = new GeohashGeometryProvider(); - const latLons: LatLon[] = [ - { lat: 45, lon: 0 }, - { lat: 0, lon: 45 }, - { lat: -45, lon: 0 }, - { lat: 0, lon: -45 }, - { lat: 45, lon: 45 }, - { lat: -45, lon: -45 }, - { lat: 45, lon: -45 }, - { lat: -45, lon: 45 }, - { lat: -45, lon: 135 }, - { lat: -45, lon: 180 }, - { lat: 0, lon: 180 }, - { lat: 45, lon: 180 }, + const lngLats: LngLat[] = [ + { lat: 45, lng: 0 }, + { lat: 0, lng: 45 }, + { lat: -45, lng: 0 }, + { lat: 0, lng: -45 }, + { lat: 45, lng: 45 }, + { lat: -45, lng: -45 }, + { lat: 45, lng: -45 }, + { lat: -45, lng: 45 }, + { lat: -45, lng: 135 }, + { lat: -45, lng: 180 }, + { lat: 0, lng: 180 }, + { lat: 45, lng: 180 }, ]; - for (let latLon of latLons) { - const cellId = geometry.latLonToCellId(latLon); + for (let lngLat of lngLats) { + const cellId = geometry.lngLatToCellId(lngLat); const adjacent = geometry.getAdjacent(cellId); expect(adjacent.length).toBe(8); } diff --git a/test/api/GeometryProviderBase.test.ts b/test/api/GeometryProviderBase.test.ts index 66717e6e..9ba1b126 100644 --- a/test/api/GeometryProviderBase.test.ts +++ b/test/api/GeometryProviderBase.test.ts @@ -1,30 +1,30 @@ import { GeometryProviderBase } from "../../src/api/GeometryProviderBase"; -import { LatLon } from "../../src/api/interfaces/LatLon"; +import { LngLat } from "../../src/api/interfaces/LngLat"; import { MapillaryError } from "../../src/error/MapillaryError"; import * as GeoCoords from "../../src/geo/GeoCoords"; import { isClockwise } from "../helper/TestMath"; class GeometryProvider extends GeometryProviderBase { - public bboxToCellIds(sw: LatLon, ne: LatLon): string[] { + public bboxToCellIds(sw: LngLat, ne: LngLat): string[] { return this._approxBboxToCellIds(sw, ne); } - public getVertices(cellId: string): LatLon[] { + public getVertices(cellId: string): LngLat[] { const ll = this._cellIdToLatLng(cellId); const lat = ll.lat; - const lon = ll.lon; + const lon = ll.lng; return [ - { lat: lat - 0.5, lon: lon + 0.5 }, - { lat: lat - 0.5, lon: lon - 0.5 }, - { lat: lat + 0.5, lon: lon - 0.5 }, - { lat: lat + 0.5, lon: lon + 0.5 }, + { lat: lat - 0.5, lng: lon + 0.5 }, + { lat: lat - 0.5, lng: lon - 0.5 }, + { lat: lat + 0.5, lng: lon - 0.5 }, + { lat: lat + 0.5, lng: lon + 0.5 }, ]; } public getAdjacent(cellId: string): string[] { const ll = this._cellIdToLatLng(cellId); const lat = ll.lat; - const lon = ll.lon; + const lon = ll.lng; return [ `${lat}/${lon - 1}`, `${lat + 1}/${lon}`, @@ -37,17 +37,17 @@ class GeometryProvider extends GeometryProviderBase { ]; } - public latLonToCellId(latLon: LatLon): string { - const lat = latLon.lat; - const lon = latLon.lon; + public lngLatToCellId(lngLat: LngLat): string { + const lat = lngLat.lat; + const lon = lngLat.lng; return `${Math.round(lat)}/${Math.round(lon)}`; } - private _cellIdToLatLng(cellId: string): LatLon { + private _cellIdToLatLng(cellId: string): LngLat { const [c0, c1] = cellId.split("/"); const lat = Number.parseInt(c0, 10); const lon = Number.parseInt(c1, 10); - return { lat, lon }; + return { lat, lng: lon }; } } @@ -58,10 +58,10 @@ describe("GeometryProvider.ctor", () => { }); }); -describe("GeometryProvider.latLonToCellId", () => { +describe("GeometryProvider.lngLatToCellId", () => { it("should call geometry correctly", () => { const geometry = new GeometryProvider(); - const cellId = geometry.latLonToCellId({ lat: 0, lon: 0 }); + const cellId = geometry.lngLatToCellId({ lat: 0, lng: 0 }); expect(cellId).toBe("0/0"); }); }); @@ -93,8 +93,8 @@ describe("GeometryProvider.bboxToCellIds", () => { it("should return cell", () => { const geometry = new GeometryProvider(); - const sw: LatLon = { lat: -0.1, lon: -0.1 }; - const ne: LatLon = { lat: 0.1, lon: 0.1 }; + const sw: LngLat = { lat: -0.1, lng: -0.1 }; + const ne: LngLat = { lat: 0.1, lng: 0.1 }; const cellIds = geometry.bboxToCellIds(sw, ne); expect(cellIds.length).toBe(1); @@ -103,8 +103,8 @@ describe("GeometryProvider.bboxToCellIds", () => { it("should return cell and adjacent", () => { const geometry = new GeometryProvider(); - const sw: LatLon = { lat: -0.6, lon: -0.6 }; - const ne: LatLon = { lat: 0.6, lon: 0.6 }; + const sw: LngLat = { lat: -0.6, lng: -0.6 }; + const ne: LngLat = { lat: 0.6, lng: 0.6 }; const cellIds = geometry.bboxToCellIds(sw, ne); expect(cellIds.length).toBe(9); @@ -121,8 +121,8 @@ describe("GeometryProvider.bboxToCellIds", () => { it("should return cell and adjacent", () => { const geometry = new GeometryProvider(); - const sw: LatLon = { lat: -0.1, lon: -0.1 }; - const ne: LatLon = { lat: 0.1, lon: 0.6 }; + const sw: LngLat = { lat: -0.1, lng: -0.1 }; + const ne: LngLat = { lat: 0.1, lng: 0.6 }; const cellIds = geometry.bboxToCellIds(sw, ne); expect(cellIds.length).toBe(9); @@ -139,8 +139,8 @@ describe("GeometryProvider.bboxToCellIds", () => { it("should return cell and adjacent", () => { const geometry = new GeometryProvider(); - const sw: LatLon = { lat: -0.1, lon: -0.1 }; - const ne: LatLon = { lat: 0.6, lon: 0.1 }; + const sw: LngLat = { lat: -0.1, lng: -0.1 }; + const ne: LngLat = { lat: 0.6, lng: 0.1 }; const cellIds = geometry.bboxToCellIds(sw, ne); expect(cellIds.length).toBe(9); @@ -163,22 +163,22 @@ describe("S2GeometryProvider.bboxToCellIds", () => { expect(() => { geometry .bboxToCellIds( - { lat: 0, lon: 0 }, - { lat: -1, lon: 1 }); + { lat: 0, lng: 0 }, + { lat: -1, lng: 1 }); }).toThrowError(MapillaryError); expect(() => { geometry .bboxToCellIds( - { lat: 0, lon: 0 }, - { lat: 1, lon: -1 }); + { lat: 0, lng: 0 }, + { lat: 1, lng: -1 }); }).toThrowError(MapillaryError); expect(() => { geometry .bboxToCellIds( - { lat: 0, lon: 0 }, - { lat: -1, lon: -1 }); + { lat: 0, lng: 0 }, + { lat: -1, lng: -1 }); }).toThrowError(MapillaryError); }); }); @@ -187,28 +187,28 @@ describe("S2GeometryProvider.getCorners", () => { it("should be correctly placed relative to each other", () => { const geometry = new GeometryProvider(); - const latLons: LatLon[] = [ - { lat: 0, lon: 0 }, - { lat: 45, lon: 0 }, - { lat: 0, lon: 45 }, - { lat: -45, lon: 0 }, - { lat: 0, lon: -45 }, - { lat: 45, lon: 45 }, - { lat: -45, lon: -45 }, - { lat: 45, lon: -45 }, - { lat: -45, lon: 45 }, - { lat: -45, lon: 135 }, + const lngLats: LngLat[] = [ + { lat: 0, lng: 0 }, + { lat: 45, lng: 0 }, + { lat: 0, lng: 45 }, + { lat: -45, lng: 0 }, + { lat: 0, lng: -45 }, + { lat: 45, lng: 45 }, + { lat: -45, lng: -45 }, + { lat: 45, lng: -45 }, + { lat: -45, lng: 45 }, + { lat: -45, lng: 135 }, ]; - for (let latLon of latLons) { - const cellId = geometry.latLonToCellId(latLon); + for (let lngLat of lngLats) { + const cellId = geometry.lngLatToCellId(lngLat); const vertices = geometry.getVertices(cellId); expect(vertices.length).toBe(4); const polygon = vertices .map( - (ll: LatLon): number[] => { - return [ll.lon, ll.lat]; + (ll: LngLat): number[] => { + return [ll.lng, ll.lat]; }); expect(isClockwise(polygon)).toBe(true); diff --git a/test/api/S2GeometryProvider.test.ts b/test/api/S2GeometryProvider.test.ts index b9bf71f3..dae48132 100644 --- a/test/api/S2GeometryProvider.test.ts +++ b/test/api/S2GeometryProvider.test.ts @@ -1,5 +1,5 @@ import { S2 } from "s2-geometry"; -import { LatLon } from "../../src/api/interfaces/LatLon"; +import { LngLat } from "../../src/api/interfaces/LngLat"; import { S2GeometryProvider } from "../../src/api/S2GeometryProvider"; import { MapillaryError } from "../../src/error/MapillaryError"; import * as GeoCoords from "../../src/geo/GeoCoords"; @@ -13,7 +13,7 @@ describe("S2GeometryProvider.ctor", () => { }); }); -describe("GS2GeometryProvider.latLonToCellId", () => { +describe("GS2GeometryProvider.lngLatToCellId", () => { it("should call geometry correctly", () => { const keySpy = spyOn(S2, "latLngToKey"); const idSpy = spyOn(S2, "keyToId"); @@ -24,12 +24,12 @@ describe("GS2GeometryProvider.latLonToCellId", () => { const geometry = new S2GeometryProvider(level); const lat = -1; - const lon = 1; - geometry.latLonToCellId({ lat, lon }); + const lng = 1; + geometry.lngLatToCellId({ lat, lng }); expect(keySpy.calls.count()).toBe(1); expect(keySpy.calls.first().args[0]).toBe(lat); - expect(keySpy.calls.first().args[1]).toBe(lon); + expect(keySpy.calls.first().args[1]).toBe(lng); expect(keySpy.calls.first().args[2]).toBe(level); expect(idSpy.calls.count()).toBe(1); @@ -96,13 +96,13 @@ describe("S2GeometryProvider.bboxToCellIds", () => { spyOn(GeoCoords, "geodeticToEnu").and.callFake( ( lat: number, - lon: number, + lng: number, _: number, refLat: number, - refLon: number) + refLng: number) : number[] => { return [ - tileSize * (lon - refLon), + tileSize * (lng - refLng), tileSize * (lat - refLat), 0]; }); @@ -121,8 +121,8 @@ describe("S2GeometryProvider.bboxToCellIds", () => { const tileSize = 1; setupSpies(tileSize); - const sw: LatLon = { lat: -0.1, lon: -0.1 }; - const ne: LatLon = { lat: 0.1, lon: 0.1 }; + const sw: LngLat = { lat: -0.1, lng: -0.1 }; + const ne: LngLat = { lat: 0.1, lng: 0.1 }; const cellIds = geometry.bboxToCellIds(sw, ne); expect(cellIds.length).toBe(1); @@ -134,8 +134,8 @@ describe("S2GeometryProvider.bboxToCellIds", () => { const tileSize = 1; setupSpies(tileSize); - const sw: LatLon = { lat: -0.6, lon: -0.6 }; - const ne: LatLon = { lat: 0.6, lon: 0.6 }; + const sw: LngLat = { lat: -0.6, lng: -0.6 }; + const ne: LngLat = { lat: 0.6, lng: 0.6 }; const cellIds = geometry.bboxToCellIds(sw, ne); expect(cellIds.length).toBe(9); @@ -157,21 +157,21 @@ describe("S2GeometryProvider.bboxToCellIds", () => { expect(() => { geometry .bboxToCellIds( - { lat: 0, lon: 0 }, - { lat: -1, lon: 1 }); + { lat: 0, lng: 0 }, + { lat: -1, lng: 1 }); }).toThrowError(MapillaryError); expect(() => { geometry .bboxToCellIds( - { lat: 0, lon: 0 }, - { lat: 1, lon: -1 }); + { lat: 0, lng: 0 }, + { lat: 1, lng: -1 }); }).toThrowError(MapillaryError); expect(() => { geometry.bboxToCellIds( - { lat: 0, lon: 0 }, - { lat: -1, lon: -1 }); + { lat: 0, lng: 0 }, + { lat: -1, lng: -1 }); }).toThrowError(MapillaryError); }); }); @@ -180,28 +180,28 @@ describe("S2GeometryProvider.bboxToCellIds", () => { it("should be correctly placed relative to each other", () => { const geometry = new S2GeometryProvider(); - const latLons: LatLon[] = [ - { lat: 0, lon: 0 }, - { lat: 45, lon: 0 }, - { lat: 0, lon: 45 }, - { lat: -45, lon: 0 }, - { lat: 0, lon: -45 }, - { lat: 45, lon: 45 }, - { lat: -45, lon: -45 }, - { lat: 45, lon: -45 }, - { lat: -45, lon: 45 }, - { lat: -45, lon: 135 }, + const lngLats: LngLat[] = [ + { lat: 0, lng: 0 }, + { lat: 45, lng: 0 }, + { lat: 0, lng: 45 }, + { lat: -45, lng: 0 }, + { lat: 0, lng: -45 }, + { lat: 45, lng: 45 }, + { lat: -45, lng: -45 }, + { lat: 45, lng: -45 }, + { lat: -45, lng: 45 }, + { lat: -45, lng: 135 }, ]; - for (let latLon of latLons) { - const cellId = geometry.latLonToCellId(latLon); + for (let lngLat of lngLats) { + const cellId = geometry.lngLatToCellId(lngLat); const vertices = geometry.getVertices(cellId); expect(vertices.length).toBe(4); const polygon = vertices .map( - (ll: LatLon): number[] => { - return [ll.lon, ll.lat]; + (ll: LngLat): number[] => { + return [ll.lng, ll.lat]; }); expect(isClockwise(polygon)).toBe(true); @@ -213,24 +213,24 @@ describe("S2GeometryProvider.bboxToCellIds", () => { it("should always be 8", () => { const geometry = new S2GeometryProvider(); - const latLons: LatLon[] = [ - { lat: 0, lon: 0 }, - { lat: 45, lon: 0 }, - { lat: 0, lon: 45 }, - { lat: -45, lon: 0 }, - { lat: 0, lon: -45 }, - { lat: 45, lon: 45 }, - { lat: -45, lon: -45 }, - { lat: 45, lon: -45 }, - { lat: -45, lon: 45 }, - { lat: -45, lon: 135 }, - { lat: -45, lon: 180 }, - { lat: 0, lon: 180 }, - { lat: 45, lon: 180 }, + const lngLats: LngLat[] = [ + { lat: 0, lng: 0 }, + { lat: 45, lng: 0 }, + { lat: 0, lng: 45 }, + { lat: -45, lng: 0 }, + { lat: 0, lng: -45 }, + { lat: 45, lng: 45 }, + { lat: -45, lng: -45 }, + { lat: 45, lng: -45 }, + { lat: -45, lng: 45 }, + { lat: -45, lng: 135 }, + { lat: -45, lng: 180 }, + { lat: 0, lng: 180 }, + { lat: 45, lng: 180 }, ]; - for (let latLon of latLons) { - const cellId = geometry.latLonToCellId(latLon); + for (let lngLat of lngLats) { + const cellId = geometry.lngLatToCellId(lngLat); const adjacent = geometry.getAdjacent(cellId); expect(adjacent.length).toBe(8); } diff --git a/test/api/falcor/FalcorDataProvider.test.ts b/test/api/falcor/FalcorDataProvider.test.ts index 971f6ad7..700317e5 100644 --- a/test/api/falcor/FalcorDataProvider.test.ts +++ b/test/api/falcor/FalcorDataProvider.test.ts @@ -766,7 +766,7 @@ describe("FalcorDataProvider.getClusterReconstruction", () => { expect(r.points).toEqual({}); expect(r.reference.alt).toBe(1); expect(r.reference.lat).toBe(2); - expect(r.reference.lon).toBe(3); + expect(r.reference.lng).toBe(3); done(); }); diff --git a/test/component/marker/Marker.test.ts b/test/component/marker/Marker.test.ts index dfbe457b..80751e2b 100644 --- a/test/component/marker/Marker.test.ts +++ b/test/component/marker/Marker.test.ts @@ -1,9 +1,9 @@ import * as THREE from "three"; -import { LatLon } from "../../../src/api/interfaces/LatLon"; +import { LngLat } from "../../../src/api/interfaces/LngLat"; import { Marker } from "../../../src/component/marker/marker/Marker"; class TestMarker extends Marker { - constructor(id: string, latLon: LatLon) { super(id, latLon); } + constructor(id: string, lngLat: LngLat) { super(id, lngLat); } protected _createGeometry(position: number[]): void { this._geometry = new THREE.Object3D(); this._geometry.position.fromArray(position); @@ -15,25 +15,25 @@ class TestMarker extends Marker { describe("Marker.ctor", () => { it("should be defined", () => { - let marker: Marker = new TestMarker("id", { lat: 1, lon: 2 }); + let marker: Marker = new TestMarker("id", { lat: 1, lng: 2 }); expect(marker).toBeDefined(); expect(marker.id).toBe("id"); - expect(marker.latLon.lat).toBe(1); - expect(marker.latLon.lon).toBe(2); + expect(marker.lngLat.lat).toBe(1); + expect(marker.lngLat.lng).toBe(2); }); }); describe("Marker.createGeometry", () => { it("geometry should be defined", () => { - let marker: Marker = new TestMarker("id", { lat: 1, lon: 2 }); + let marker: Marker = new TestMarker("id", { lat: 1, lng: 2 }); marker.createGeometry([0, 0, 0]); expect(marker.geometry).toBeDefined(); }); it("geometry should not create a new geometry", () => { - let marker: Marker = new TestMarker("id", { lat: 1, lon: 2 }); + let marker: Marker = new TestMarker("id", { lat: 1, lng: 2 }); marker.createGeometry([0, 0, 0]); let uuid: string = marker.geometry.uuid; @@ -46,7 +46,7 @@ describe("Marker.createGeometry", () => { describe("Marker.disposeGeometry", () => { it("geometry should be null", () => { - let marker: Marker = new TestMarker("id", { lat: 1, lon: 2 }); + let marker: Marker = new TestMarker("id", { lat: 1, lng: 2 }); marker.createGeometry([0, 0, 0]); marker.disposeGeometry(); @@ -56,14 +56,14 @@ describe("Marker.disposeGeometry", () => { describe("Marker.getInteractiveObjectIds", () => { it("should return empty array if geometry not defined", () => { - let marker: Marker = new TestMarker("id", { lat: 1, lon: 2 }); + let marker: Marker = new TestMarker("id", { lat: 1, lng: 2 }); let objects: THREE.Object3D[] = marker.getInteractiveObjects(); expect(objects.length).toBe(0); }); it("should return object ids when geometry created", () => { - let marker: Marker = new TestMarker("id", { lat: 1, lon: 2 }); + let marker: Marker = new TestMarker("id", { lat: 1, lng: 2 }); marker.createGeometry([0, 0, 0]); let objects: THREE.Object3D[] = marker.getInteractiveObjects(); @@ -74,7 +74,7 @@ describe("Marker.getInteractiveObjectIds", () => { describe("Marker.updatePosition", () => { it("should update geometry position", () => { - let marker: Marker = new TestMarker("id", { lat: 1, lon: 2 }); + let marker: Marker = new TestMarker("id", { lat: 1, lng: 2 }); marker.createGeometry([0, 1, 2]); expect(marker.geometry.position.x).toBe(0); @@ -89,11 +89,11 @@ describe("Marker.updatePosition", () => { }); it("should update lat lon", () => { - let marker: Marker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: Marker = new TestMarker("id", { lat: 0, lng: 0 }); marker.createGeometry([0, 0, 0]); - marker.updatePosition([1, 2, 3], { lat: 1, lon: 2 }); + marker.updatePosition([1, 2, 3], { lat: 1, lng: 2 }); - expect(marker.latLon.lat).toBe(1); - expect(marker.latLon.lon).toBe(2); + expect(marker.lngLat.lat).toBe(1); + expect(marker.lngLat.lng).toBe(2); }); }); diff --git a/test/component/marker/MarkerComponent.test.ts b/test/component/marker/MarkerComponent.test.ts index 61dfec91..9d3dbf3a 100644 --- a/test/component/marker/MarkerComponent.test.ts +++ b/test/component/marker/MarkerComponent.test.ts @@ -39,11 +39,11 @@ describe("MarkerComponent.add", () => { }); it("should be able to create two markers at the exact same position", () => { - let m1: Marker = new SimpleMarker("1", { lat: 0, lon: 0 }, {}); + let m1: Marker = new SimpleMarker("1", { lat: 0, lng: 0 }, {}); markerComponent.add([m1]); expect(markerComponent.getAll().length).toBe(1); - let m2: Marker = new SimpleMarker("2", { lat: 0, lon: 0 }, {}); + let m2: Marker = new SimpleMarker("2", { lat: 0, lng: 0 }, {}); markerComponent.add([m2]); expect(markerComponent.getAll().length).toBe(2); @@ -55,17 +55,17 @@ describe("MarkerComponent.add", () => { }); it("should be able to update an marker by using the same id", () => { - let m1: Marker = new SimpleMarker("1", { lat: 0, lon: 0 }, {}); + let m1: Marker = new SimpleMarker("1", { lat: 0, lng: 0 }, {}); markerComponent.add([m1]); expect(markerComponent.getAll().length).toBe(1); - expect(markerComponent.get("1").latLon.lat).toBe(0); - expect(markerComponent.get("1").latLon.lon).toBe(0); + expect(markerComponent.get("1").lngLat.lat).toBe(0); + expect(markerComponent.get("1").lngLat.lng).toBe(0); - let m2: Marker = new SimpleMarker("1", { lat: 1, lon: 1 }, {}); + let m2: Marker = new SimpleMarker("1", { lat: 1, lng: 1 }, {}); markerComponent.add([m2]); expect(markerComponent.getAll().length).toBe(1); - expect(markerComponent.get("1").latLon.lat).toBe(1); - expect(markerComponent.get("1").latLon.lon).toBe(1); + expect(markerComponent.get("1").lngLat.lat).toBe(1); + expect(markerComponent.get("1").lngLat.lng).toBe(1); }); }); diff --git a/test/component/marker/MarkerScene.test.ts b/test/component/marker/MarkerScene.test.ts index 3341615b..7c445950 100644 --- a/test/component/marker/MarkerScene.test.ts +++ b/test/component/marker/MarkerScene.test.ts @@ -1,10 +1,10 @@ import * as THREE from "three"; -import { LatLon } from "../../../src/api/interfaces/LatLon"; +import { LngLat } from "../../../src/api/interfaces/LngLat"; import { Marker } from "../../../src/component/marker/marker/Marker"; import { MarkerScene } from "../../../src/component/marker/MarkerScene"; class TestMarker extends Marker { - constructor(id: string, latLon: LatLon) { super(id, latLon); } + constructor(id: string, lngLat: LngLat) { super(id, lngLat); } protected _createGeometry(position: number[]): void { /* noop */ } protected _disposeGeometry(): void { /* noop */ } protected _getInteractiveObjects(): THREE.Object3D[] { return []; } @@ -42,7 +42,7 @@ describe("MarkerScene.add", () => { let markerScene: MarkerScene = new MarkerScene(scene); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); let createGeometrySpy: jasmine.Spy = spyOn(marker, "createGeometry").and.stub(); let getInteractiveSpy: jasmine.Spy = spyOn(marker, "getInteractiveObjects"); @@ -67,7 +67,7 @@ describe("MarkerScene.render", () => { let markerScene: MarkerScene = new MarkerScene(scene); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); spyOn(marker, "createGeometry").and.stub(); spyOn(marker, "getInteractiveObjects").and.returnValue([]); @@ -93,7 +93,7 @@ describe("MarkerScene.clear", () => { spyOn(scene, "add").and.stub(); let markerScene: MarkerScene = new MarkerScene(scene); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); spyOn(marker, "createGeometry").and.stub(); spyOn(marker, "getInteractiveObjects").and.returnValue([]); @@ -123,7 +123,7 @@ describe("MarkerScene.remove", () => { spyOn(scene, "add").and.stub(); let markerScene: MarkerScene = new MarkerScene(scene); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); spyOn(marker, "createGeometry").and.stub(); spyOn(marker, "getInteractiveObjects").and.returnValue([]); @@ -154,7 +154,7 @@ describe("MarkerScene.has", () => { let markerScene: MarkerScene = new MarkerScene(scene); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); spyOn(marker, "createGeometry").and.stub(); spyOn(marker, "getInteractiveObjects").and.returnValue([]); @@ -177,14 +177,14 @@ describe("MarkerScene.update", () => { let markerScene: MarkerScene = new MarkerScene(scene); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); spyOn(marker, "createGeometry").and.stub(); spyOn(marker, "getInteractiveObjects").and.returnValue([]); let updateSpy: jasmine.Spy = spyOn(marker, "updatePosition"); markerScene.add(marker, [0, 0, 0]); - markerScene.update(marker.id, [1, 1, 1], { lat: 1, lon: 1 }); + markerScene.update(marker.id, [1, 1, 1], { lat: 1, lng: 1 }); expect(updateSpy.calls.count()).toBe(1); }); @@ -204,7 +204,7 @@ describe("MarkerScene.intersectObjects", () => { spyOn(raycaster, "intersectObjects").and.returnValue([intersection]); spyOn(raycaster, "setFromCamera").and.stub(); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); spyOn(marker, "createGeometry").and.stub(); spyOn(marker, "getInteractiveObjects").and.returnValue([interactiveObject]); diff --git a/test/component/marker/MarkerSet.test.ts b/test/component/marker/MarkerSet.test.ts index 934d3d1f..270a8fc5 100644 --- a/test/component/marker/MarkerSet.test.ts +++ b/test/component/marker/MarkerSet.test.ts @@ -3,12 +3,12 @@ bootstrap(); import { first } from "rxjs/operators"; import { Subscription } from "rxjs"; -import { LatLon } from "../../../src/api/interfaces/LatLon"; +import { LngLat } from "../../../src/api/interfaces/LngLat"; import { Marker } from "../../../src/component/marker/marker/Marker"; import { MarkerSet } from "../../../src/component/marker/MarkerSet"; class TestMarker extends Marker { - constructor(id: string, latLon: LatLon) { super(id, latLon); } + constructor(id: string, lngLat: LngLat) { super(id, lngLat); } protected _createGeometry(position: number[]): void { /* noop */ } protected _disposeGeometry(): void { /* noop */ } protected _getInteractiveObjects(): THREE.Object3D[] { return []; } @@ -35,86 +35,86 @@ describe("MarkerSet.get", () => { describe("MarkerSet.add", () => { it("should add a single marker", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); markerSet.add([marker]); let result: Marker = markerSet.get(marker.id); expect(result).toBe(marker); expect(result.id).toBe(marker.id); - expect(result.latLon.lat).toBe(marker.latLon.lat); - expect(result.latLon.lon).toBe(marker.latLon.lon); + expect(result.lngLat.lat).toBe(marker.lngLat.lat); + expect(result.lngLat.lng).toBe(marker.lngLat.lng); }); it("should add multiple markers", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker1: TestMarker = new TestMarker("id1", { lat: 1, lon: 1 }); - let marker2: TestMarker = new TestMarker("id2", { lat: 2, lon: 2 }); + let marker1: TestMarker = new TestMarker("id1", { lat: 1, lng: 1 }); + let marker2: TestMarker = new TestMarker("id2", { lat: 2, lng: 2 }); markerSet.add([marker1, marker2]); let result1: Marker = markerSet.get(marker1.id); expect(result1).toBe(marker1); expect(result1.id).toBe(marker1.id); - expect(result1.latLon.lat).toBe(marker1.latLon.lat); - expect(result1.latLon.lon).toBe(marker1.latLon.lon); + expect(result1.lngLat.lat).toBe(marker1.lngLat.lat); + expect(result1.lngLat.lng).toBe(marker1.lngLat.lng); let result2: Marker = markerSet.get(marker2.id); expect(result2).toBe(marker2); expect(result2.id).toBe(marker2.id); - expect(result2.latLon.lat).toBe(marker2.latLon.lat); - expect(result2.latLon.lon).toBe(marker2.latLon.lon); + expect(result2.lngLat.lat).toBe(marker2.lngLat.lat); + expect(result2.lngLat.lng).toBe(marker2.lngLat.lng); }); it("should replace when marker with id exist", () => { let markerSet: MarkerSet = new MarkerSet(); let id: string = "original-id"; - let originalMarker: TestMarker = new TestMarker(id, { lat: 0, lon: 0 }); + let originalMarker: TestMarker = new TestMarker(id, { lat: 0, lng: 0 }); markerSet.add([originalMarker]); - let newMarker: TestMarker = new TestMarker(id, { lat: 1, lon: 1 }); + let newMarker: TestMarker = new TestMarker(id, { lat: 1, lng: 1 }); markerSet.add([newMarker]); let result: Marker = markerSet.get(id); expect(result).not.toBe(originalMarker); expect(result).toBe(newMarker); expect(result.id).toBe(id); - expect(result.latLon.lat).toBe(newMarker.latLon.lat); - expect(result.latLon.lon).toBe(newMarker.latLon.lon); + expect(result.lngLat.lat).toBe(newMarker.lngLat.lat); + expect(result.lngLat.lng).toBe(newMarker.lngLat.lng); }); test("should replace and update index when marker with id exist", () => { let markerSet: MarkerSet = new MarkerSet(); let id: string = "original-id"; - let originalMarker: TestMarker = new TestMarker(id, { lat: 0, lon: 0 }); + let originalMarker: TestMarker = new TestMarker(id, { lat: 0, lng: 0 }); markerSet.add([originalMarker]); - let newMarker: TestMarker = new TestMarker(id, { lat: 1, lon: 1 }); + let newMarker: TestMarker = new TestMarker(id, { lat: 1, lng: 1 }); markerSet.add([newMarker]); let originalResult: Marker[] = markerSet.search([ - { lat: -0.5, lon: -0.5 }, - { lat: 0.5, lon: 0.5 }, + { lat: -0.5, lng: -0.5 }, + { lat: 0.5, lng: 0.5 }, ]); expect(originalResult.length).toBe(0); let updatedResult: Marker[] = markerSet.search([ - { lat: 0.5, lon: 0.5 }, - { lat: 1.5, lon: 1.5 }, + { lat: 0.5, lng: 0.5 }, + { lat: 1.5, lng: 1.5 }, ]); expect(updatedResult.length).toBe(1); expect(updatedResult[0].id).toBe(id); - expect(updatedResult[0].latLon.lat).toBe(newMarker.latLon.lat); - expect(updatedResult[0].latLon.lon).toBe(newMarker.latLon.lon); + expect(updatedResult[0].lngLat.lat).toBe(newMarker.lngLat.lat); + expect(updatedResult[0].lngLat.lng).toBe(newMarker.lngLat.lng); }); }); describe("MarkerSet.getAll", () => { it("should return a single marker", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); markerSet.add([marker]); @@ -126,8 +126,8 @@ describe("MarkerSet.getAll", () => { it("should return multiple markers", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker1: TestMarker = new TestMarker("id1", { lat: 0, lon: 0 }); - let marker2: TestMarker = new TestMarker("id2", { lat: 0, lon: 0 }); + let marker1: TestMarker = new TestMarker("id1", { lat: 0, lng: 0 }); + let marker2: TestMarker = new TestMarker("id2", { lat: 0, lng: 0 }); markerSet.add([marker1, marker2]); @@ -152,7 +152,7 @@ describe("MarkerSet.getAll", () => { describe("MarkerSet.has", () => { it("should have an added marker", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); markerSet.add([marker]); @@ -169,7 +169,7 @@ describe("MarkerSet.has", () => { describe("MarkerSet.remove", () => { it("should remove a single marker", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); markerSet.add([marker]); markerSet.remove([marker.id]); @@ -180,8 +180,8 @@ describe("MarkerSet.remove", () => { it("should remove multiple markers", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker1: TestMarker = new TestMarker("id1", { lat: 1, lon: 1 }); - let marker2: TestMarker = new TestMarker("id2", { lat: 2, lon: 2 }); + let marker1: TestMarker = new TestMarker("id1", { lat: 1, lng: 1 }); + let marker2: TestMarker = new TestMarker("id2", { lat: 2, lng: 2 }); markerSet.add([marker1, marker2]); markerSet.remove([marker1.id, marker2.id]); @@ -195,8 +195,8 @@ describe("MarkerSet.remove", () => { it("should remove a single out of multiple markers", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker1: TestMarker = new TestMarker("id1", { lat: 1, lon: 1 }); - let marker2: TestMarker = new TestMarker("id2", { lat: 2, lon: 2 }); + let marker1: TestMarker = new TestMarker("id1", { lat: 1, lng: 1 }); + let marker2: TestMarker = new TestMarker("id2", { lat: 2, lng: 2 }); markerSet.add([marker1, marker2]); markerSet.remove([marker1.id]); @@ -210,7 +210,7 @@ describe("MarkerSet.remove", () => { it("should not have effect if id does not exist", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker: TestMarker = new TestMarker("id", { lat: 1, lon: 1 }); + let marker: TestMarker = new TestMarker("id", { lat: 1, lng: 1 }); markerSet.add([marker]); markerSet.remove(["other-id"]); @@ -223,7 +223,7 @@ describe("MarkerSet.remove", () => { describe("MarkerSet.removeAll", () => { it("should remove a single marker", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); markerSet.add([marker]); markerSet.removeAll(); @@ -237,8 +237,8 @@ describe("MarkerSet.removeAll", () => { it("should remove multiple markers", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker1: TestMarker = new TestMarker("id1", { lat: 1, lon: 1 }); - let marker2: TestMarker = new TestMarker("id2", { lat: 2, lon: 2 }); + let marker1: TestMarker = new TestMarker("id1", { lat: 1, lng: 1 }); + let marker2: TestMarker = new TestMarker("id2", { lat: 2, lng: 2 }); markerSet.add([marker1, marker2]); markerSet.removeAll(); @@ -259,43 +259,43 @@ describe("MarkerSet.update", () => { let markerSet: MarkerSet = new MarkerSet(); let id: string = "id"; - let originalMarker: TestMarker = new TestMarker(id, { lat: 0, lon: 0 }); + let originalMarker: TestMarker = new TestMarker(id, { lat: 0, lng: 0 }); markerSet.add([originalMarker]); - let updatedMarker: TestMarker = new TestMarker(id, { lat: 1, lon: 1 }); + let updatedMarker: TestMarker = new TestMarker(id, { lat: 1, lng: 1 }); markerSet.update(updatedMarker); let result: Marker = markerSet.get(id); expect(result).not.toBe(originalMarker); expect(result).toBe(updatedMarker); - expect(result.latLon.lat).toBe(updatedMarker.latLon.lat); - expect(result.latLon.lon).toBe(updatedMarker.latLon.lon); + expect(result.lngLat.lat).toBe(updatedMarker.lngLat.lat); + expect(result.lngLat.lng).toBe(updatedMarker.lngLat.lng); }); it("should replace the original marker and update index", () => { let markerSet: MarkerSet = new MarkerSet(); let id: string = "id"; - let originalMarker: TestMarker = new TestMarker(id, { lat: 0, lon: 0 }); + let originalMarker: TestMarker = new TestMarker(id, { lat: 0, lng: 0 }); markerSet.add([originalMarker]); - let updatedMarker: TestMarker = new TestMarker(id, { lat: 1, lon: 1 }); + let updatedMarker: TestMarker = new TestMarker(id, { lat: 1, lng: 1 }); markerSet.update(updatedMarker); let originalResult: Marker[] = markerSet.search([ - { lat: -0.5, lon: -0.5 }, - { lat: 0.5, lon: 0.5 }, + { lat: -0.5, lng: -0.5 }, + { lat: 0.5, lng: 0.5 }, ]); expect(originalResult.length).toBe(0); let updatedResult: Marker[] = markerSet.search([ - { lat: 0.5, lon: 0.5 }, - { lat: 1.5, lon: 1.5 }, + { lat: 0.5, lng: 0.5 }, + { lat: 1.5, lng: 1.5 }, ]); expect(updatedResult.length).toBe(1); expect(updatedResult[0].id).toBe(id); - expect(updatedResult[0].latLon.lat).toBe(updatedMarker.latLon.lat); - expect(updatedResult[0].latLon.lon).toBe(updatedMarker.latLon.lon); + expect(updatedResult[0].lngLat.lat).toBe(updatedMarker.lngLat.lat); + expect(updatedResult[0].lngLat.lng).toBe(updatedMarker.lngLat.lng); }); }); @@ -303,7 +303,7 @@ describe("MarkerSet.changed$", () => { it("should emit when adding marker", (done: Function) => { let markerSet: MarkerSet = new MarkerSet(); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); markerSet.changed$.pipe( first()) @@ -320,7 +320,7 @@ describe("MarkerSet.changed$", () => { it("should not emit when all added markers already exist", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); markerSet.add([marker]); let hasEmitted: boolean = false; @@ -340,7 +340,7 @@ describe("MarkerSet.changed$", () => { it("should emit when removing marker", (done: Function) => { let markerSet: MarkerSet = new MarkerSet(); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); markerSet.add([marker]); markerSet.changed$.pipe( @@ -377,7 +377,7 @@ describe("MarkerSet.updated$", () => { it("should emit not when adding a new marker", () => { let markerSet: MarkerSet = new MarkerSet(); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); let hasEmitted: boolean = false; markerSet.updated$.pipe( @@ -395,7 +395,7 @@ describe("MarkerSet.updated$", () => { it("should emit when adding an existing marker", (done: Function) => { let markerSet: MarkerSet = new MarkerSet(); - let marker: TestMarker = new TestMarker("id", { lat: 0, lon: 0 }); + let marker: TestMarker = new TestMarker("id", { lat: 0, lng: 0 }); markerSet.add([marker]); markerSet.updated$.pipe( @@ -414,10 +414,10 @@ describe("MarkerSet.updated$", () => { it("should emit to both updated and changed", (done: Function) => { let markerSet: MarkerSet = new MarkerSet(); - let marker1: TestMarker = new TestMarker("id1", { lat: 0, lon: 0 }); + let marker1: TestMarker = new TestMarker("id1", { lat: 0, lng: 0 }); markerSet.add([marker1]); - let marker2: TestMarker = new TestMarker("id2", { lat: 0, lon: 0 }); + let marker2: TestMarker = new TestMarker("id2", { lat: 0, lng: 0 }); let firstDone: boolean = false; markerSet.updated$.pipe( diff --git a/test/component/spatialData/SpatialDataCache.test.ts b/test/component/spatialData/SpatialDataCache.test.ts index 8f5a09d1..d0665ac0 100644 --- a/test/component/spatialData/SpatialDataCache.test.ts +++ b/test/component/spatialData/SpatialDataCache.test.ts @@ -407,7 +407,7 @@ describe("SpatialDataCache.updateReconstructions$", () => { cameras: {}, id: key, points: {}, - reference: { lat: 0, lon: 0, alt: 0 }, + reference: { lat: 0, lng: 0, alt: 0 }, shots: {}, } } diff --git a/test/geo/GeoCoords.test.ts b/test/geo/GeoCoords.test.ts index ed515d80..ef3e529d 100644 --- a/test/geo/GeoCoords.test.ts +++ b/test/geo/GeoCoords.test.ts @@ -15,9 +15,9 @@ let wgs84b: number = 6356752.31424518; describe("GeoCoords.geodeticToEcef", () => { it("should convert Equator - Greenwich to X axis value", () => { - let position: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let position: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; - let ecef: number[] = geodeticToEcef(position.lat, position.lon, position.alt); + let ecef: number[] = geodeticToEcef(position.lat, position.lng, position.alt); expect(ecef[0]).toBeCloseTo(wgs84a, precision); expect(ecef[1]).toBeCloseTo(0, precision); @@ -25,25 +25,25 @@ describe("GeoCoords.geodeticToEcef", () => { }); it("should convert positions on Equator to WGS84 a distance", () => { - let position1: LatLonAlt = { alt: 0, lat: 0, lon: 90 }; + let position1: LatLonAlt = { alt: 0, lat: 0, lng: 90 }; - let ecef1: number[] = geodeticToEcef(position1.lat, position1.lon, position1.alt); + let ecef1: number[] = geodeticToEcef(position1.lat, position1.lng, position1.alt); expect(ecef1[0]).toBeCloseTo(0, precision); expect(ecef1[1]).toBeCloseTo(wgs84a, precision); expect(ecef1[2]).toBeCloseTo(0, precision); - let position2: LatLonAlt = { alt: 0, lat: 0, lon: 180 }; + let position2: LatLonAlt = { alt: 0, lat: 0, lng: 180 }; - let ecef2: number[] = geodeticToEcef(position2.lat, position2.lon, position2.alt); + let ecef2: number[] = geodeticToEcef(position2.lat, position2.lng, position2.alt); expect(ecef2[0]).toBeCloseTo(-wgs84a, precision); expect(ecef2[1]).toBeCloseTo(0, precision); expect(ecef2[2]).toBeCloseTo(0, precision); - let position3: LatLonAlt = { alt: 0, lat: 0, lon: -90 }; + let position3: LatLonAlt = { alt: 0, lat: 0, lng: -90 }; - let ecef3: number[] = geodeticToEcef(position3.lat, position3.lon, position3.alt); + let ecef3: number[] = geodeticToEcef(position3.lat, position3.lng, position3.alt); expect(ecef3[0]).toBeCloseTo(0, precision); expect(ecef3[1]).toBeCloseTo(-wgs84a, precision); @@ -51,19 +51,19 @@ describe("GeoCoords.geodeticToEcef", () => { }); it("should convert random Equator postion correctly", () => { - let position: LatLonAlt = { alt: 0, lat: 0, lon: 35.6589 }; + let position: LatLonAlt = { alt: 0, lat: 0, lng: 35.6589 }; - let ecef: number[] = geodeticToEcef(position.lat, position.lon, position.alt); + let ecef: number[] = geodeticToEcef(position.lat, position.lng, position.alt); - expect(ecef[0]).toBeCloseTo(wgs84a * Math.cos(Math.PI * position.lon / 180), precision); - expect(ecef[1]).toBeCloseTo(wgs84a * Math.sin(Math.PI * position.lon / 180), precision); + expect(ecef[0]).toBeCloseTo(wgs84a * Math.cos(Math.PI * position.lng / 180), precision); + expect(ecef[1]).toBeCloseTo(wgs84a * Math.sin(Math.PI * position.lng / 180), precision); expect(ecef[2]).toBeCloseTo(0, precision); }); it("should convert value with altitude correctly", () => { - let position: LatLonAlt = { alt: 452.43537987, lat: 0, lon: 0 }; + let position: LatLonAlt = { alt: 452.43537987, lat: 0, lng: 0 }; - let ecef: number[] = geodeticToEcef(position.lat, position.lon, position.alt); + let ecef: number[] = geodeticToEcef(position.lat, position.lng, position.alt); expect(ecef[0]).toBeCloseTo(wgs84a + position.alt, precision); expect(ecef[1]).toBeCloseTo(0, precision); @@ -71,9 +71,9 @@ describe("GeoCoords.geodeticToEcef", () => { }); it("should convert North Pole value correctly", () => { - let position: LatLonAlt = { alt: 0, lat: 90, lon: 0 }; + let position: LatLonAlt = { alt: 0, lat: 90, lng: 0 }; - let ecef: number[] = geodeticToEcef(position.lat, position.lon, position.alt); + let ecef: number[] = geodeticToEcef(position.lat, position.lng, position.alt); expect(ecef[0]).toBeCloseTo(0, precision); expect(ecef[1]).toBeCloseTo(0, precision); @@ -81,13 +81,13 @@ describe("GeoCoords.geodeticToEcef", () => { }); it("should convert back and forth between WGS84 and ECEF and correspond", () => { - let position: LatLonAlt = { alt: 25.34543543, lat: 12.469889789, lon: -33.34589734 }; + let position: LatLonAlt = { alt: 25.34543543, lat: 12.469889789, lng: -33.34589734 }; - let ecef: number[] = geodeticToEcef(position.lat, position.lon, position.alt); + let ecef: number[] = geodeticToEcef(position.lat, position.lng, position.alt); let rePosition: number[] = ecefToGeodetic(ecef[0], ecef[1], ecef[2]); expect(rePosition[0]).toBeCloseTo(position.lat, precision); - expect(rePosition[1]).toBeCloseTo(position.lon, precision); + expect(rePosition[1]).toBeCloseTo(position.lng, precision); expect(rePosition[2]).toBeCloseTo(position.alt, precision); }); }); @@ -155,10 +155,10 @@ describe("GeoCoords.ecefToGeodetic", () => { describe("GeoCoords.ecefToEnu", () => { it("should convert to ECEF position corresponding to geodetic to ENU at origin", () => { - let ref: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let ref: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let ecef: number[] = [wgs84a, 0, 0]; - let enu: number[] = ecefToEnu(ecef[0], ecef[1], ecef[2], ref.lat, ref.lon, ref.alt); + let enu: number[] = ecefToEnu(ecef[0], ecef[1], ecef[2], ref.lat, ref.lng, ref.alt); expect(enu[0]).toBeCloseTo(0, precision); expect(enu[1]).toBeCloseTo(0, precision); @@ -166,28 +166,28 @@ describe("GeoCoords.ecefToEnu", () => { }); it("should convert positions on Equator to ENU positions at origin", () => { - let ref1: LatLonAlt = { alt: 0, lat: 0, lon: 90 }; + let ref1: LatLonAlt = { alt: 0, lat: 0, lng: 90 }; let ecef1: number[] = [0, wgs84a, 0]; - let enu1: number[] = ecefToEnu(ecef1[0], ecef1[1], ecef1[2], ref1.lat, ref1.lon, ref1.alt); + let enu1: number[] = ecefToEnu(ecef1[0], ecef1[1], ecef1[2], ref1.lat, ref1.lng, ref1.alt); expect(enu1[0]).toBeCloseTo(0, precision); expect(enu1[1]).toBeCloseTo(0, precision); expect(enu1[2]).toBeCloseTo(0, precision); - let ref2: LatLonAlt = { alt: 0, lat: 0, lon: 180 }; + let ref2: LatLonAlt = { alt: 0, lat: 0, lng: 180 }; let ecef2: number[] = [-wgs84a, 0, 0]; - let enu2: number[] = ecefToEnu(ecef2[0], ecef2[1], ecef2[2], ref2.lat, ref2.lon, ref2.alt); + let enu2: number[] = ecefToEnu(ecef2[0], ecef2[1], ecef2[2], ref2.lat, ref2.lng, ref2.alt); expect(enu2[0]).toBeCloseTo(0, precision); expect(enu2[1]).toBeCloseTo(0, precision); expect(enu2[2]).toBeCloseTo(0, precision); - let ref3: LatLonAlt = { alt: 0, lat: 0, lon: -90 }; + let ref3: LatLonAlt = { alt: 0, lat: 0, lng: -90 }; let ecef3: number[] = [0, -wgs84a, 0]; - let enu3: number[] = ecefToEnu(ecef3[0], ecef3[1], ecef3[2], ref3.lat, ref3.lon, ref3.alt); + let enu3: number[] = ecefToEnu(ecef3[0], ecef3[1], ecef3[2], ref3.lat, ref3.lng, ref3.alt); expect(enu3[0]).toBeCloseTo(0, precision); expect(enu3[1]).toBeCloseTo(0, precision); @@ -195,12 +195,12 @@ describe("GeoCoords.ecefToEnu", () => { }); it("should convert ECEF position with altitude to ENU with correct z-value", () => { - let ref: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let ref: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let altitude: number = 5.38973284; let ecef: number[] = [wgs84a + altitude, 0, 0]; - let enu: number[] = ecefToEnu(ecef[0], ecef[1], ecef[2], ref.lat, ref.lon, ref.alt); + let enu: number[] = ecefToEnu(ecef[0], ecef[1], ecef[2], ref.lat, ref.lng, ref.alt); expect(enu[0]).toBeCloseTo(0, precision); expect(enu[1]).toBeCloseTo(0, precision); @@ -208,12 +208,12 @@ describe("GeoCoords.ecefToEnu", () => { }); it("should convert ECEF position with translation to correct ENU position", () => { - let ref: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let ref: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let translation: number = 1.38973284; let ecef: number[] = [wgs84a, translation, translation]; - let enu: number[] = ecefToEnu(ecef[0], ecef[1], ecef[2], ref.lat, ref.lon, ref.alt); + let enu: number[] = ecefToEnu(ecef[0], ecef[1], ecef[2], ref.lat, ref.lng, ref.alt); expect(enu[0]).toBeCloseTo(translation, precision); expect(enu[1]).toBeCloseTo(translation, precision); @@ -223,10 +223,10 @@ describe("GeoCoords.ecefToEnu", () => { describe("GeoCoords.enuToEcef", () => { it("should convert to ENU position at origin to ECEF X-value", () => { - let ref: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let ref: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let enu: number[] = [0, 0, 0]; - let ecef: number[] = enuToEcef(enu[0], enu[1], enu[2], ref.lat, ref.lon, ref.alt); + let ecef: number[] = enuToEcef(enu[0], enu[1], enu[2], ref.lat, ref.lng, ref.alt); expect(ecef[0]).toBeCloseTo(wgs84a, precision); expect(ecef[1]).toBeCloseTo(0, precision); @@ -234,10 +234,10 @@ describe("GeoCoords.enuToEcef", () => { }); it("should convert to ENU position with up value to ECEF X-value", () => { - let ref: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let ref: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let enu: number[] = [0, 0, 7.3823847239847]; - let ecef: number[] = enuToEcef(enu[0], enu[1], enu[2], ref.lat, ref.lon, ref.alt); + let ecef: number[] = enuToEcef(enu[0], enu[1], enu[2], ref.lat, ref.lng, ref.alt); expect(ecef[0]).toBeCloseTo(wgs84a + enu[2], precision); expect(ecef[1]).toBeCloseTo(0, precision); @@ -245,12 +245,12 @@ describe("GeoCoords.enuToEcef", () => { }); it("should convert ECEF position with translation to correct ENU position", () => { - let ref: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let ref: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let translation: number = -2.34875843758493; let enu: number[] = [translation, translation, 0]; - let ecef: number[] = enuToEcef(enu[0], enu[1], enu[2], ref.lat, ref.lon, ref.alt); + let ecef: number[] = enuToEcef(enu[0], enu[1], enu[2], ref.lat, ref.lng, ref.alt); expect(ecef[0]).toBeCloseTo(wgs84a, precision); expect(ecef[1]).toBeCloseTo(translation, precision); @@ -260,10 +260,10 @@ describe("GeoCoords.enuToEcef", () => { describe("GeoCoords.geodeticToEnu", () => { it("should convert to ENU position at origin when lla is at reference", () => { - let ref: LatLonAlt = { alt: 12.523892390, lat: 12.9450823, lon: 133.34589734 }; - let lla: LatLonAlt = { alt: ref.alt, lat: ref.lat, lon: ref.lon }; + let ref: LatLonAlt = { alt: 12.523892390, lat: 12.9450823, lng: 133.34589734 }; + let lla: LatLonAlt = { alt: ref.alt, lat: ref.lat, lng: ref.lng }; - let enu: number[] = geodeticToEnu(lla.lat, lla.lon, lla.alt, ref.lat, ref.lon, ref.alt); + let enu: number[] = geodeticToEnu(lla.lat, lla.lng, lla.alt, ref.lat, ref.lng, ref.alt); expect(enu[0]).toBeCloseTo(0, precision); expect(enu[1]).toBeCloseTo(0, precision); @@ -271,12 +271,12 @@ describe("GeoCoords.geodeticToEnu", () => { }); it("should convert to ENU z value corresponding to diff with reference lla", () => { - let ref: LatLonAlt = { alt: 12.523892390, lat: 12.9450823, lon: 133.34589734 }; + let ref: LatLonAlt = { alt: 12.523892390, lat: 12.9450823, lng: 133.34589734 }; let altTranslation: number = 4.4556433242; - let lla: LatLonAlt = { alt: ref.alt + altTranslation, lat: ref.lat, lon: ref.lon }; + let lla: LatLonAlt = { alt: ref.alt + altTranslation, lat: ref.lat, lng: ref.lng }; - let enu: number[] = geodeticToEnu(lla.lat, lla.lon, lla.alt, ref.lat, ref.lon, ref.alt); + let enu: number[] = geodeticToEnu(lla.lat, lla.lng, lla.alt, ref.lat, ref.lng, ref.alt); expect(enu[0]).toBeCloseTo(0, precision); expect(enu[1]).toBeCloseTo(0, precision); @@ -284,47 +284,47 @@ describe("GeoCoords.geodeticToEnu", () => { }); it("should convert back and forth between WGS84 and ENU and correspond", () => { - let ref: LatLonAlt = { alt: -3.645563324, lat: 13.469889789, lon: 92.376689734 }; - let lla: LatLonAlt = { alt: ref.alt + 20, lat: ref.lat - 0.01, lon: ref.lon + 0.01 }; + let ref: LatLonAlt = { alt: -3.645563324, lat: 13.469889789, lng: 92.376689734 }; + let lla: LatLonAlt = { alt: ref.alt + 20, lat: ref.lat - 0.01, lng: ref.lng + 0.01 }; - let enu: number[] = geodeticToEnu(lla.lat, lla.lon, lla.alt, ref.lat, ref.lon, ref.alt); - let reLla: number[] = enuToGeodetic(enu[0], enu[1], enu[2], ref.lat, ref.lon, ref.alt); + let enu: number[] = geodeticToEnu(lla.lat, lla.lng, lla.alt, ref.lat, ref.lng, ref.alt); + let reLla: number[] = enuToGeodetic(enu[0], enu[1], enu[2], ref.lat, ref.lng, ref.alt); expect(reLla[0]).toBeCloseTo(lla.lat, precision); - expect(reLla[1]).toBeCloseTo(lla.lon, precision); + expect(reLla[1]).toBeCloseTo(lla.lng, precision); expect(reLla[2]).toBeCloseTo(lla.alt, precision); }); }); describe("GeoCoords.enuToGeodetic", () => { it("should convert to reference WGS84 when ENU position is origin", () => { - let ref: LatLonAlt = { alt: 12.523892390, lat: 12.9450823, lon: 133.34589734 }; + let ref: LatLonAlt = { alt: 12.523892390, lat: 12.9450823, lng: 133.34589734 }; let enu: number[] = [0, 0, 0]; - let lla: number[] = enuToGeodetic(enu[0], enu[1], enu[2], ref.lat, ref.lon, ref.alt); + let lla: number[] = enuToGeodetic(enu[0], enu[1], enu[2], ref.lat, ref.lng, ref.alt); expect(lla[0]).toBeCloseTo(ref.lat, precision); - expect(lla[1]).toBeCloseTo(ref.lon, precision); + expect(lla[1]).toBeCloseTo(ref.lng, precision); expect(lla[2]).toBeCloseTo(ref.alt, precision); }); it("should convert to reference WGS84 at correct altitude when ENU position has non zero z value", () => { - let ref: LatLonAlt = { alt: 12.523892390, lat: 12.9450823, lon: 133.34589734 }; + let ref: LatLonAlt = { alt: 12.523892390, lat: 12.9450823, lng: 133.34589734 }; let enu: number[] = [0, 0, 5.234872384927]; - let lla: number[] = enuToGeodetic(enu[0], enu[1], enu[2], ref.lat, ref.lon, ref.alt); + let lla: number[] = enuToGeodetic(enu[0], enu[1], enu[2], ref.lat, ref.lng, ref.alt); expect(lla[0]).toBeCloseTo(ref.lat, precision); - expect(lla[1]).toBeCloseTo(ref.lon, precision); + expect(lla[1]).toBeCloseTo(ref.lng, precision); expect(lla[2]).toBeCloseTo(ref.alt + enu[2], precision); }); it("should convert back and forth between ENU and WGS84 and correspond", () => { - let ref: LatLonAlt = { alt: 7.34543543, lat: -52.469889789, lon: -113.34589734 }; + let ref: LatLonAlt = { alt: 7.34543543, lat: -52.469889789, lng: -113.34589734 }; let enu: number[] = [12.435534543, -55.34242121, 5.98023489]; - let lla: number[] = enuToGeodetic(enu[0], enu[1], enu[2], ref.lat, ref.lon, ref.alt); - let reEnu: number[] = geodeticToEnu(lla[0], lla[1], lla[2], ref.lat, ref.lon, ref.alt); + let lla: number[] = enuToGeodetic(enu[0], enu[1], enu[2], ref.lat, ref.lng, ref.alt); + let reEnu: number[] = geodeticToEnu(lla[0], lla[1], lla[2], ref.lat, ref.lng, ref.alt); expect(reEnu[0]).toBeCloseTo(enu[0], precision); expect(reEnu[1]).toBeCloseTo(enu[1], precision); diff --git a/test/graph/Graph.test.ts b/test/graph/Graph.test.ts index d307f7f1..9b797222 100644 --- a/test/graph/Graph.test.ts +++ b/test/graph/Graph.test.ts @@ -31,6 +31,7 @@ import { SpatialImagesContract } import { SequenceContract } from "../../src/api/contracts/SequenceContract"; import { ImagesContract } from "../../src/api/contracts/ImagesContract"; import { CoreImagesContract } from "../../src/api/contracts/CoreImagesContract"; +import { LngLat } from "../../src/export/APINamespace"; describe("Graph.ctor", () => { it("should create a graph", () => { @@ -80,11 +81,13 @@ describe("Graph.cacheBoundingBox$", () => { const fullNode = helper.createImageEnt(); fullNode.id = id; fullNode.computed_geometry.lat = 0.5; - fullNode.computed_geometry.lon = 0.5; + fullNode.computed_geometry.lng = 0.5; const graph = new Graph(api, undefined, calculator); - graph.cacheBoundingBox$({ lat: 0, lon: 0 }, { lat: 1, lon: 1 }) + graph.cacheBoundingBox$( + { lat: 0, lng: 0 }, + { lat: 1, lng: 1 }) .subscribe( (nodes: Image[]): void => { expect(nodes.length).toBe(1); @@ -123,7 +126,7 @@ describe("Graph.cacheBoundingBox$", () => { const h = "h"; spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const coreImages = new Subject(); @@ -142,7 +145,7 @@ describe("Graph.cacheBoundingBox$", () => { const imageEnt = helper.createImageEnt(); imageEnt.id = id; imageEnt.computed_geometry.lat = 0.5; - imageEnt.computed_geometry.lon = 0.5; + imageEnt.computed_geometry.lng = 0.5; const graph = new Graph(api, undefined, calculator); @@ -174,7 +177,9 @@ describe("Graph.cacheBoundingBox$", () => { expect(getSpatialImagesSpy.calls.count()).toBe(0); expect(getImagesSpy.calls.count()).toBe(1); - graph.cacheBoundingBox$({ lat: 0, lon: 0 }, { lat: 1, lon: 1 }) + graph.cacheBoundingBox$( + { lat: 0, lng: 0 }, + { lat: 1, lng: 1 }) .subscribe( (images: Image[]): void => { expect(images.length).toBe(1); @@ -198,7 +203,7 @@ describe("Graph.cacheBoundingBox$", () => { const h = "h"; spyOn(dataProvider.geometry, "bboxToCellIds").and.returnValue([h]); - spyOn(dataProvider.geometry, "latLonToCellId").and.returnValue(h); + spyOn(dataProvider.geometry, "lngLatToCellId").and.returnValue(h); const coreImages = new Subject(); @@ -212,14 +217,18 @@ describe("Graph.cacheBoundingBox$", () => { const fullNode = helper.createImageEnt(); fullNode.id = id; fullNode.computed_geometry.lat = 0.5; - fullNode.computed_geometry.lon = 0.5; + fullNode.computed_geometry.lng = 0.5; const graph = new Graph(api, undefined, calculator); let count: number = 0; observableMerge( - graph.cacheBoundingBox$({ lat: 0, lon: 0 }, { lat: 1, lon: 1 }), - graph.cacheBoundingBox$({ lat: 0, lon: 0 }, { lat: 1, lon: 1 })) + graph.cacheBoundingBox$( + { lat: 0, lng: 0 }, + { lat: 1, lng: 1 }), + graph.cacheBoundingBox$( + { lat: 0, lng: 0 }, + { lat: 1, lng: 1 })) .subscribe( (nodes: Image[]): void => { expect(nodes.length).toBe(1); @@ -405,7 +414,7 @@ describe("Graph.cacheFull$", () => { }); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const coreImages = @@ -477,7 +486,7 @@ describe("Graph.cacheFill$", () => { spyOn(api, "getImages$").and.returnValue(getImages); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const coreImages = @@ -532,7 +541,7 @@ describe("Graph.cacheFill$", () => { spyOn(api, "getImages$").and.returnValue(getImages); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const coreImages = @@ -595,7 +604,7 @@ describe("Graph.cacheFill$", () => { spyOn(api, "getImages$").and.returnValue(getImages); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const coreImages = @@ -651,7 +660,7 @@ describe("Graph.cacheFill$", () => { spyOn(api, "getImages$").and.returnValue(getImages); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const coreImages = @@ -753,7 +762,7 @@ describe("Graph.cacheTiles$", () => { const fullNode = helper.createImageEnt(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const imageByKeyResult: ImagesContract = [{ @@ -827,7 +836,7 @@ describe("Graph.cacheTiles$", () => { const fullNode = helper.createImageEnt(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const encodeHsSpy = spyOn(geometryProvider, "bboxToCellIds"); encodeHsSpy.and.returnValue([h]); @@ -979,7 +988,7 @@ describe("Graph.cacheSequenceNodes$", () => { geometryProvider); const api = new APIWrapper(dataProvider); const graphCalculator = new GraphCalculator(); - spyOn(geometryProvider, "latLonToCellId").and.returnValue("h"); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue("h"); const edgeCalculator = new EdgeCalculator(); const configuration: GraphConfiguration = { @@ -1033,7 +1042,7 @@ describe("Graph.cacheSequenceNodes$", () => { geometryProvider); const api = new APIWrapper(dataProvider); const graphCalculator = new GraphCalculator(); - spyOn(geometryProvider, "latLonToCellId").and.returnValue("h"); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue("h"); const edgeCalculator = new EdgeCalculator(); const configuration: GraphConfiguration = { @@ -1089,7 +1098,7 @@ describe("Graph.cacheSequenceNodes$", () => { geometryProvider); const api = new APIWrapper(dataProvider); const graphCalculator = new GraphCalculator(); - spyOn(geometryProvider, "latLonToCellId").and.returnValue("h"); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue("h"); const edgeCalculator = new EdgeCalculator(); const configuration: GraphConfiguration = { @@ -1143,7 +1152,7 @@ describe("Graph.cacheSequenceNodes$", () => { geometryProvider); const api = new APIWrapper(dataProvider); const graphCalculator = new GraphCalculator(); - spyOn(geometryProvider, "latLonToCellId").and.returnValue("h"); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue("h"); const edgeCalculator = new EdgeCalculator(); const configuration: GraphConfiguration = { @@ -1198,7 +1207,7 @@ describe("Graph.cacheSequenceNodes$", () => { const api = new APIWrapper(dataProvider); const graphCalculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const edgeCalculator = new EdgeCalculator(); @@ -1280,7 +1289,7 @@ describe("Graph.cacheSequenceNodes$", () => { const api = new APIWrapper(dataProvider); const graphCalculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const edgeCalculator = new EdgeCalculator(); @@ -1810,7 +1819,11 @@ describe("Graph.cacheSpatialArea$", () => { const node = graph.getNode(fullNode.id); - spyOn(graphCalculator, "boundingBoxCorners").and.returnValue([{ lat: 0, lon: 0 }, { lat: 0, lon: 0 }]); + spyOn(graphCalculator, "boundingBoxCorners") + .and.returnValue([ + { lat: 0, lng: 0 }, + { lat: 0, lng: 0 }, + ]); expect(graph.hasSpatialArea(fullNode.id)).toBe(true); }); @@ -1824,7 +1837,7 @@ describe("Graph.cacheSpatialArea$", () => { const fullNode = helper.createImageEnt(); const h = "h"; - spyOn(dataProvider.geometry, "latLonToCellId").and.returnValue(h); + spyOn(dataProvider.geometry, "lngLatToCellId").and.returnValue(h); spyOn(dataProvider.geometry, "bboxToCellIds").and.returnValue([h]); const getImages = new Subject(); @@ -1847,14 +1860,19 @@ describe("Graph.cacheSpatialArea$", () => { expect(node).toBeDefined(); spyOn(graphCalculator, "boundingBoxCorners") - .and.returnValue([{ lat: -0.5, lon: -0.5 }, { lat: 0.5, lon: 0.5 }]); + .and.returnValue([ + { lat: -0.5, lng: -0.5 }, + { lat: 0.5, lng: 0.5 }, + ]); const coreNode: CoreImageEnt = helper.createCoreImageEnt(); coreNode.id = "otherKey"; graph.hasTiles(fullNode.id); - observableFrom(graph.cacheTiles$(fullNode.id)).pipe( - mergeAll()) + observableFrom(graph + .cacheTiles$(fullNode.id)) + .pipe( + mergeAll()) .subscribe(() => { /*noop*/ }); const result: CoreImagesContract = { @@ -1911,7 +1929,11 @@ describe("Graph.cacheSpatialEdges", () => { const node = graph.getNode(fullNode.id); - spyOn(graphCalculator, "boundingBoxCorners").and.returnValue([{ lat: 0, lon: 0 }, { lat: 0, lon: 0 }]); + spyOn(graphCalculator, "boundingBoxCorners") + .and.returnValue([ + { lat: 0, lng: 0 }, + { lat: 0, lng: 0 }, + ]); expect(graph.hasSpatialArea(fullNode.id)).toBe(true); @@ -1937,7 +1959,7 @@ describe("Graph.cacheSpatialEdges", () => { test("should apply filter", () => { const cellId = "cell-id"; const dataProvider = new DataProvider(); - spyOn(dataProvider.geometry, "latLonToCellId") + spyOn(dataProvider.geometry, "lngLatToCellId") .and.returnValue(cellId); spyOn(dataProvider.geometry, "bboxToCellIds") .and.returnValue([cellId]); @@ -2006,7 +2028,11 @@ describe("Graph.cacheSpatialEdges", () => { expect(graph.hasTiles(fullNode.id)).toBe(true); - spyOn(graphCalculator, "boundingBoxCorners").and.returnValue([{ lat: -0.5, lon: -0.5 }, { lat: 0.5, lon: 0.5 }]); + spyOn(graphCalculator, "boundingBoxCorners") + .and.returnValue([ + { lat: -0.5, lng: -0.5 }, + { lat: 0.5, lng: 0.5 }, + ]); graph.cacheFill$(otherFullNode.id).subscribe(() => { /*noop*/ }); @@ -2072,7 +2098,11 @@ describe("Graph.cacheSpatialEdges", () => { const node = graph.getNode(fullNode.id); - spyOn(graphCalculator, "boundingBoxCorners").and.returnValue([{ lat: 0, lon: 0 }, { lat: 0, lon: 0 }]); + spyOn(graphCalculator, "boundingBoxCorners") + .and.returnValue([ + { lat: 0, lng: 0 }, + { lat: 0, lng: 0 }, + ]); const otherFullNode = helper.createImageEnt(); otherFullNode.sequence.id = "otherSequenceKey"; @@ -2459,7 +2489,11 @@ describe("Graph.resetSpatialEdges", () => { const node = graph.getNode(fullNode.id); - spyOn(graphCalculator, "boundingBoxCorners").and.returnValue([{ lat: 0, lon: 0 }, { lat: 0, lon: 0 }]); + spyOn(graphCalculator, "boundingBoxCorners") + .and.returnValue([ + { lat: 0, lng: 0 }, + { lat: 0, lng: 0 }, + ]); expect(graph.hasSpatialArea(fullNode.id)).toBe(true); @@ -2496,7 +2530,7 @@ describe("Graph.resetSpatialEdges", () => { const edgeCalculator = new EdgeCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const encodeHsSpy = spyOn(geometryProvider, "bboxToCellIds"); encodeHsSpy.and.returnValue([h]); @@ -2549,7 +2583,11 @@ describe("Graph.resetSpatialEdges", () => { const node = graph.getNode(fullNode.id); - spyOn(graphCalculator, "boundingBoxCorners").and.returnValue([{ lat: 0, lon: 0 }, { lat: 0, lon: 0 }]); + spyOn(graphCalculator, "boundingBoxCorners") + .and.returnValue([ + { lat: 0, lng: 0 }, + { lat: 0, lng: 0 }, + ]); expect(graph.hasSpatialArea(fullNode.id)).toBe(true); @@ -2598,7 +2636,7 @@ describe("Graph.reset", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const getImages = new Subject(); spyOn(api, "getImages$").and.returnValue(getImages); @@ -2637,7 +2675,7 @@ describe("Graph.reset", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const getImages = new Subject(); spyOn(api, "getImages$").and.returnValue(getImages); @@ -2677,7 +2715,7 @@ describe("Graph.reset", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const getImages = new Subject(); spyOn(api, "getImages$").and.returnValue(getImages); @@ -2731,7 +2769,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const getImages = new Subject(); spyOn(api, "getImages$").and.returnValue(getImages); @@ -2778,7 +2816,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const getImages = new Subject(); spyOn(api, "getImages$").and.returnValue(getImages); @@ -2826,7 +2864,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const getImages = new Subject(); spyOn(api, "getImages$").and.returnValue(getImages); @@ -2873,7 +2911,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const getImages = new Subject(); spyOn(api, "getImages$").and.returnValue(getImages); @@ -2922,7 +2960,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const getImages = new Subject(); spyOn(api, "getImages$").and.returnValue(getImages); @@ -2971,7 +3009,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); const getImagesSpy = spyOn(api, "getImages$"); @@ -3054,7 +3092,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const getImages = new Subject(); @@ -3120,7 +3158,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const getImages = new Subject(); @@ -3188,7 +3226,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const getImages = new Subject(); @@ -3255,7 +3293,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const getImages = new Subject(); @@ -3317,7 +3355,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const getImagesSpy = spyOn(api, "getImages$"); @@ -3603,7 +3641,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const getImages = new Subject(); @@ -3668,7 +3706,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const getImages = new Subject(); @@ -3735,7 +3773,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const getImages = new Subject(); @@ -3801,7 +3839,7 @@ describe("Graph.uncache", () => { const calculator = new GraphCalculator(); const h = "h"; - spyOn(geometryProvider, "latLonToCellId").and.returnValue(h); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(h); spyOn(geometryProvider, "bboxToCellIds").and.returnValue([h]); const getImages = new Subject(); @@ -3924,7 +3962,7 @@ describe("Graph.cacheCell$", () => { const cellId = "cell-id"; spyOn(geometryProvider, "bboxToCellIds").and.returnValue([cellId]); - spyOn(geometryProvider, "latLonToCellId").and.returnValue(cellId); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(cellId); const coreImages = new Subject(); @@ -3997,7 +4035,7 @@ describe("Graph.cacheCell$", () => { const cellId = "cell-id"; spyOn(geometryProvider, "bboxToCellIds").and.returnValue([cellId]); - spyOn(geometryProvider, "latLonToCellId").and.returnValue(cellId); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(cellId); const coreImages = new Subject(); @@ -4090,7 +4128,7 @@ describe("Graph.cacheCell$", () => { const cellId = "cell-id"; spyOn(geometryProvider, "bboxToCellIds").and.returnValue([cellId]); - spyOn(geometryProvider, "latLonToCellId").and.returnValue(cellId); + spyOn(geometryProvider, "lngLatToCellId").and.returnValue(cellId); const coreImages = new Subject(); diff --git a/test/graph/GraphCalculator.test.ts b/test/graph/GraphCalculator.test.ts index 85df592f..1e4f208c 100644 --- a/test/graph/GraphCalculator.test.ts +++ b/test/graph/GraphCalculator.test.ts @@ -1,4 +1,4 @@ -import { LatLon } from "../../src/api/interfaces/LatLon"; +import { LngLat } from "../../src/api/interfaces/LngLat"; import * as GeoCoords from "../../src/geo/GeoCoords"; import { GraphCalculator } from "../../src/graph/GraphCalculator"; @@ -13,19 +13,19 @@ describe("GraphCalculator.ctor", () => { describe("GraphCalculator.boundingBoxCorners", () => { it("should return sw and ne in correct order", () => { spyOn(GeoCoords, "enuToGeodetic").and.callFake( - (x: number, y: number, z: number, refLat: number, refLon: number, refAlt: number): number[] => { - return [refLat + x, refLon + y, refAlt + z]; + (x: number, y: number, z: number, refLat: number, refLng: number, refAlt: number): number[] => { + return [refLat + x, refLng + y, refAlt + z]; }); let calculator: GraphCalculator = new GraphCalculator(); let threshold: number = 1; - let bbox: [LatLon, LatLon] = calculator.boundingBoxCorners({ lat: 0, lon: 0 }, threshold); + let bbox: [LngLat, LngLat] = calculator.boundingBoxCorners({ lat: 0, lng: 0 }, threshold); expect(bbox.length).toBe(2); expect(bbox[0].lat).toBe(-1); - expect(bbox[0].lon).toBe(-1); + expect(bbox[0].lng).toBe(-1); expect(bbox[1].lat).toBe(1); - expect(bbox[1].lon).toBe(1); + expect(bbox[1].lng).toBe(1); }); }); diff --git a/test/graph/GraphService.test.ts b/test/graph/GraphService.test.ts index dc7dc158..f027380b 100644 --- a/test/graph/GraphService.test.ts +++ b/test/graph/GraphService.test.ts @@ -24,6 +24,7 @@ import { GraphService } from "../../src/graph/GraphService"; import { NavigationEdgeStatus } from "../../src/graph/interfaces/NavigationEdgeStatus"; import { Sequence } from "../../src/graph/Sequence"; import { DataProvider } from "../helper/ProviderHelper"; +import { LngLat } from "../../src/export/APINamespace"; describe("GraphService.ctor", () => { it("should create a graph service", () => { @@ -46,14 +47,17 @@ describe("GraphService.cacheBoundingBox$", () => { const graphService: GraphService = new GraphService(graph); - graphService.cacheBoundingBox$({ lat: 0, lon: 1 }, { lat: 2, lon: 3 }) + const sw: LngLat = { lat: 0, lng: 1 }; + const ne: LngLat = { lat: 2, lng: 3 }; + + graphService.cacheBoundingBox$(sw, ne) .subscribe( (): void => { expect(cacheBoundingBoxSpy.calls.count()).toBe(1); expect(cacheBoundingBoxSpy.calls.argsFor(0)[0].lat).toBe(0); - expect(cacheBoundingBoxSpy.calls.argsFor(0)[0].lon).toBe(1); + expect(cacheBoundingBoxSpy.calls.argsFor(0)[0].lng).toBe(1); expect(cacheBoundingBoxSpy.calls.argsFor(0)[1].lat).toBe(2); - expect(cacheBoundingBoxSpy.calls.argsFor(0)[1].lon).toBe(3); + expect(cacheBoundingBoxSpy.calls.argsFor(0)[1].lng).toBe(3); done(); }); diff --git a/test/graph/edge/EdgeCalculator.Pano.test.ts b/test/graph/edge/EdgeCalculator.Pano.test.ts index b4149233..a1a8ed47 100644 --- a/test/graph/edge/EdgeCalculator.Pano.test.ts +++ b/test/graph/edge/EdgeCalculator.Pano.test.ts @@ -40,7 +40,7 @@ describe("EdgeCalculator.computeSphericalEdges", () => { }); it("should throw when image is not full", () => { - image = helper.createCoreImage("", { alt: 0, lat: 0, lon: 0 }, ""); + image = helper.createCoreImage("", { alt: 0, lat: 0, lng: 0 }, ""); expect(() => { edgeCalculator.computeSphericalEdges(image, []); }).toThrowError(Error); }); diff --git a/test/graph/edge/EdgeCalculator.Sequence.test.ts b/test/graph/edge/EdgeCalculator.Sequence.test.ts index c2bc3f22..d3e3b838 100644 --- a/test/graph/edge/EdgeCalculator.Sequence.test.ts +++ b/test/graph/edge/EdgeCalculator.Sequence.test.ts @@ -27,7 +27,7 @@ describe("EdgeCalculator.computeSequenceEdges", () => { let key: string = "key"; let sequenceKey: string = "skey"; - let image: Image = helper.createCoreImage(key, { alt: 0, lat: 0, lon: 0 }, sequenceKey); + let image: Image = helper.createCoreImage(key, { alt: 0, lat: 0, lng: 0 }, sequenceKey); let sequence: Sequence = new Sequence({ id: sequenceKey, image_ids: [key] }); expect(() => { edgeCalculator.computeSequenceEdges(image, sequence); }).toThrowError(Error); @@ -38,7 +38,7 @@ describe("EdgeCalculator.computeSequenceEdges", () => { let sequenceKey1: string = "skey1"; let sequenceKey2: string = "skey2"; - let image: Image = helper.createCoreImage(key, { alt: 0, lat: 0, lon: 0 }, sequenceKey1); + let image: Image = helper.createCoreImage(key, { alt: 0, lat: 0, lng: 0 }, sequenceKey1); let sequence: Sequence = new Sequence({ id: sequenceKey2, image_ids: [key] }); expect(() => { edgeCalculator.computeSequenceEdges(image, sequence); }).toThrowError(Error); @@ -49,7 +49,7 @@ describe("EdgeCalculator.computeSequenceEdges", () => { let nextKey: string = "nextKey"; let sequenceKey: string = "skey"; - let image: Image = helper.createSpatialImageEn(key, { alt: 0, lat: 0, lon: 0 }, sequenceKey, [0, 0, 0]); + let image: Image = helper.createSpatialImageEn(key, { alt: 0, lat: 0, lng: 0 }, sequenceKey, [0, 0, 0]); let sequence: Sequence = new Sequence({ id: sequenceKey, image_ids: [key, nextKey] }); let sequenceEdges: NavigationEdge[] = edgeCalculator.computeSequenceEdges(image, sequence); @@ -67,7 +67,7 @@ describe("EdgeCalculator.computeSequenceEdges", () => { let prevKey: string = "prevKey"; let sequenceKey: string = "skey"; - let image: Image = helper.createSpatialImageEn(key, { alt: 0, lat: 0, lon: 0 }, sequenceKey, [0, 0, 0]); + let image: Image = helper.createSpatialImageEn(key, { alt: 0, lat: 0, lng: 0 }, sequenceKey, [0, 0, 0]); let sequence: Sequence = new Sequence({ id: sequenceKey, image_ids: [prevKey, key] }); let sequenceEdges: NavigationEdge[] = edgeCalculator.computeSequenceEdges(image, sequence); @@ -87,7 +87,7 @@ describe("EdgeCalculator.computeSequenceEdges", () => { let sequenceKey: string = "skey"; - let image: Image = helper.createSpatialImageEn(key, { alt: 0, lat: 0, lon: 0 }, sequenceKey, [0, 0, 0]); + let image: Image = helper.createSpatialImageEn(key, { alt: 0, lat: 0, lng: 0 }, sequenceKey, [0, 0, 0]); let sequence: Sequence = new Sequence({ id: sequenceKey, image_ids: [prevKey, key, nextKey] }); let sequenceEdges: NavigationEdge[] = edgeCalculator.computeSequenceEdges(image, sequence); diff --git a/test/graph/edge/EdgeCalculator.Similar.test.ts b/test/graph/edge/EdgeCalculator.Similar.test.ts index 6f672526..ffcac23f 100644 --- a/test/graph/edge/EdgeCalculator.Similar.test.ts +++ b/test/graph/edge/EdgeCalculator.Similar.test.ts @@ -29,7 +29,7 @@ describe("EdgeCalculator.computeSimilarEdges", () => { let createImage: (capturedAt: number) => Image = (capturedAt: number): Image => { - return helper.createSpatialImageEn("key", { alt: 0, lat: 0, lon: 0 }, "skey", [0, 0, 0], 2, "perspective", capturedAt); + return helper.createSpatialImageEn("key", { alt: 0, lat: 0, lng: 0 }, "skey", [0, 0, 0], 2, "perspective", capturedAt); }; beforeEach(() => { @@ -41,7 +41,7 @@ describe("EdgeCalculator.computeSimilarEdges", () => { }); it("should throw when image is not full", () => { - image = helper.createCoreImage("", { alt: 0, lat: 0, lon: 0 }, ""); + image = helper.createCoreImage("", { alt: 0, lat: 0, lng: 0 }, ""); expect(() => { edgeCalculator.computeSimilarEdges(image, []); }).toThrowError(Error); }); diff --git a/test/graph/edge/EdgeCalculator.Step.test.ts b/test/graph/edge/EdgeCalculator.Step.test.ts index fcce5ccc..658f89b7 100644 --- a/test/graph/edge/EdgeCalculator.Step.test.ts +++ b/test/graph/edge/EdgeCalculator.Step.test.ts @@ -37,7 +37,7 @@ describe("EdgeCalculator.computeStepEdges", () => { }); it("should throw when image is not full", () => { - image = helper.createCoreImage("", { alt: 0, lat: 0, lon: 0 }, ""); + image = helper.createCoreImage("", { alt: 0, lat: 0, lng: 0 }, ""); expect(() => { edgeCalculator.computeStepEdges(image, [], null, null); }).toThrowError(Error); }); diff --git a/test/graph/edge/EdgeCalculator.Turn.test.ts b/test/graph/edge/EdgeCalculator.Turn.test.ts index 63ac29cb..4aec1e17 100644 --- a/test/graph/edge/EdgeCalculator.Turn.test.ts +++ b/test/graph/edge/EdgeCalculator.Turn.test.ts @@ -33,7 +33,7 @@ describe("EdgeCalculator.computeTurnEdges", () => { }); it("should throw when image is not full", () => { - image = helper.createCoreImage("", { alt: 0, lat: 0, lon: 0 }, ""); + image = helper.createCoreImage("", { alt: 0, lat: 0, lng: 0 }, ""); expect(() => { edgeCalculator.computeTurnEdges(image, []); }).toThrowError(Error); }); diff --git a/test/graph/edge/EdgeCalculator.test.ts b/test/graph/edge/EdgeCalculator.test.ts index 9f7e2ed0..6a3b76fb 100644 --- a/test/graph/edge/EdgeCalculator.test.ts +++ b/test/graph/edge/EdgeCalculator.test.ts @@ -30,7 +30,7 @@ describe("EdgeCalculator.getPotentialEdges", () => { }); it("should throw when image is not full", () => { - let image: Image = helper.createCoreImage("", { alt: 0, lat: 0, lon: 0 }, ""); + let image: Image = helper.createCoreImage("", { alt: 0, lat: 0, lng: 0 }, ""); expect(() => { edgeCalculator.getPotentialEdges(image, null, []); }).toThrowError(Error); }); @@ -40,12 +40,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, [0, -Math.PI / 2, 0], 2, "perspective", 0, 0); let enu: number[] = [10, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, [0, -Math.PI / 2, 0]); let potentialEdges: PotentialEdge[] = @@ -59,12 +59,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, [0, -Math.PI / 2, 0]); let enu: number[] = [10, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, [0, -Math.PI / 2, 0]); let potentialEdges: PotentialEdge[] = @@ -91,12 +91,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let sequenceKey: string = "skey"; let edgeKey: string = "edgeKey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, [0, -Math.PI / 2, 0]); let enu: number[] = [10, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, null, [0, -Math.PI / 2, 0]); let potentialEdges: PotentialEdge[] = @@ -110,12 +110,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, [0, -Math.PI / 2, 0]); let enu: number[] = [3, -4, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, [0, -Math.PI / 2, 0]); let potentialEdges: PotentialEdge[] = @@ -134,12 +134,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, [0, -Math.PI / 2, 0]); let enu: number[] = [5, 5, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, [0, -Math.PI / 2, 0]); let potentialEdges: PotentialEdge[] = @@ -158,12 +158,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, [Math.PI / 2, 0, 0]); let enu: number[] = [5, 5, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, [Math.PI / 2, 0, 0]); let potentialEdges: PotentialEdge[] = @@ -182,12 +182,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, [Math.PI / 2, 0, 0]); let enu: number[] = [0, -10, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, [Math.PI / 2, 0, 0]); let potentialEdges: PotentialEdge[] = @@ -206,12 +206,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, [Math.PI / 2, 0, 0]); let enu: number[] = [3, 4, 5]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, [Math.PI / 2, 0, 0]); let potentialEdges: PotentialEdge[] = @@ -230,12 +230,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, [Math.PI / 2, 0, 0]); let enu: number[] = [-3, 4, -5]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, [Math.PI / 2, 0, 0]); let potentialEdges: PotentialEdge[] = @@ -254,12 +254,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(0)); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, createRotationVector(Math.PI / 2)); let potentialEdges: PotentialEdge[] = @@ -278,12 +278,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(0)); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, createRotationVector(-Math.PI / 2)); let potentialEdges: PotentialEdge[] = @@ -302,12 +302,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(Math.PI / 4)); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, createRotationVector(-3 * Math.PI / 4)); let potentialEdges: PotentialEdge[] = @@ -326,12 +326,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(Math.PI / 4)); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, createRotationVector(Math.PI / 4, Math.PI / 4)); let potentialEdges: PotentialEdge[] = @@ -350,15 +350,15 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(Math.PI / 4, 5 * Math.PI / 12)); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], - lon: geodetic[1], + lng: geodetic[1], }; let edgeImage = helper.createSpatialImageEn( @@ -383,12 +383,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(Math.PI / 2, Math.PI / 6)); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage = helper.createSpatialImageEn( edgeKey, @@ -417,12 +417,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let theta: number = spatial.relativeRotationAngle(r1, r2); - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, r1); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, r2); let potentialEdges: PotentialEdge[] = @@ -444,12 +444,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let r1: number[] = [0, 0, 0]; let r2: number[] = [0, 0, 0]; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, r1); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, r2); let potentialEdges: PotentialEdge[] = @@ -471,12 +471,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let r1: number[] = [0, 0, 0]; let r2: number[] = [0, 0, 0]; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, r1); let enu: number[] = [0, 1, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, r2); let potentialEdges: PotentialEdge[] = @@ -498,12 +498,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let r1: number[] = [0, 0, 0]; let r2: number[] = [0, 0, 0]; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, r1); let enu: number[] = [-1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, r2); let potentialEdges: PotentialEdge[] = @@ -525,12 +525,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let r1: number[] = [0, 0, 0]; let r2: number[] = [0, 0, 0]; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, r1); let enu: number[] = [0, -1, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, r2); let potentialEdges: PotentialEdge[] = @@ -552,12 +552,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let r1: number[] = [0, 0, 0]; let r2: number[] = [0, 0, 0]; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, r1); let enu: number[] = [1, 1, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, r2); let potentialEdges: PotentialEdge[] = @@ -576,12 +576,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(0)); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, createRotationVector(0)); let potentialEdges: PotentialEdge[] = @@ -601,12 +601,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let sequenceKey: string = "skey"; let edgeSequenceKey: string = "edgeSkey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(0)); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, edgeSequenceKey, createRotationVector(0)); let potentialEdges: PotentialEdge[] = @@ -627,12 +627,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let mergeCC: number = 45; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(0), mergeCC); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, createRotationVector(0), mergeCC); let potentialEdges: PotentialEdge[] = @@ -654,12 +654,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let mergeCC1: number = 45; let mergeCC2: number = 22; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(0), mergeCC1); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, createRotationVector(0), mergeCC2); let potentialEdges: PotentialEdge[] = @@ -678,12 +678,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(0), null); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, createRotationVector(0), null); let potentialEdges: PotentialEdge[] = @@ -702,12 +702,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(0), 467); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, createRotationVector(0), null); let potentialEdges: PotentialEdge[] = @@ -726,12 +726,12 @@ describe("EdgeCalculator.getPotentialEdges", () => { let edgeKey: string = "edgeKey"; let sequenceKey: string = "skey"; - let lla: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let lla: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let image: Image = helper.createSpatialImageEn(key, lla, sequenceKey, createRotationVector(0), 467); let enu: number[] = [1, 0, 0]; - let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lon, lla.alt); - let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lon: geodetic[1] }; + let geodetic: number[] = GeoCoords.enuToGeodetic(enu[0], enu[1], enu[2], lla.lat, lla.lng, lla.alt); + let edgeLla: LatLonAlt = { alt: geodetic[2], lat: geodetic[0], lng: geodetic[1] }; let edgeImage: Image = helper.createSpatialImageEn(edgeKey, edgeLla, sequenceKey, createRotationVector(0), 435, "spherical"); let potentialEdges: PotentialEdge[] = diff --git a/test/helper/EdgeCalculatorHelper.ts b/test/helper/EdgeCalculatorHelper.ts index 3da81307..5546c020 100644 --- a/test/helper/EdgeCalculatorHelper.ts +++ b/test/helper/EdgeCalculatorHelper.ts @@ -31,9 +31,9 @@ export class EdgeCalculatorHelper { sequenceKey: string): Image { let coreImage: CoreImageEnt = { - computed_geometry: { lat: latLonAlt.lat, lon: latLonAlt.lon }, + computed_geometry: { lat: latLonAlt.lat, lng: latLonAlt.lng }, id: key, - geometry: { lat: latLonAlt.lat, lon: latLonAlt.lon }, + geometry: { lat: latLonAlt.lat, lng: latLonAlt.lng }, sequence: { id: sequenceKey }, }; @@ -42,7 +42,7 @@ export class EdgeCalculatorHelper { public createSpatialImageEn( key: string = "key", - latLonAlt: LatLonAlt = { alt: 0, lat: 0, lon: 0 }, + latLonAlt: LatLonAlt = { alt: 0, lat: 0, lng: 0 }, sequenceKey: string = "skey", r: number[] = [0, 0, 0], mergeCC: number = 2, @@ -87,7 +87,7 @@ export class EdgeCalculatorHelper { public createDefaultImage(spherical: boolean = false): Image { let key: string = "key"; let sequenceKey: string = "skey"; - let latLonAlt: LatLonAlt = { alt: 0, lat: 0, lon: 0 }; + let latLonAlt: LatLonAlt = { alt: 0, lat: 0, lng: 0 }; let cameraType: CameraType = spherical ? "spherical" : diff --git a/test/helper/FrameHelper.ts b/test/helper/FrameHelper.ts index 0bf2d59d..8ab3a2bd 100644 --- a/test/helper/FrameHelper.ts +++ b/test/helper/FrameHelper.ts @@ -33,7 +33,7 @@ export class FrameHelper { imagesAhead: 0, previousImage: undefined, previousTransform: undefined, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, state: State.Traversing, trajectory: [currentImage], zoom: 0, diff --git a/test/helper/ImageHelper.ts b/test/helper/ImageHelper.ts index 77f45547..a31ab48a 100644 --- a/test/helper/ImageHelper.ts +++ b/test/helper/ImageHelper.ts @@ -13,9 +13,9 @@ export class ImageHelper { public createCoreImageEnt(): CoreImageEnt { return { - computed_geometry: { lat: 0, lon: 0 }, + computed_geometry: { lat: 0, lng: 0 }, id: this._imageId, - geometry: { lat: 0, lon: 0 }, + geometry: { lat: 0, lng: 0 }, sequence: { id: this._sequenceId }, }; } @@ -60,14 +60,14 @@ export class ImageHelper { camera_type: "perspective", captured_at: 0, computed_compass_angle: 0, - computed_geometry: { lat: 0, lon: 0 }, + computed_geometry: { lat: 0, lng: 0 }, cluster: { id: this._clusterId, url: this._clusterId + "_url", }, creator: { id: this._creatorId, username: this._creatorUsername }, exif_orientation: 0, - geometry: { lat: 0, lon: 0 }, + geometry: { lat: 0, lng: 0 }, height: 1, id: this._imageId, merge_cc: 1, diff --git a/test/state/StateBase.test.ts b/test/state/StateBase.test.ts index f3e20e3b..8a8ec20d 100644 --- a/test/state/StateBase.test.ts +++ b/test/state/StateBase.test.ts @@ -52,7 +52,7 @@ let createState: () => IStateBase = (): IStateBase => { alpha: 1, camera: new Camera(), currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, diff --git a/test/state/TraversingState.test.ts b/test/state/TraversingState.test.ts index 22c2a1da..b39ea6c3 100644 --- a/test/state/TraversingState.test.ts +++ b/test/state/TraversingState.test.ts @@ -21,7 +21,7 @@ describe("TraversingState.ctor", () => { alpha: 1, camera: new Camera(), currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, @@ -46,9 +46,9 @@ class TestTraversingState extends TraversingState { class TestImage extends Image { constructor() { super({ - computed_geometry: { lat: 0, lon: 0 }, + computed_geometry: { lat: 0, lng: 0 }, id: "key", - geometry: { lat: 0, lon: 0 }, + geometry: { lat: 0, lng: 0 }, sequence: { id: "skey" }, }); } @@ -80,7 +80,7 @@ describe("TraversingState.currentCamera.lookat", () => { alpha: 1, camera: camera, currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, @@ -112,7 +112,7 @@ describe("TraversingState.currentCamera.lookat", () => { alpha: 1, camera: camera, currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, @@ -150,7 +150,7 @@ describe("TraversingState.currentCamera.lookat", () => { alpha: 1, camera: camera, currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, @@ -202,7 +202,7 @@ describe("TraversingState.previousCamera.lookat", () => { alpha: 1, camera: camera, currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, @@ -234,7 +234,7 @@ describe("TraversingState.previousCamera.lookat", () => { alpha: 1, camera: camera, currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, diff --git a/test/state/WaitingState.test.ts b/test/state/WaitingState.test.ts index 5e8dc83c..311244df 100644 --- a/test/state/WaitingState.test.ts +++ b/test/state/WaitingState.test.ts @@ -18,7 +18,7 @@ describe("WaitingState.ctor", () => { alpha: 1, camera: new Camera(), currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, @@ -43,9 +43,9 @@ class TestWaitingState extends WaitingState { class TestImage extends Image { constructor() { super({ - computed_geometry: { lat: 0, lon: 0 }, + computed_geometry: { lat: 0, lng: 0 }, id: "key", - geometry: { lat: 0, lon: 0 }, + geometry: { lat: 0, lng: 0 }, sequence: { id: "skey" }, }); } @@ -77,7 +77,7 @@ describe("WaitingState.currentCamera.lookat", () => { alpha: 1, camera: camera, currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, @@ -109,7 +109,7 @@ describe("WaitingState.currentCamera.lookat", () => { alpha: 1, camera: camera, currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, @@ -147,7 +147,7 @@ describe("WaitingState.currentCamera.lookat", () => { alpha: 1, camera: camera, currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, @@ -203,7 +203,7 @@ describe("WaitingState.previousCamera.lookat", () => { alpha: 1, camera: camera, currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, @@ -235,7 +235,7 @@ describe("WaitingState.previousCamera.lookat", () => { alpha: 1, camera: camera, currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, @@ -271,7 +271,7 @@ describe("WaitingState.previousCamera.lookat", () => { alpha: 1, camera: camera, currentIndex: -1, - reference: { alt: 0, lat: 0, lon: 0 }, + reference: { alt: 0, lat: 0, lng: 0 }, trajectory: [], transitionMode: TransitionMode.Default, zoom: 0, diff --git a/test/viewer/CustomRenderer.test.ts b/test/viewer/CustomRenderer.test.ts index b55678f7..6734a7ae 100644 --- a/test/viewer/CustomRenderer.test.ts +++ b/test/viewer/CustomRenderer.test.ts @@ -76,7 +76,7 @@ describe("CustomRenderer.add", () => { navigator); const viewer = {}; - const referenceMock = { alt: 1, lat: 2, lon: 2 }; + const referenceMock: LatLonAlt = { alt: 1, lat: 2, lng: 2 }; const rendererId = "id"; customRenderer.add( @@ -117,7 +117,7 @@ describe("CustomRenderer.add", () => { navigator); const viewer = {}; - const referenceMock = { alt: 1, lat: 2, lon: 2 }; + const referenceMock: LatLonAlt = { alt: 1, lat: 2, lng: 2 }; const rendererId = "id"; let invokeCount = 0; @@ -155,7 +155,7 @@ describe("CustomRenderer.add", () => { navigator); const viewer = {}; - const referenceMock = { alt: 1, lat: 2, lon: 2 }; + const referenceMock: LatLonAlt = { alt: 1, lat: 2, lng: 2 }; const rendererId = "id"; let invokeCount = 0; @@ -196,7 +196,7 @@ describe("CustomRenderer.add", () => { navigator); const viewer = {}; - const referenceMock = { alt: 1, lat: 2, lon: 2 }; + const referenceMock: LatLonAlt = { alt: 1, lat: 2, lng: 2 }; const rendererId = "id"; customRenderer.add( diff --git a/test/viewer/Navigator.test.ts b/test/viewer/Navigator.test.ts index f9132eed..aa859754 100644 --- a/test/viewer/Navigator.test.ts +++ b/test/viewer/Navigator.test.ts @@ -123,9 +123,9 @@ describe("Navigator.moveToKey$", () => { const sequenceKey: string = "sequenceId"; spyOn(graphService, "cacheImage$").and.returnValue(observableOf( new Image({ - computed_geometry: { lat: 0, lon: 0 }, + computed_geometry: { lat: 0, lng: 0 }, id: key, - geometry: { lat: 0, lon: 0 }, + geometry: { lat: 0, lng: 0 }, sequence: { id: sequenceKey }, }))); @@ -230,9 +230,9 @@ describe("Navigator.moveToKey$", () => { const key: string = "key"; const sequenceKey: string = "sequenceId"; const image: Image = new Image({ - computed_geometry: { lat: 0, lon: 0 }, + computed_geometry: { lat: 0, lng: 0 }, id: key, - geometry: { lat: 0, lon: 0 }, + geometry: { lat: 0, lng: 0 }, sequence: { id: sequenceKey }, }); @@ -269,9 +269,9 @@ describe("Navigator.moveToKey$", () => { const sequenceKey: string = "sequenceId"; const cacheImageSubject$: Subject = new Subject(); const image: Image = new Image({ - computed_geometry: { lat: 0, lon: 0 }, + computed_geometry: { lat: 0, lng: 0 }, id: key, - geometry: { lat: 0, lon: 0 }, + geometry: { lat: 0, lng: 0 }, sequence: { id: sequenceKey }, }); @@ -312,9 +312,9 @@ describe("Navigator.moveToKey$", () => { const sequenceKey: string = "sequenceId"; const cacheImageSubject$: Subject = new Subject(); const image: Image = new Image({ - computed_geometry: { lat: 0, lon: 0 }, + computed_geometry: { lat: 0, lng: 0 }, id: key, - geometry: { lat: 0, lon: 0 }, + geometry: { lat: 0, lng: 0 }, sequence: { id: sequenceKey }, }); @@ -372,9 +372,9 @@ describe("Navigator.movedToKey$", () => { const sequenceKey: string = "sequenceId"; spyOn(graphService, "cacheImage$").and.returnValue(observableOf( new Image({ - computed_geometry: { lat: 0, lon: 0 }, + computed_geometry: { lat: 0, lng: 0 }, id: key, - geometry: { lat: 0, lon: 0 }, + geometry: { lat: 0, lng: 0 }, sequence: { id: sequenceKey }, }))); diff --git a/test/viewer/PanService.test.ts b/test/viewer/PanService.test.ts index 95b776ea..70f7acf8 100644 --- a/test/viewer/PanService.test.ts +++ b/test/viewer/PanService.test.ts @@ -42,7 +42,7 @@ describe("PanService.panImages$", () => { (>stateService.currentState$).next(new FrameHelper().createFrame()); (>stateService.currentImage$).next(new ImageHelper().createImage()); - (>stateService.reference$).next({ alt: 0, lat: 0, lon: 0 }); + (>stateService.reference$).next({ alt: 0, lat: 0, lng: 0 }); }); it("should emit", (done: Function) => { @@ -65,7 +65,7 @@ describe("PanService.panImages$", () => { (>stateService.currentState$).next(new FrameHelper().createFrame()); (>stateService.currentImage$).next(new ImageHelper().createImage()); - (>stateService.reference$).next({ alt: 0, lat: 0, lon: 0 }); + (>stateService.reference$).next({ alt: 0, lat: 0, lng: 0 }); cacheBoundingBoxSubject.next([]); }); @@ -89,7 +89,7 @@ describe("PanService.panImages$", () => { (>stateService.currentState$).next(new FrameHelper().createFrame()); (>stateService.currentImage$).next(new ImageHelper().createUnmergedImage()); - (>stateService.reference$).next({ alt: 0, lat: 0, lon: 0 }); + (>stateService.reference$).next({ alt: 0, lat: 0, lng: 0 }); cacheBoundingBoxSubject.next([]); }); @@ -114,7 +114,7 @@ describe("PanService.panImages$", () => { (>stateService.currentState$).next(new FrameHelper().createFrame()); (>stateService.currentImage$).next(new ImageHelper().createImage()); - (>stateService.reference$).next({ alt: 0, lat: 0, lon: 0 }); + (>stateService.reference$).next({ alt: 0, lat: 0, lng: 0 }); erroredCacheBoundingBoxSubject.error(new Error()); expect(emitCount).toBe(1); @@ -123,7 +123,7 @@ describe("PanService.panImages$", () => { (graphService.cacheBoundingBox$).and.returnValue(cacheBoundingBoxSubject); (>stateService.currentImage$).next(new ImageHelper().createImage()); - (>stateService.reference$).next({ alt: 0, lat: 0, lon: 0 }); + (>stateService.reference$).next({ alt: 0, lat: 0, lng: 0 }); cacheBoundingBoxSubject.next([]); @@ -152,7 +152,7 @@ describe("PanService.panImages$", () => { (>stateService.currentState$).next(new FrameHelper().createFrame()); (>stateService.currentImage$).next(new ImageHelper().createImage()); - (>stateService.reference$).next({ alt: 0, lat: 0, lon: 0 }); + (>stateService.reference$).next({ alt: 0, lat: 0, lng: 0 }); cacheBoundingBoxSubject.next([]); }); });