@wemap/routers 12.8.8 → 12.8.10

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.
@@ -0,0 +1,73 @@
1
+
2
+ export type NavitiaCoordinates = { lat: number | string, lon: number | string };
3
+ export type NavitiaPath = {
4
+ name: string,
5
+ length: number
6
+ } & ({ instruction_start_coordinate: NavitiaCoordinates } | { via_uri: string });
7
+
8
+ export type NavitiaWaypoint = { name: string }
9
+ & (
10
+ { stop_point: { coord: NavitiaCoordinates } } |
11
+ { address: { coord: NavitiaCoordinates } } |
12
+ { poi: { coord: NavitiaCoordinates } }
13
+ )
14
+
15
+ export type NavitiaSection = {
16
+ id: string;
17
+ type: 'waiting' | 'transfer' | string,
18
+ mode: string,
19
+ departure_date_time: string,
20
+ arrival_date_time: string,
21
+ duration: number,
22
+ geojson: {
23
+ coordinates: [number, number][],
24
+ properties: { length: number }[]
25
+ },
26
+ path: NavitiaPath[],
27
+ display_informations: {
28
+ code: string,
29
+ color: string,
30
+ text_color: string,
31
+ direction: string,
32
+ physical_mode: string
33
+ },
34
+ from: NavitiaWaypoint,
35
+ to: NavitiaWaypoint,
36
+ vias?: {
37
+ id: string;
38
+ name: string;
39
+ access_point: {
40
+ id: string;
41
+ name: string;
42
+ coord: {
43
+ lon: string;
44
+ lat: string;
45
+ },
46
+ embedded_type: string;
47
+ },
48
+ is_entrance: boolean,
49
+ is_exit: boolean,
50
+ length: number,
51
+ traversal_time: number,
52
+ pathway_mode: number
53
+ }[]
54
+ }
55
+ export type NavitiaJson = {
56
+ journeys: {
57
+ duration: number,
58
+ departure_date_time: string,
59
+ arrival_date_time: string,
60
+ sections: NavitiaSection[]
61
+ }[],
62
+ context: {
63
+ timezone: string
64
+ };
65
+ error: {
66
+ message?: string;
67
+ }
68
+ };
69
+
70
+ export type NavitiaIntermediateStep = {
71
+ name: string,
72
+ distance: number
73
+ };
@@ -136,4 +136,18 @@ describe('OsmGraph - complex', () => {
136
136
 
137
137
  });
138
138
 
139
- });
139
+ it('escalators', () => {
140
+
141
+ const osmXmlString = loadFile('network-escalators.osm');
142
+ const osmModel = OsmParser.parseOsmXmlString(osmXmlString);
143
+ const graph = OsmGraphUtils.createGraphFromOsmModel(osmModel);
144
+
145
+ verifyCoherence(graph);
146
+
147
+ expect(graph.vertices.length).equals(4);
148
+ expect(graph.edges.length).equals(3);
149
+ graph.vertices.forEach(v => expect(v.coords.level).be.a("number"));
150
+
151
+ });
152
+
153
+ });
@@ -72,7 +72,10 @@ export default class OsmGraphUtils {
72
72
  if (vertex) {
73
73
  // In the case where vertices are linked to edges with level change
74
74
  if (!Level.equals(vertex.coords.level, nodeLevel)) {
75
- vertex.coords.level = Level.intersection(vertex.coords.level, nodeLevel) || nodeLevel;
75
+ vertex.coords.level = Level.intersection(vertex.coords.level, nodeLevel);
76
+ if (vertex.coords.level === null) {
77
+ vertex.coords.level = nodeLevel;
78
+ }
76
79
  }
77
80
  return vertex;
78
81
  }