@wemap/geo 7.3.1 → 7.4.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
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/geo"
13
13
  },
14
14
  "name": "@wemap/geo",
15
- "version": "7.3.1",
15
+ "version": "7.4.0",
16
16
  "bugs": {
17
17
  "url": "https://github.com/wemap/wemap-modules-js/issues"
18
18
  },
@@ -30,5 +30,5 @@
30
30
  "@wemap/logger": "^7.0.0",
31
31
  "@wemap/maths": "^7.0.0"
32
32
  },
33
- "gitHead": "e5431db888821781448e7e05b047e2f4a5d8a1ce"
33
+ "gitHead": "dfc8ea75a6e3a148e690b03945f69f880c4e9eb7"
34
34
  }
@@ -38,6 +38,29 @@ class GeoRef {
38
38
  const ecefTranslationScaled = Vector3.multiplyScalar(ecefTranslation, 1 / this.scale);
39
39
  return Quaternion.rotate(enuToEcefRotationOrigin, ecefTranslationScaled);
40
40
  }
41
+
42
+ /**
43
+ * @returns {Object}
44
+ */
45
+ toJson() {
46
+ return {
47
+ origin: this.origin.toJson(),
48
+ scale: this.scale,
49
+ heading: this.heading
50
+ };
51
+ }
52
+
53
+ /**
54
+ * @param {Object} json
55
+ * @returns {GeoRef}
56
+ */
57
+ static fromJson(json) {
58
+ const geoRef = new GeoRef();
59
+ geoRef.origin = Coordinates.fromJson(json.origin);
60
+ geoRef.scale = json.scale;
61
+ geoRef.heading = json.heading;
62
+ return geoRef;
63
+ }
41
64
  }
42
65
 
43
66
  export default GeoRef;