@wemap/geo 3.1.21 → 3.2.2

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.js CHANGED
@@ -1,15 +1,15 @@
1
- import Constants from './src/Constants';
2
- import Utils from './src/Utils';
1
+ import Constants from './src/Constants.js';
2
+ import Utils from './src/Utils.js';
3
3
 
4
- import Attitude from './src/rotations/Attitude';
5
- import AbsoluteHeading from './src/rotations/AbsoluteHeading';
4
+ import Attitude from './src/rotations/Attitude.js';
5
+ import AbsoluteHeading from './src/rotations/AbsoluteHeading.js';
6
6
 
7
- import BoundingBox from './src/coordinates/BoundingBox';
8
- import GeoRelativePosition from './src/coordinates/GeoRelativePosition';
9
- import Level from './src/coordinates/Level';
10
- import RelativePosition from './src/coordinates/RelativePosition';
11
- import Coordinates from './src/coordinates/Coordinates';
12
- import UserPosition from './src/coordinates/UserPosition';
7
+ import BoundingBox from './src/coordinates/BoundingBox.js';
8
+ import GeoRelativePosition from './src/coordinates/GeoRelativePosition.js';
9
+ import Level from './src/coordinates/Level.js';
10
+ import RelativePosition from './src/coordinates/RelativePosition.js';
11
+ import Coordinates from './src/coordinates/Coordinates.js';
12
+ import UserPosition from './src/coordinates/UserPosition.js';
13
13
 
14
14
  export {
15
15
  AbsoluteHeading,
package/package.json CHANGED
@@ -12,14 +12,13 @@
12
12
  "directory": "packages/geo"
13
13
  },
14
14
  "name": "@wemap/geo",
15
- "version": "3.1.21",
15
+ "version": "3.2.2",
16
16
  "bugs": {
17
17
  "url": "https://github.com/wemap/wemap-modules-js/issues"
18
18
  },
19
19
  "homepage": "https://github.com/wemap/wemap-modules-js#readme",
20
- "scripts": {
21
- "test": "mocha -r esm \"src/**/*.spec.js\""
22
- },
20
+ "scripts": {},
21
+ "type": "module",
23
22
  "keywords": [
24
23
  "utils",
25
24
  "geo",
@@ -27,8 +26,8 @@
27
26
  ],
28
27
  "license": "ISC",
29
28
  "dependencies": {
30
- "@wemap/logger": "^3.0.0",
31
- "@wemap/maths": "^3.1.15"
29
+ "@wemap/logger": "^3.2.1",
30
+ "@wemap/maths": "^3.2.1"
32
31
  },
33
- "gitHead": "17f72afdcf6098bf90d3dffc2cf0b15f9284d4d4"
32
+ "gitHead": "6ff8c054aed5ccbf0f456aad752c43f46fe6b278"
34
33
  }
package/src/Utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable max-statements */
2
- import Coordinates from './coordinates/Coordinates';
2
+ import Coordinates from './coordinates/Coordinates.js';
3
3
 
