@wemap/osm 5.1.4 → 5.1.6

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
@@ -11,7 +11,7 @@
11
11
  "directory": "packages/osm"
12
12
  },
13
13
  "name": "@wemap/osm",
14
- "version": "5.1.4",
14
+ "version": "5.1.6",
15
15
  "bugs": {
16
16
  "url": "https://github.com/wemap/wemap-modules-js/issues"
17
17
  },
@@ -31,5 +31,5 @@
31
31
  "@wemap/maths": "^5.1.1",
32
32
  "saxes": "^5.0.1"
33
33
  },
34
- "gitHead": "4c6d7dd227b3f2a513b7c56b05ffd3dc712f970d"
34
+ "gitHead": "8048998611347f44f890eefef86fddc5d13f43e9"
35
35
  }
@@ -35,6 +35,11 @@ class ItineraryInfoManager {
35
35
  /** @type {Itinerary} */
36
36
  set itinerary(itinerary) {
37
37
 
38
+ if (itinerary === null) {
39
+ this._itinerary = null;
40
+ return;
41
+ }
42
+
38
43
  this._itinerary = itinerary;
39
44
  this._steps = itinerary.steps;
40
45
  this._network = itinerary.toNetwork();
@@ -73,6 +78,10 @@ class ItineraryInfoManager {
73
78
  */
74
79
  getInfo(position) {
75
80
 
81
+ if (!this._itinerary) {
82
+ return null;
83
+ }
84
+
76
85
  if (!(position instanceof Coordinates)) {
77
86
  return null;
78
87
  }
@@ -5,6 +5,7 @@ import { rad2deg, positiveMod } from '@wemap/maths';
5
5
 
6
6
  import Itinerary from '../Itinerary.js';
7
7
  import Leg from '../Leg.js';
8
+ import LevelChange from '../LevelChange.js';
8
9
  import RouterResponse from '../RouterResponse.js';
9
10
  import Step from '../Step.js';
10
11
  import { generateStepsMetadata } from '../Utils.js';
@@ -116,7 +117,7 @@ export function itineraryToOsrmJson(itinerary) {
116
117
  }
117
118
  };
118
119
  if (step.levelChange !== null) {
119
- jsonStep.levelChange = step.levelChange;
120
+ jsonStep.levelChange = step.levelChange.toJson();
120
121
  }
121
122
  if (typeof step.extras === 'object' && Object.keys(step.extras).length !== 0) {
122
123
  jsonStep.extras = step.extras;
@@ -170,7 +171,7 @@ function parseJsonSteps(jsonSteps, legCoords) {
170
171
  step._idCoordsInLeg = idStepCoordsInLeg;
171
172
 
172
173
  step.name = jsonStep.name;
173
- step.levelChange = jsonStep.levelChange ? jsonStep.levelChange : null;
174
+ step.levelChange = jsonStep.levelChange ? LevelChange.fromJson(jsonStep.levelChange) : null;
174
175
 
175
176
  step.distance = jsonStep.distance;
176
177
  step.duration = jsonStep.duration;