@wemap/providers 8.0.1 → 8.1.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/index.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ import { Calibration } from "@wemap/camera";
2
+ import { Coordinates } from "@wemap/geo";
3
+ import { Quaternion_t } from "@wemap/maths";
4
+
5
+ declare module '@wemap/providers' {
6
+
7
+ export class VpsMetadata {
8
+
9
+ size: { width: number, height: number };
10
+ calibration?: Calibration;
11
+ time?: number;
12
+ coarse: {
13
+ attitude?: Quaternion_t,
14
+ position: Coordinates,
15
+ positionAccuracy: number
16
+ }
17
+
18
+ toJson(): object;
19
+ static fromJson(json: object): VpsMetadata;
20
+ }
21
+
22
+ }
23
+
package/index.js CHANGED
@@ -10,4 +10,6 @@ export { default as MapMatchingHandler } from './src/mapmatching/MapMatchingHand
10
10
  export { default as PositionSmoother } from './src/smoothers/PositionSmoother.js';
11
11
  export { default as AttitudeSmoother } from './src/smoothers/AttitudeSmoother.js';
12
12
 
13
+ export { default as VpsMetadata } from './src/providers/vision/VpsMetadata.js';
14
+
13
15
  export { default as ProvidersLoggerOld } from './src/events/ProvidersLoggerOld.js';
package/package.json CHANGED
@@ -8,13 +8,13 @@
8
8
  "Guillaume Pannetier <guillaume.pannetier@getwemap.com>"
9
9
  ],
10
10
  "dependencies": {
11
- "@wemap/camera": "^8.0.1",
12
- "@wemap/geo": "^8.0.1",
11
+ "@wemap/camera": "^8.1.0-alpha.0",
12
+ "@wemap/geo": "^8.1.0-alpha.0",
13
13
  "@wemap/geomagnetism": "^0.1.1",
14
14
  "@wemap/logger": "^8.0.1",
15
- "@wemap/map": "^8.0.1",
16
- "@wemap/maths": "^8.0.1",
17
- "@wemap/osm": "^8.0.1",
15
+ "@wemap/map": "^8.1.0-alpha.0",
16
+ "@wemap/maths": "^8.1.0-alpha.0",
17
+ "@wemap/osm": "^8.1.0-alpha.0",
18
18
  "@wemap/utils": "^8.0.1"
19
19
  },
20
20
  "description": "A package using different geoloc systems",
@@ -41,6 +41,6 @@
41
41
  "url": "git+https://github.com/wemap/wemap-modules-js.git"
42
42
  },
43
43
  "type": "module",
44
- "version": "8.0.1",
45
- "gitHead": "3ca82d390199d931014bee91f9e4bf0c39f8fc42"
44
+ "version": "8.1.0-alpha.0",
45
+ "gitHead": "9e87dcdc938ef2e2469bc18b3e88a25eb5b16c53"
46
46
  }
@@ -0,0 +1,78 @@
1
+ import { Coordinates } from '@wemap/geo';
2
+
3
+ class VpsMetadata {
4
+
5
+ /** @type {{width: number, height: number}} */
6
+ size;
7
+
8
+ /** @type {?object} */
9
+ calibration;
10
+
11
+ /** @type {?number} */
12
+ time;
13
+
14
+ /** @type {?{position: Coordinates, positionAccuracy: number, ?attitude: [number, number, number, number]}} */
15
+ coarse;
16
+
17
+ /**
18
+ * @returns {object}
19
+ */
20
+ toJson() {
21
+ const output = { size: this.size };
22
+ if (this.calibration) {
23
+ output.calibration = this.calibration;
24
+ }
25
+ if (typeof this.time === 'number') {
26
+ output.time = this.time;
27
+ }
28
+ if (this.coarse) {
29
+ output.coarse = {};
30
+
31
+ if (this.coarse.attitude) {
32
+ output.coarse.attitude = this.coarse.attitude;
33
+ }
34
+
35
+ if (this.coarse.position) {
36
+ output.coarse.position = this.coarse.position.toJson();
37
+ }
38
+
39
+ if (this.coarse.positionAccuracy) {
40
+ output.coarse.positionAccuracy = this.coarse.positionAccuracy;
41
+ }
42
+ }
43
+
44
+ return output;
45
+ }
46
+
47
+ /**
48
+ * @param {object} json
49
+ * @returns {Coordinates}
50
+ */
51
+ static fromJson(json) {
52
+ const output = new VpsMetadata();
53
+ output.size = json.size;
54
+ if (json.calibration) {
55
+ output.calibration = json.calibration;
56
+ }
57
+ if (typeof json.time === 'number') {
58
+ output.time = json.time;
59
+ }
60
+ if (json.coarse) {
61
+ output.coarse = {};
62
+
63
+ if (json.coarse.attitude) {
64
+ output.coarse.attitude = json.coarse.attitude;
65
+ }
66
+
67
+ if (json.coarse.position) {
68
+ output.coarse.position = Coordinates.fromJson(json.coarse.position);
69
+ }
70
+ if (json.coarse.positionAccuracy) {
71
+ output.coarse.positionAccuracy = json.coarse.positionAccuracy;
72
+ }
73
+ }
74
+ return output;
75
+ }
76
+ }
77
+
78
+ export default VpsMetadata;