4
4
  class Utils {
5
5
 
package/src/Utils.spec.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import chai from 'chai';
3
3
  import chaiAlmost from 'chai-almost';
4
4
 
5
- import Utils from './Utils';
6
- import Coordinates from './coordinates/Coordinates';
5
+ import Utils from './Utils.js';
6
+ import Coordinates from './coordinates/Coordinates.js';
7
7
 
8
8
  const expect = chai.expect;
9
9
  chai.use(chaiAlmost(1e-3));
@@ -1,4 +1,4 @@
1
- import Coordinates from './Coordinates';
1
+ import Coordinates from './Coordinates.js';
2
2
 
3
3
  class BoundingBox {
4
4
 
@@ -2,9 +2,10 @@
2
2
  import chai from 'chai';
3
3
  import chaiAlmost from 'chai-almost';
4
4
 
5
- import BoundingBox from './BoundingBox';
6
5
  import Logger from '@wemap/logger';
7
- import Coordinates from './Coordinates';
6
+
7
+ import BoundingBox from './BoundingBox.js';
8
+ import Coordinates from './Coordinates.js';
8
9
 
9
10
  const expect = chai.expect;
10
11
  chai.use(chaiAlmost());
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  Utils, Vector3, Quaternion, rad2deg
3
3
  } from '@wemap/maths';
4
- import Constants from '../Constants';
5
- import Level from './Level';
4
+
5
+ import Constants from '../Constants.js';
6
+ import Level from './Level.js';
6
7
 
7
8
  /**
8
9
  * A Coordinates position using at least latitude (lat) and longitude (lng).
@@ -29,10 +30,18 @@ class Coordinates {
29
30
  return this._lat;
30
31
  }
31
32
 
33
+ get latitude() {
34
+ return this._lat;
35
+ }
36
+
32
37
  get lng() {
33
38
  return this._lng;
34
39
  }
35
40
 
41
+ get longitude() {
42
+ return this._lng;
43
+ }
44
+
36
45
  /**
37
46
  * alt does not denote the altitude of a point but its height from
38
47
  * the "level" field (if defined) or from the ground
@@ -348,6 +357,13 @@ class Coordinates {
348
357
  return new Coordinates(json.lat, json.lng, json.alt, Level.fromString(json.level));
349
358
  }
350
359
 
360
+ toCompressedJson() {
361
+ return [this.lat, this.lng, this.alt, this.level === null ? null : this.level.toString()];
362
+ }
363
+
364
+ static fromCompressedJson(json) {
365
+ return new Coordinates(json[0], json[1], json[2], Level.fromString(json[3]));
366
+ }
351
367
  }
352
368
 
353
369
  export default Coordinates;
@@ -1,9 +1,9 @@
1
1
  import chai from 'chai';
2
2
  import chaiAlmost from 'chai-almost';
3
3
 
4
- import Coordinates from './Coordinates';
5
- import Level from './Level';
6
- import Constants from '../Constants';
4
+ import Coordinates from './Coordinates.js';
5
+ import Level from './Level.js';
6
+ import Constants from '../Constants.js';
7
7
 
8
8
  const expect = chai.expect;
9
9
  chai.use(chaiAlmost());
@@ -1,4 +1,4 @@
1
- import RelativePosition from './RelativePosition';
1
+ import RelativePosition from './RelativePosition.js';
2
2
 
3
3
  /**
4
4
  * Position is defined in EUS (East-Up-South) frame with: x pointing to East, y pointing to Up, z pointing to South
@@ -1,9 +1,12 @@
1
1
  /* eslint-disable max-nested-callbacks */
2
- import { expect } from 'chai';
2
+ import chai from 'chai';
3
3
 
4
- import Level from './Level';
5
4
  import Logger from '@wemap/logger';
6
5
 
6
+ import Level from './Level.js';
7
+
8
+ const { expect } = chai;
9
+
7
10
  Logger.enable(false);
8
11
 
9
12
  const checkSingle = (_level, _value) => {
@@ -1,4 +1,4 @@
1
- import Constants from '../Constants';
1
+ import Constants from '../Constants.js';
2
2
 
3
3
  class RelativePosition {
4
4
 
@@ -1,5 +1,5 @@
1
- import Coordinates from './Coordinates';
2
- import Constants from '../Constants';
1
+ import Coordinates from './Coordinates.js';
2
+ import Constants from '../Constants.js';
3
3
 
4
4
  /**
5
5
  * A Coordinates User Position is a Coordinates position with specific data related to user (bearing, time, accuracy)
@@ -2,9 +2,9 @@
2
2
  import chai from 'chai';
3
3
  import chaiAlmost from 'chai-almost';
4
4
 
5
- import UserPosition from './UserPosition';
6
- import Level from './Level';
7
- import Coordinates from './Coordinates';
5
+ import UserPosition from './UserPosition.js';
6
+ import Level from './Level.js';
7
+ import Coordinates from './Coordinates.js';
8
8
 
9
9
  const expect = chai.expect;
10
10
  chai.use(chaiAlmost());
@@ -1,5 +1,6 @@
1
1
  import { Quaternion } from '@wemap/maths';
2
- import Attitude from './Attitude';
2
+
3
+ import Attitude from './Attitude.js';
3
4
 
4
5
  class AbsoluteHeading {
5
6
 
@@ -2,11 +2,12 @@
2
2
  import chai from 'chai';
3
3
  import chaiAlmost from 'chai-almost';
4
4
 
5
- import Attitude from './Attitude';
6
5
  import {
7
6
  deg2rad, Quaternion, Utils
8
7
  } from '@wemap/maths';
9
8
 
9
+ import Attitude from './Attitude.js';
10
+
10
11
  const expect = chai.expect;
11
12
  chai.use(chaiAlmost());
12
13