@wemap/providers 8.2.0 → 9.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -9,13 +9,13 @@
9
9
  ],
10
10
  "dependencies": {
11
11
  "@wemap/camera": "^8.1.0",
12
- "@wemap/geo": "^8.1.0",
12
+ "@wemap/geo": "^9.0.0-alpha.0",
13
13
  "@wemap/geomagnetism": "^0.1.1",
14
14
  "@wemap/logger": "^8.0.1",
15
- "@wemap/map": "^8.1.0",
15
+ "@wemap/map": "^9.0.0-alpha.0",
16
16
  "@wemap/maths": "^8.1.0",
17
- "@wemap/osm": "^8.1.0",
18
- "@wemap/routers": "^8.1.0",
17
+ "@wemap/osm": "^9.0.0-alpha.0",
18
+ "@wemap/routers": "^9.0.0-alpha.0",
19
19
  "@wemap/utils": "^8.1.0"
20
20
  },
21
21
  "description": "A package using different geoloc systems",
@@ -42,6 +42,6 @@
42
42
  "url": "git+https://github.com/wemap/wemap-modules-js.git"
43
43
  },
44
44
  "type": "module",
45
- "version": "8.2.0",
46
- "gitHead": "0bc7e5d04957228873973c3b7738b1e7da68cddb"
45
+ "version": "9.0.0-alpha.0",
46
+ "gitHead": "fc17cf617195c987813ede500bf67dd0f135cf34"
47
47
  }
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-bitwise */
2
2
 
3
- import { Level, UserPosition } from '@wemap/geo';
3
+ import { UserPosition } from '@wemap/geo';
4
4
  import { TimeUtils } from '@wemap/utils';
5
5
 
6
6
  import Provider from '../../Provider.js';
@@ -94,7 +94,7 @@ class PoleStar extends Provider {
94
94
  json.lat,
95
95
  json.lng,
96
96
  Constants.DEFAULT_ALTITUDE,
97
- new Level(json.alt / 5),
97
+ json.alt / 5,
98
98
  timestamp,
99
99
  json.accuracy,
100
100
  json.bearing,
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable max-statements */
2
2
  import { SharedCameras, CameraUtils, Camera } from '@wemap/camera';
3
- import { Attitude, Level, UserPosition } from '@wemap/geo';
3
+ import { Attitude, UserPosition } from '@wemap/geo';
4
4
  import Logger from '@wemap/logger';
5
5
  import { deg2rad, Quaternion } from '@wemap/maths';
6
6
  import { TimeUtils } from '../../../../utils/index.js';
@@ -247,32 +247,34 @@ class Vps extends Provider {
247
247
 
248
248
  static _parseJsonResponse(json, requestTime) {
249
249
 
250
- const quaternion = [
250
+ const enuToCameraRot = [
251
251
  json.attitude.w,
252
252
  json.attitude.x,
253
253
  json.attitude.y,
254
254
  json.attitude.z
255
255
  ];
256
- const quaternionNorm = Quaternion.norm(quaternion);
257
- quaternion[0] /= quaternionNorm;
258
- quaternion[1] /= quaternionNorm;
259
- quaternion[2] /= quaternionNorm;
260
- quaternion[3] /= quaternionNorm;
261
256
 
262
- // TODO: Move camera to smartphone rotation here instead of server
257
+ const cameraToSmartphoneRot = Quaternion.fromAxisAngle(
258
+ [1, 0, 0],
259
+ Math.PI
260
+ );
261
+ const enuToSmartphoneRot = Quaternion.multiply(
262
+ enuToCameraRot,
263
+ cameraToSmartphoneRot
264
+ );
263
265
 
264
266
  const quaternionWithScreenRotation = Quaternion.multiply(
265
- Quaternion.fromAxisAngle([0, 0, 1], deg2rad(window.orientation || 0)), quaternion
267
+ Quaternion.fromAxisAngle([0, 0, 1], deg2rad(window.orientation || 0)),
268
+ enuToSmartphoneRot
266
269
  );
267
270
 
268
271
  const attitude = new Attitude(quaternionWithScreenRotation, requestTime, 0);
269
272
 
270
-
271
273
  const userPosition = new UserPosition(
272
274
  json.coordinates.lat,
273
275
  json.coordinates.lng,
274
276
  json.coordinates.alt,
275
- json.coordinates.level ? new Level(json.coordinates.level) : null,
277
+ typeof json.coordinates.level === 'undefined' ? null : json.coordinates.level,
276
278
  requestTime,
277
279
  0,
278
280
  attitude.heading
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable max-statements */
2
- import { UserPosition } from '@wemap/geo';
2
+ import { Level, UserPosition } from '@wemap/geo';
3
3
 
4
4
  class PositionSmoother {
5
5
 
@@ -52,11 +52,7 @@ class PositionSmoother {
52
52
  let i = 1;
53
53
  const nSamples = this.frequency * flybyTime + 1;
54
54
 
55
- let newPositionLevel = null;
56
- if (newPosition.level !== null) {
57
- newPositionLevel = newPosition.level.clone();
58
- }
59
-
55
+ const newPositionLevel = Level.clone(newPosition.level);
60
56
  while (i < nSamples + 1) {
61
57
  const smoothedPosition = previousPosition.destinationPoint(distance * i / nSamples, azimuth);
62
58
  smoothedPosition.time = refTimestamp + (i - 1) / this.frequency;