@wemap/routers 12.10.8-alpha.0 → 12.10.8-alpha.1

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.
Files changed (194) hide show
  1. package/dist/helpers/InstructionManager.d.ts +20 -0
  2. package/dist/helpers/InstructionManagerV1.d.ts +7 -0
  3. package/{index.ts → dist/index.d.ts} +1 -11
  4. package/dist/index.js +1 -5098
  5. package/dist/index.js.map +1 -1
  6. package/dist/src/ItineraryInfoManager.d.ts +31 -0
  7. package/dist/src/ItineraryInfoManager.spec.d.ts +1 -0
  8. package/dist/src/RoutingError.d.ts +24 -0
  9. package/{src/StatusCode.ts → dist/src/StatusCode.d.ts} +2 -3
  10. package/dist/src/Utils.d.ts +6 -0
  11. package/dist/src/graph/Edge.d.ts +32 -0
  12. package/dist/src/graph/Edge.spec.d.ts +1 -0
  13. package/dist/src/graph/Graph.d.ts +40 -0
  14. package/dist/src/graph/Graph.spec.d.ts +1 -0
  15. package/dist/src/graph/GraphProjection.d.ts +11 -0
  16. package/dist/src/graph/GraphProjectionOptions.d.ts +7 -0
  17. package/dist/src/graph/GraphRoute.d.ts +19 -0
  18. package/dist/src/graph/GraphRoute.spec.d.ts +2 -0
  19. package/dist/src/graph/GraphRouter.d.ts +20 -0
  20. package/dist/src/graph/GraphRouter.spec.d.ts +1 -0
  21. package/dist/src/graph/GraphRouterEngine.d.ts +77 -0
  22. package/{src/graph/GraphRouterOptions.ts → dist/src/graph/GraphRouterOptions.d.ts} +5 -7
  23. package/dist/src/graph/GraphRouterOptionsBuilder.d.ts +20 -0
  24. package/dist/src/graph/NoRouteFoundError.d.ts +12 -0
  25. package/dist/src/graph/Vertex.d.ts +19 -0
  26. package/dist/src/graph/Vertex.spec.d.ts +1 -0
  27. package/dist/src/model/Itinerary.d.ts +81 -0
  28. package/dist/src/model/Itinerary.spec.d.ts +7 -0
  29. package/dist/src/model/Leg.d.ts +66 -0
  30. package/dist/src/model/Leg.spec.d.ts +6 -0
  31. package/dist/src/model/LevelChange.d.ts +7 -0
  32. package/dist/src/model/LevelChange.spec.d.ts +6 -0
  33. package/dist/src/model/RouterRequest.d.ts +40 -0
  34. package/dist/src/model/Step.d.ts +42 -0
  35. package/dist/src/model/Step.spec.d.ts +52 -0
  36. package/dist/src/model/StepExtra.d.ts +3 -0
  37. package/dist/src/model/StepsBuilder.d.ts +16 -0
  38. package/dist/src/model/TransitMode.d.ts +5 -0
  39. package/dist/src/model/TransitMode.spec.d.ts +1 -0
  40. package/{src/model/TravelMode.ts → dist/src/model/TravelMode.d.ts} +1 -2
  41. package/dist/src/model/generateSteps.d.ts +0 -0
  42. package/{src/remote/RemoteRouter.ts → dist/src/remote/RemoteRouter.d.ts} +2 -7
  43. package/dist/src/remote/RemoteRouterManager.d.ts +731 -0
  44. package/dist/src/remote/RemoteRouterManager.spec.d.ts +1 -0
  45. package/dist/src/remote/RemoteRouterUtils.d.ts +6 -0
  46. package/dist/src/remote/cityway/CitywayRemoteRouter.d.ts +109 -0
  47. package/dist/src/remote/cityway/CitywayRemoteRouter.spec.d.ts +1 -0
  48. package/dist/src/remote/deutsche-bahn/DeutscheBahnRemoteRouter.d.ts +31 -0
  49. package/dist/src/remote/deutsche-bahn/DeutscheBahnRemoteRouter.spec.d.ts +1 -0
  50. package/dist/src/remote/geovelo/GeoveloRemoteRouter.d.ts +106 -0
  51. package/dist/src/remote/geovelo/GeoveloRemoteRouter.spec.d.ts +1 -0
  52. package/dist/src/remote/idfm/IdfmRemoteRouter.d.ts +123 -0
  53. package/dist/src/remote/idfm/IdfmRemoteRouter.spec.d.ts +1 -0
  54. package/dist/src/remote/navitia/NavitiaRemoteRouter.d.ts +34 -0
  55. package/dist/src/remote/navitia/NavitiaRemoteRouter.spec.d.ts +1 -0
  56. package/dist/src/remote/navitia/types.d.ts +87 -0
  57. package/dist/src/remote/osrm/OsrmRemoteRouter.d.ts +70 -0
  58. package/dist/src/remote/osrm/OsrmRemoteRouter.spec.d.ts +1 -0
  59. package/dist/src/remote/otp/OtpRemoteRouter.d.ts +69 -0
  60. package/dist/src/remote/otp/OtpRemoteRouter.spec.d.ts +1 -0
  61. package/dist/src/remote/wemap-multi/WemapMultiRemoteRouter.d.ts +19 -0
  62. package/dist/src/remote/wemap-multi/WemapMultiRemoteRouter.spec.d.ts +1 -0
  63. package/dist/src/types.d.ts +31 -0
  64. package/dist/src/wemap-multi/CustomGraphMap.d.ts +56 -0
  65. package/dist/src/wemap-multi/CustomGraphMap.spec.d.ts +1 -0
  66. package/dist/src/wemap-multi/CustomGraphMapTester.d.ts +39 -0
  67. package/dist/src/wemap-multi/CustomGraphMapTester.spec.d.ts +1 -0
  68. package/dist/src/wemap-multi/WemapMultiRouter.d.ts +14 -0
  69. package/dist/src/wemap-multi/WemapMultiRouter.spec.d.ts +1 -0
  70. package/dist/src/wemap-osm/OsmGraphUtils.d.ts +11 -0
  71. package/dist/src/wemap-osm/OsmGraphUtils.spec.d.ts +1 -0
  72. package/dist/src/wemap-osm/OsmRouter.elevators.spec.d.ts +1 -0
  73. package/dist/src/wemap-osm/OsmRouter.spec.d.ts +1 -0
  74. package/dist/tests/CommonTest.d.ts +8 -0
  75. package/dist/vite.config.d.ts +19 -0
  76. package/package.json +10 -7
  77. package/assets/biocbon-bergere-rdc-network.osm +0 -163
  78. package/assets/bureaux-wemap-montpellier-network.osm +0 -174
  79. package/assets/components.osm +0 -146
  80. package/assets/elevator-models-4.osm +0 -89
  81. package/assets/elevator-models.osm +0 -354
  82. package/assets/exit-graph.osm +0 -25
  83. package/assets/gare-de-lest-network-pp-bounds.osm +0 -1613
  84. package/assets/gare-de-lyon-extract.osm +0 -174
  85. package/assets/geovelo-montpellier.json +0 -1144
  86. package/assets/horizontal-elevator.osm +0 -12
  87. package/assets/itinerary-deutsche-bahn-1.json +0 -368
  88. package/assets/itinerary-grenoble-otp-1.json +0 -1536
  89. package/assets/itinerary-grenoble-otp-2.json +0 -1092
  90. package/assets/itinerary-info-two-points-proj.osm +0 -39
  91. package/assets/itinerary-info-two-points.osm +0 -24
  92. package/assets/itinerary-lehavre-cityway-1.json +0 -6799
  93. package/assets/itinerary-lehavre-cityway-2.json +0 -2133
  94. package/assets/itinerary-lehavre-cityway-3.json +0 -12577
  95. package/assets/itinerary-lehavre-cityway-4.json +0 -1451
  96. package/assets/itinerary-lehavre-cityway-5.json +0 -5925
  97. package/assets/itinerary-lemans-navitia.json +0 -7768
  98. package/assets/itinerary-montpellier-osrm-3.json +0 -185
  99. package/assets/itinerary-montpellier-outdoor-without-steps.json +0 -110
  100. package/assets/itinerary-montpellier-outdoor.json +0 -513
  101. package/assets/itinerary-paris-idfm-2.json +0 -1838
  102. package/assets/itinerary-paris-idfm.json +0 -27727
  103. package/assets/itinerary-step-not-on-path-osrm.json +0 -457
  104. package/assets/itinerary-with-duplicate-nodes.json +0 -110
  105. package/assets/network-conveying-backward.osm +0 -74
  106. package/assets/network-elevator.osm +0 -48
  107. package/assets/network-escalators.osm +0 -50
  108. package/assets/network-simple.osm +0 -27
  109. package/assets/network-steps-same-level.osm +0 -283
  110. package/assets/network-with-modifiers.osm +0 -39
  111. package/assets/one-way.osm +0 -46
  112. package/assets/report-map-1.osm +0 -36
  113. package/assets/report-map-2.osm +0 -29
  114. package/assets/report-map-3.osm +0 -15
  115. package/assets/rr-wemap-multi-indoor-outdoor-indoor.json +0 -1352
  116. package/assets/rr-wemap-multi-indoor-outdoor.json +0 -145
  117. package/assets/rr-wemap-multi-multi-level.json +0 -262
  118. package/assets/rr-wemap-multi-outdoor-indoor.json +0 -145
  119. package/assets/rr-wemap-multi-outdoor-outdoor.json +0 -207
  120. package/assets/rr-wemap-multi-remote-indoor-indoor.json +0 -155
  121. package/assets/rr-wemap-multi-remote-indoor-outdoor-indoor.json +0 -668
  122. package/assets/rr-wemap-multi-remote-indoor-outdoor.json +0 -154
  123. package/assets/rr-wemap-multi-remote-outdoor-indoor.json +0 -179
  124. package/assets/rr-wemap-multi-remote-outdoor-outdoor.json +0 -109
  125. package/assets/stairs-and-exit.osm +0 -47
  126. package/helpers/InstructionManager.ts +0 -184
  127. package/helpers/InstructionManagerV1.ts +0 -95
  128. package/src/ItineraryInfoManager.spec.ts +0 -183
  129. package/src/ItineraryInfoManager.ts +0 -181
  130. package/src/RoutingError.ts +0 -60
  131. package/src/Utils.ts +0 -8
  132. package/src/graph/Edge.spec.ts +0 -32
  133. package/src/graph/Edge.ts +0 -64
  134. package/src/graph/Graph.spec.ts +0 -509
  135. package/src/graph/Graph.ts +0 -271
  136. package/src/graph/GraphProjection.ts +0 -15
  137. package/src/graph/GraphProjectionOptions.ts +0 -8
  138. package/src/graph/GraphRoute.spec.ts +0 -15
  139. package/src/graph/GraphRoute.ts +0 -43
  140. package/src/graph/GraphRouter.spec.ts +0 -317
  141. package/src/graph/GraphRouter.ts +0 -229
  142. package/src/graph/GraphRouterEngine.ts +0 -248
  143. package/src/graph/GraphRouterOptionsBuilder.ts +0 -98
  144. package/src/graph/NoRouteFoundError.ts +0 -39
  145. package/src/graph/Vertex.spec.ts +0 -42
  146. package/src/graph/Vertex.ts +0 -45
  147. package/src/model/Itinerary.spec.ts +0 -134
  148. package/src/model/Itinerary.ts +0 -370
  149. package/src/model/Leg.spec.ts +0 -107
  150. package/src/model/Leg.ts +0 -224
  151. package/src/model/LevelChange.spec.ts +0 -50
  152. package/src/model/LevelChange.ts +0 -14
  153. package/src/model/RouterRequest.ts +0 -33
  154. package/src/model/Step.spec.ts +0 -99
  155. package/src/model/Step.ts +0 -90
  156. package/src/model/StepExtra.ts +0 -1
  157. package/src/model/StepsBuilder.ts +0 -242
  158. package/src/model/TransitMode.spec.ts +0 -31
  159. package/src/model/TransitMode.ts +0 -28
  160. package/src/model/generateSteps.ts +0 -102
  161. package/src/remote/RemoteRouterManager.spec.ts +0 -178
  162. package/src/remote/RemoteRouterManager.ts +0 -72
  163. package/src/remote/RemoteRouterUtils.ts +0 -25
  164. package/src/remote/cityway/CitywayRemoteRouter.spec.ts +0 -122
  165. package/src/remote/cityway/CitywayRemoteRouter.ts +0 -435
  166. package/src/remote/deutsche-bahn/DeutscheBahnRemoteRouter.spec.ts +0 -52
  167. package/src/remote/deutsche-bahn/DeutscheBahnRemoteRouter.ts +0 -85
  168. package/src/remote/geovelo/GeoveloRemoteRouter.spec.ts +0 -54
  169. package/src/remote/geovelo/GeoveloRemoteRouter.ts +0 -293
  170. package/src/remote/idfm/IdfmRemoteRouter.spec.ts +0 -102
  171. package/src/remote/idfm/IdfmRemoteRouter.ts +0 -523
  172. package/src/remote/navitia/NavitiaRemoteRouter.spec.ts +0 -116
  173. package/src/remote/navitia/NavitiaRemoteRouter.ts +0 -445
  174. package/src/remote/navitia/types.ts +0 -73
  175. package/src/remote/osrm/OsrmRemoteRouter.spec.ts +0 -127
  176. package/src/remote/osrm/OsrmRemoteRouter.ts +0 -303
  177. package/src/remote/otp/OtpRemoteRouter.spec.ts +0 -103
  178. package/src/remote/otp/OtpRemoteRouter.ts +0 -223
  179. package/src/remote/wemap-multi/WemapMultiRemoteRouter.spec.ts +0 -103
  180. package/src/remote/wemap-multi/WemapMultiRemoteRouter.ts +0 -56
  181. package/src/types.ts +0 -32
  182. package/src/wemap-multi/CustomGraphMap.spec.ts +0 -40
  183. package/src/wemap-multi/CustomGraphMap.ts +0 -213
  184. package/src/wemap-multi/CustomGraphMapTester.spec.ts +0 -48
  185. package/src/wemap-multi/CustomGraphMapTester.ts +0 -90
  186. package/src/wemap-multi/WemapMultiRouter.spec.ts +0 -138
  187. package/src/wemap-multi/WemapMultiRouter.ts +0 -329
  188. package/src/wemap-osm/OsmGraphUtils.spec.ts +0 -165
  189. package/src/wemap-osm/OsmGraphUtils.ts +0 -173
  190. package/src/wemap-osm/OsmRouter.elevators.spec.ts +0 -106
  191. package/src/wemap-osm/OsmRouter.spec.ts +0 -292
  192. package/tests/CommonTest.ts +0 -78
  193. package/tsconfig.json +0 -3
  194. package/vite.config.ts +0 -4
