@wemap/osm 5.4.9 → 5.6.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
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/osm"
|
|
12
12
|
},
|
|
13
13
|
"name": "@wemap/osm",
|
|
14
|
-
"version": "5.
|
|
14
|
+
"version": "5.6.0",
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/wemap/wemap-modules-js/issues"
|
|
17
17
|
},
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@mapbox/polyline": "^1.1.1",
|
|
29
|
-
"@wemap/geo": "^5.
|
|
29
|
+
"@wemap/geo": "^5.6.0",
|
|
30
30
|
"@wemap/logger": "^5.0.0",
|
|
31
|
-
"@wemap/maths": "^5.
|
|
31
|
+
"@wemap/maths": "^5.6.0",
|
|
32
32
|
"saxes": "^5.0.1"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "34198502b5a59d486c6469ed539e273f13e8604e"
|
|
35
35
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable max-depth */
|
|
2
2
|
/* eslint-disable max-statements */
|
|
3
3
|
import { Coordinates } from '@wemap/geo';
|
|
4
|
-
import Logger from '@wemap/logger';
|
|
5
4
|
|
|
6
5
|
import Itinerary from '../Itinerary.js';
|
|
7
6
|
import Leg from '../Leg.js';
|
|
@@ -160,7 +159,7 @@ export function createRouterResponseFromJson(json) {
|
|
|
160
159
|
leg.steps.push(step);
|
|
161
160
|
}
|
|
162
161
|
|
|
163
|
-
} else if (leg.mode === 'BUS' || leg.mode === '
|
|
162
|
+
} else if (leg.mode === 'BUS' || leg.mode === 'TRAM' || leg.mode === 'FUNICULAR') {
|
|
164
163
|
|
|
165
164
|
leg.from = {
|
|
166
165
|
name: jsonLeg.Departure.StopPlace.Name,
|
|
@@ -171,15 +170,8 @@ export function createRouterResponseFromJson(json) {
|
|
|
171
170
|
coords: jsonToCoordinates(jsonLeg.Arrival.StopPlace.Position)
|
|
172
171
|
};
|
|
173
172
|
|
|
174
|
-
let transportName = jsonLeg.Line.Number;
|
|
175
|
-
if (leg.mode === 'TRAMWAY') {
|
|
176
|
-
leg.mode = 'TRAM';
|
|
177
|
-
// In order to remove the "TRAM " prefix.
|
|
178
|
-
transportName = transportName.substr(5);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
173
|
leg.transportInfo = {
|
|
182
|
-
name:
|
|
174
|
+
name: jsonLeg.Line.Number,
|
|
183
175
|
routeColor: jsonLeg.Line.Color,
|
|
184
176
|
routeTextColor: jsonLeg.Line.TextColor,
|
|
185
177
|
directionName: jsonLeg.Destination
|
|
@@ -205,8 +197,6 @@ export function createRouterResponseFromJson(json) {
|
|
|
205
197
|
legStep.levelChange = null;
|
|
206
198
|
legStep.distance = jsonLeg.Distance;
|
|
207
199
|
leg.steps = [legStep];
|
|
208
|
-
} else {
|
|
209
|
-
Logger.warn(`[CitywayParser] Unknown leg mode: ${leg.mode}`);
|
|
210
200
|
}
|
|
211
201
|
|
|
212
202
|
leg.distance = leg.coords.reduce((acc, coords, idx, arr) => {
|
|
@@ -93,17 +93,5 @@ describe('CitywayUtils - createRouterResponseFromJson', () => {
|
|
|
93
93
|
expect(routerResponse.itineraries[0].legs[0].mode).equal('BICYCLE');
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
it('RouterResponse - 5', () => {
|
|
97
|
-
const filePath = path.resolve(__dirname, '../../../assets/itinerary-lehavre-cityway-5.json');
|
|
98
|
-
const fileString = fs.readFileSync(filePath, 'utf8');
|
|
99
|
-
const json = JSON.parse(fileString);
|
|
100
|
-
|
|
101
|
-
const routerResponse = createRouterResponseFromJson(json);
|
|
102
|
-
verifyRouterResponseData(routerResponse);
|
|
103
|
-
|
|
104
|
-
expect(routerResponse.itineraries[1].legs[1].mode).equal('TRAM');
|
|
105
|
-
expect(routerResponse.itineraries[1].legs[1].transportInfo.name).equal('B');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
96
|
});
|
|
109
97
|
|