@@ -1,154 +0,0 @@
1
- {
2
- "routerName": [
3
- "wemap-meta",
4
- "osrm",
5
- "wemap"
6
- ],
7
- "origin": {
8
- "lat": 48.8725992,
9
- "lng": 2.343431
10
- },
11
- "destination": {
12
- "lat": 48.8726513,
13
- "lng": 2.343449
14
- },
15
- "itineraries": [
16
- {
17
- "origin": {
18
- "lat": 48.8725992,
19
- "lng": 2.343431
20
- },
21
- "destination": {
22
- "lat": 48.8726513,
23
- "lng": 2.343449
24
- },
25
- "distance": 24.658068219028713,
26
- "duration": 17.641809117700674,
27
- "transitMode": "WALK",
28
- "legs": [
29
- {
30
- "transitMode": "WALK",
31
- "start": {
32
- "coords": [
33
- 48.8725992,
34
- 2.343431
35
- ]
36
- },
37
- "end": {
38
- "coords": [
39
- 48.87262168252,
40
- 2.34327125172
41
- ]
42
- },
43
- "distance": 12.558068219028716,
44
- "duration": 9.041809117700675,
45
- "coords": [
46
- [
47
- 48.87258947110776,
48
- 2.3434277129983445
49
- ],
50
- [
51
- 48.87259587423,
52
- 2.34338390486
53
- ],
54
- [
55
- 48.87260236152,
56
- 2.34329666635
57
- ],
58
- [
59
- 48.87262168252,
60
- 2.34327125172
61
- ]
62
- ],
63
- "steps": [
64
- {
65
- "number": 1,
66
- "coords": [
67
- 48.87258947110776,
68
- 2.3434277129983445
69
- ],
70
- "angle": 1.5707971647295182,
71
- "previousBearing": -2.922923490486779,
72
- "nextBearing": -1.3521280016265034,
73
- "distance": 9.714015164011663,
74
- "_idCoordsInLeg": 0,
75
- "firstStep": true,
76
- "duration": 6.994090918088396
77
- },
78
- {
79
- "number": 2,
80
- "coords": [
81
- 48.87260236152,
82
- 2.34329666635
83
- ],
84
- "angle": 2.396617182360001,
85
- "previousBearing": -1.458215167261915,
86
- "nextBearing": -0.7132396960321222,
87
- "distance": 2.8440530550170537,
88
- "_idCoordsInLeg": 2,
89
- "duration": 2.0477181996122784
90
- }
91
- ]
92
- },
93
- {
94
- "transitMode": "WALK",
95
- "start": {
96
- "coords": [
97
- 48.872668,
98
- 2.343286
99
- ]
100
- },
101
- "end": {
102
- "coords": [
103
- 48.872645,
104
- 2.343447
105
- ]
106
- },
107
- "distance": 12.1,
108
- "duration": 8.6,
109
- "coords": [
110
- [
111
- 48.872668,
112
- 2.343286
113
- ],
114
- [
115
- 48.872645,
116
- 2.343447
117
- ]
118
- ],
119
- "steps": [
120
- {
121
- "number": 1,
122
- "coords": [
123
- 48.872668,
124
- 2.343286
125
- ],
126
- "angle": 1.5633735524233547,
127
- "previousBearing": 0.20645002690322387,
128
- "nextBearing": 1.7846691280696625,
129
- "distance": 12.1,
130
- "_idCoordsInLeg": 0,
131
- "duration": 8.6,
132
- "name": "Rue Bergère"
133
- },
134
- {
135
- "number": 2,
136
- "coords": [
137
- 48.872645,
138
- 2.343447
139
- ],
140
- "angle": -1.5627706491976276,
141
- "previousBearing": 1.7846691280696625,
142
- "nextBearing": 0.20584712367749708,
143
- "distance": 0,
144
- "_idCoordsInLeg": 1,
145
- "lastStep": true,
146
- "duration": 0,
147
- "name": "Rue Bergère"
148
- }
149
- ]
150
- }
151
- ]
152
- }
153
- ]
154
- }
@@ -1,179 +0,0 @@
1
- {
2
- "routerName": [
3
- "wemap-meta",
4
- "osrm",
5
- "wemap"
6
- ],
7
- "origin": {
8
- "lat": 48.8726085,
9
- "lng": 2.3434289
10
- },
11
- "destination": {
12
- "lat": 48.8725694,
13
- "lng": 2.3433
14
- },
15
- "itineraries": [
16
- {
17
- "origin": {
18
- "lat": 48.8726085,
19
- "lng": 2.3434289
20
- },
21
- "destination": {
22
- "lat": 48.8725694,
23
- "lng": 2.3433
24
- },
25
- "distance": 18.278520725857963,
26
- "duration": 13.108534922617736,
27
- "transitMode": "WALK",
28
- "legs": [
29
- {
30
- "transitMode": "WALK",
31
- "start": {
32
- "coords": [
33
- 48.872645,
34
- 2.343441
35
- ]
36
- },
37
- "end": {
38
- "coords": [
39
- 48.872668,
40
- 2.343286
41
- ]
42
- },
43
- "distance": 11.6,
44
- "duration": 8.3,
45
- "coords": [
46
- [
47
- 48.872645,
48
- 2.343441
49
- ],
50
- [
51
- 48.872668,
52
- 2.343286
53
- ]
54
- ],
55
- "steps": [
56
- {
57
- "number": 1,
58
- "coords": [
59
- 48.872645,
60
- 2.343441
61
- ],
62
- "angle": -1.5780023857062773,
63
- "previousBearing": 0.21468349401263523,
64
- "nextBearing": -1.3489067738708806,
65
- "distance": 11.6,
66
- "_idCoordsInLeg": 0,
67
- "firstStep": true,
68
- "duration": 8.3,
69
- "name": "Rue Bergère"
70
- },
71
- {
72
- "number": 2,
73
- "coords": [
74
- 48.872668,
75
- 2.343286
76
- ],
77
- "angle": -1.5553569946464223,
78
- "previousBearing": -1.3489067738708806,
79
- "nextBearing": -2.9351424328142515,
80
- "distance": 0,
81
- "_idCoordsInLeg": 1,
82
- "duration": 0,
83
- "name": "Rue Bergère"
84
- }
85
- ]
86
- },
87
- {
88
- "transitMode": "WALK",
89
- "start": {
90
- "coords": [
91
- 48.87262168252,
92
- 2.34327125172
93
- ]
94
- },
95
- "end": {
96
- "coords": [
97
- 48.8725694,
98
- 2.3433
99
- ]
100
- },
101
- "distance": 6.678520725857964,
102
- "duration": 4.808534922617734,
103
- "coords": [
104
- [
105
- 48.87262168252,
106
- 2.34327125172
107
- ],
108
- [
109
- 48.87260236152,
110
- 2.34329666635
111
- ],
112
- [
113
- 48.87259140004,
114
- 2.34329003417
115
- ],
116
- [
117
- 48.87256893059131,
118
- 2.3432943496755994
119
- ]
120
- ],
121
- "steps": [
122
- {
123
- "number": 1,
124
- "coords": [
125
- 48.87262168252,
126
- 2.34327125172
127
- ],
128
- "angle": 0.7132400301476081,
129
- "previousBearing": 0,
130
- "nextBearing": 2.4283526234421853,
131
- "distance": 2.8440530550170537,
132
- "_idCoordsInLeg": 0,
133
- "duration": 2.047718199612279
134
- },
135
- {
136
- "number": 2,
137
- "coords": [
138
- 48.87260236152,
139
- 2.34329666635
140
- ],
141
- "angle": 2.0496068325858197,
142
- "previousBearing": 2.4283526234421853,
143
- "nextBearing": -2.7628468627334275,
144
- "distance": 1.3133011641421628,
145
- "_idCoordsInLeg": 1,
146
- "duration": 0.9455768381823573
147
- },
148
- {
149
- "number": 3,
150
- "coords": [
151
- 48.87259140004,
152
- 2.34329003417
153
- ],
154
- "angle": -2.637187025030076,
155
- "previousBearing": -2.7628468627334275,
156
- "nextBearing": 3.0159328158864414,
157
- "distance": 2.521166506698747,
158
- "_idCoordsInLeg": 2,
159
- "duration": 1.815239884823098
160
- },
161
- {
162
- "number": 4,
163
- "coords": [
164
- 48.87256893059131,
165
- 2.3432943496755994
166
- ],
167
- "angle": -1.5708148043655399,
168
- "previousBearing": 3.0159328158864414,
169
- "nextBearing": 1.445154966662188,
170
- "distance": 0.41699712165318115,
171
- "_idCoordsInLeg": 3,
172
- "lastStep": true
173
- }
174
- ]
175
- }
176
- ]
177
- }
178
- ]
179
- }
@@ -1,109 +0,0 @@
1
- {
2
- "routerName": "osrm",
3
- "origin": {
4
- "lat": 48.8726513,
5
- "lng": 2.343449
6
- },
7
- "destination": {
8
- "lat": 48.8726397,
9
- "lng": 2.3431657
10
- },
11
- "itineraries": [
12
- {
13
- "origin": {
14
- "lat": 48.8726513,
15
- "lng": 2.343449
16
- },
17
- "destination": {
18
- "lat": 48.8726397,
19
- "lng": 2.3431657
20
- },
21
- "distance": 29.8,
22
- "duration": 23.5,
23
- "transitMode": "WALK",
24
- "legs": [
25
- {
26
- "transitMode": "WALK",
27
- "start": {
28
- "coords": [
29
- 48.872645,
30
- 2.343447
31
- ]
32
- },
33
- "end": {
34
- "coords": [
35
- 48.872638,
36
- 2.343135
37
- ]
38
- },
39
- "distance": 29.8,
40
- "duration": 23.5,
41
- "coords": [
42
- [
43
- 48.872645,
44
- 2.343447
45
- ],
46
- [
47
- 48.872674,
48
- 2.343243
49
- ],
50
- [
51
- 48.87269,
52
- 2.343126
53
- ],
54
- [
55
- 48.872638,
56
- 2.343135
57
- ]
58
- ],
59
- "steps": [
60
- {
61
- "number": 1,
62
- "coords": [
63
- 48.872645,
64
- 2.343447
65
- ],
66
- "angle": 1.5637852097217906,
67
- "previousBearing": -2.9357455037073006,
68
- "nextBearing": -1.3579380598392976,
69
- "distance": 24,
70
- "_idCoordsInLeg": 0,
71
- "firstStep": true,
72
- "duration": 19.2,
73
- "name": "Rue Bergère"
74
- },
75
- {
76
- "number": 2,
77
- "coords": [
78
- 48.87269,
79
- 2.343126
80
- ],
81
- "angle": -1.2524513977846519,
82
- "previousBearing": -1.365802188710504,
83
- "nextBearing": 3.0282418626639407,
84
- "distance": 5.8,
85
- "_idCoordsInLeg": 2,
86
- "duration": 4.3,
87
- "name": "Rue du Faubourg Montmartre"
88
- },
89
- {
90
- "number": 3,
91
- "coords": [
92
- 48.872638,
93
- 2.343135
94
- ],
95
- "angle": -1.6001551665540745,
96
- "previousBearing": 3.0282418626639407,
97
- "nextBearing": 1.486804375628222,
98
- "distance": 0,
99
- "_idCoordsInLeg": 3,
100
- "lastStep": true,
101
- "duration": 0,
102
- "name": "Rue du Faubourg Montmartre"
103
- }
104
- ]
105
- }
106
- ]
107
- }
108
- ]
109
- }
@@ -1,47 +0,0 @@
1
- <?xml version='1.0' encoding='UTF-8'?>
2
- <osm version='0.6' generator='JOSM'>
3
- <node id='-1610618489058234' action='modify' visible='true' lat='48.87601173273' lon='2.32555037119'>
4
- <tag k='name' v='p1' />
5
- </node>
6
- <node id='-1610618489058235' action='modify' visible='true' lat='48.87597991746' lon='2.3253223214'>
7
- <tag k='name' v='p2' />
8
- </node>
9
- <node id='-1610618489058236' action='modify' visible='true' lat='48.87573599972' lon='2.32538912386'>
10
- <tag k='name' v='p3' />
11
- </node>
12
- <node id='-1610618489058237' action='modify' visible='true' lat='48.87575872503' lon='2.32561026305'>
13
- <tag k='name' v='p4' />
14
- </node>
15
- <node id='-1610618489058238' action='modify' visible='true' lat='48.87619959391' lon='2.32495145256' />
16
- <node id='-1610618489058239' action='modify' visible='true' lat='48.87625261911' lon='2.32559874539' />
17
- <node id='-1610618489058240' action='modify' visible='true' lat='48.87542996461' lon='2.32583140224' />
18
- <node id='-1610618489058241' action='modify' visible='true' lat='48.87539057382' lon='2.32522557301' />
19
- <way id='-921430905799056' action='modify' visible='true'>
20
- <nd ref='-1610618489058234' />
21
- <nd ref='-1610618489058235' />
22
- <tag k='highway' v='steps' />
23
- <tag k='level' v='0;1' />
24
- <tag k='name' v='e1' />
25
- </way>
26
- <way id='-921430905799057' action='modify' visible='true'>
27
- <nd ref='-1610618489058236' />
28
- <nd ref='-1610618489058237' />
29
- <tag k='highway' v='footway' />
30
- <tag k='name' v='e3' />
31
- </way>
32
- <way id='-921430905799058' action='modify' visible='true'>
33
- <nd ref='-1610618489058238' />
34
- <nd ref='-1610618489058239' />
35
- <nd ref='-1610618489058240' />
36
- <nd ref='-1610618489058241' />
37
- <nd ref='-1610618489058238' />
38
- <tag k='wemap:routing-bounds' v='yes' />
39
- </way>
40
- <way id='-921430905799059' action='modify' visible='true'>
41
- <nd ref='-1610618489058235' />
42
- <nd ref='-1610618489058236' />
43
- <tag k='highway' v='footway' />
44
- <tag k='level' v='0' />
45
- <tag k='name' v='e2' />
46
- </way>
47
- </osm>
@@ -1,184 +0,0 @@
1
- import { Coordinates } from '@wemap/geo';
2
- import { diffAngle, rad2deg, roundFactor } from '@wemap/maths';
3
- import ItineraryInfoManager from '../src/ItineraryInfoManager.js';
4
- import { Step } from '../src/model/Step.js';
5
-
6
- export default class InstructionManager {
7
-
8
- static useProposals = false;
9
-
10
- static getTurnInfoFromAngle(_angle: number) {
11
-
12
- let direction, directionExtra;
13
-
14
- const directionAngle = rad2deg(diffAngle(_angle, Math.PI));
15
- const directionAngleAbs = Math.abs(directionAngle);
16
- if (directionAngleAbs <= 20) {
17
- direction = 'straight';
18
- } else {
19
- direction = directionAngle > 0 ? 'left' : 'right';
20
- if (directionAngleAbs < 55) {
21
- directionExtra = 'slight';
22
- } else if (directionAngleAbs > 120) {
23
- directionExtra = 'sharp';
24
- }
25
- }
26
-
27
- return { direction, directionExtra };
28
- }
29
-
30
- static getInfoFromStep(step: Step) {
31
-
32
- let type, direction, directionExtra, levelChange;
33
-
34
- if (step.levelChange) {
35
- type = 'level-change';
36
- levelChange = step.levelChange;
37
- } else {
38
- type = 'turn';
39
- const turnInfo = InstructionManager.getTurnInfoFromAngle(step.angle);
40
- direction = turnInfo.direction;
41
- directionExtra = turnInfo.directionExtra;
42
- }
43
-
44
- return {
45
- type,
46
- direction,
47
- directionExtra,
48
- levelChange,
49
- name: step.name,
50
- indoor: step.coords.level !== null
51
- };
52
- }
53
-
54
- // eslint-disable-next-line max-statements, complexity
55
- static getInstructionFromStep(step: Step) {
56
-
57
- const { direction, directionExtra } = InstructionManager.getTurnInfoFromAngle(step.angle);
58
- const isTurn = direction !== 'straight';
59
-
60
- if (step.lastStep) {
61
- if (isTurn && direction === 'left') {
62
- return 'Your destination is on your left';
63
- } else if (isTurn && direction === 'right') {
64
- return 'Your destination is on your right';
65
- }
66
- }
67
-
68
- let suffix = '';
69
- if (step.extras?.isGate) {
70
- suffix = ` on gate ${step.name}`;
71
- } else if (step.name) {
72
- suffix = ` on ${step.name}`;
73
- }
74
-
75
- if (step.levelChange) {
76
- if (step.levelChange.direction === 'up') {
77
- if (step.levelChange.type === 'stairs') {
78
- return 'Go up the stairs';
79
- }
80
- if (step.levelChange.type === 'escalator') {
81
- return 'Go up the escalator';
82
- }
83
- if (step.levelChange.type === 'elevator') {
84
- return 'Go up the elevator';
85
- }
86
- if (step.levelChange.type === 'moving walkway') {
87
- return 'Go up the moving walkway';
88
- }
89
- if (step.levelChange.type === 'incline plane') {
90
- return 'Go up the incline plane';
91
- }
92
- return 'Go up' + suffix;
93
- }
94
- if (step.levelChange.direction === 'down') {
95
- if (step.levelChange.type === 'stairs') {
96
- return 'Go down the stairs';
97
- }
98
- if (step.levelChange.type === 'escalator') {
99
- return 'Go down the escalator';
100
- }
101
- if (step.levelChange.type === 'elevator') {
102
- return 'Go down the elevator';
103
- }
104
- if (step.levelChange.type === 'moving walkway') {
105
- return 'Go down the moving walkway';
106
- }
107
- if (step.levelChange.type === 'incline plane') {
108
- return 'Go down the incline plane';
109
- }
110
- return 'Go down' + suffix;
111
- }
112
- if (step.extras?.subwayEntrance) {
113
- return `Take exit ${step.extras.subwayEntranceRef}`;
114
- }
115
- }
116
-
117
- if (isTurn) {
118
- if (direction === 'left') {
119
- if (directionExtra === 'slight') {
120
- return 'Turn slightly left' + suffix;
121
- }
122
- return 'Turn left' + suffix;
123
- }
124
- if (direction === 'right') {
125
- if (directionExtra === 'slight') {
126
- return 'Turn slightly right' + suffix;
127
- }
128
- return 'Turn right' + suffix;
129
- }
130
- }
131
-
132
- return 'Continue straight';
133
- }
134
-
135
-
136
-
137
- static getInstructionFromPosition(itineraryInfoManager: ItineraryInfoManager, position: Coordinates) {
138
- const itineraryInfo = itineraryInfoManager.getInfo(position);
139
- if (!itineraryInfo) {
140
- return null;
141
- }
142
-
143
- // If distance between itinerary and position is too far,
144
- // something went wrong. (mapmatching.maxDistance)
145
- if (this.useProposals && itineraryInfo.projection.distanceFromNearestElement > 15) {
146
- return 'It seems that we are a little bit lost, please start again the localization process';
147
- }
148
-
149
- const { nextStep } = itineraryInfo;
150
- if (!nextStep) {
151
- return 'You are arrived';
152
- }
153
-
154
- const distNextStep = position.distanceTo(nextStep.coords);
155
- const distRounded = roundFactor(distNextStep, 5);
156
-
157
- if (this.useProposals && distNextStep > 10) {
158
- return `Continue straight for ${distRounded}m`;
159
- }
160
-
161
-
162
- let instruction = InstructionManager.getInstructionFromStep(nextStep);
163
-
164
- const stepWithImportantInfo = itineraryInfoManager._steps.find(step => step.levelChange
165
- && step.number > nextStep.number
166
- && step.coords.distanceTo(nextStep.coords) < 10
167
- ) || null;
168
-
169
- if (stepWithImportantInfo && stepWithImportantInfo.levelChange) {
170
- const nextBearing = nextStep.coords.bearingTo(stepWithImportantInfo.coords);
171
- const { direction } = InstructionManager.getTurnInfoFromAngle(nextBearing - nextStep.previousBearing);
172
- instruction = direction === 'straight' ? 'Continue straight' : `Turn ${direction}`;
173
- const { direction: levelDirection, type: levelType } = stepWithImportantInfo.levelChange;
174
- instruction += ` and take the ${levelType} going ${levelDirection}`;
175
- }
176
-
177
- if (distNextStep >= 5) {
178
- instruction += ` in ${distRounded}m`;
179
- }
180
-
181
- return instruction;
182
- }
183
-
184
- }