@wemap/routers 11.8.5 → 11.8.7
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/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/model/Itinerary.ts +2 -2
- package/src/remote/cityway/CitywayRemoteRouter.spec.ts +3 -3
- package/src/remote/idfm/IdfmRemoteRouter.spec.ts +1 -1
- package/src/remote/idfm/IdfmRemoteRouter.ts +2 -1
- package/src/remote/osrm/OsrmRemoteRouter.ts +1 -1
- package/src/remote/otp/OtpRemoteRouter.spec.ts +2 -2
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"directory": "packages/routers"
|
|
13
13
|
},
|
|
14
14
|
"name": "@wemap/routers",
|
|
15
|
-
"version": "11.8.
|
|
15
|
+
"version": "11.8.7",
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/wemap/wemap-modules-js/issues"
|
|
18
18
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
},
|
|
53
53
|
"./helpers/*": "./helpers/*"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "c04ebfaf659b5b6f575c6a4e77c710ffdcad0d4b"
|
|
56
56
|
}
|
package/src/model/Itinerary.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { StepsGenerationRules } from './generateSteps.js';
|
|
|
12
12
|
import { getDurationFromLength } from '../Utils.js';
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
export type ItineraryMode = '
|
|
15
|
+
export type ItineraryMode = 'MULTI' | 'CAR' | 'BIKE' | 'WALK';
|
|
16
16
|
|
|
17
17
|
export type ItineraryCommon = {
|
|
18
18
|
startTime?: number,
|
|
@@ -111,7 +111,7 @@ export default class Itinerary {
|
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
if (isPublicTransport) {
|
|
114
|
-
this._mode = '
|
|
114
|
+
this._mode = 'MULTI';
|
|
115
115
|
} else if (isDriving) {
|
|
116
116
|
this._mode = 'CAR';
|
|
117
117
|
} else if (isBicycle) {
|
|
@@ -36,7 +36,7 @@ describe('CitywayRemoteRouter - createRouterResponseFromJson', () => {
|
|
|
36
36
|
const itinerary1 = routerResponse.itineraries[0];
|
|
37
37
|
expect(itinerary1.distance).to.be.closeTo(6887, 1);
|
|
38
38
|
expect(itinerary1.duration).equal(2379);
|
|
39
|
-
expect(itinerary1.mode).equal('
|
|
39
|
+
expect(itinerary1.mode).equal('MULTI');
|
|
40
40
|
// Do not work because of the input time format
|
|
41
41
|
expect(itinerary1.startTime).equal(1620659156000);
|
|
42
42
|
expect(itinerary1.endTime).equal(1620661535000);
|
|
@@ -85,7 +85,7 @@ describe('CitywayRemoteRouter - createRouterResponseFromJson', () => {
|
|
|
85
85
|
const routerResponse = CitywayRemoteRouter.createRouterResponseFromJson(json, fakeCoords, fakeCoords);
|
|
86
86
|
routerResponse.itineraries.forEach(verifyStepsCoherence);
|
|
87
87
|
|
|
88
|
-
expect(routerResponse.itineraries[0].mode).equal('
|
|
88
|
+
expect(routerResponse.itineraries[0].mode).equal('MULTI');
|
|
89
89
|
expect(routerResponse.itineraries[0].legs[1].mode).equal('FUNICULAR');
|
|
90
90
|
});
|
|
91
91
|
|
|
@@ -109,7 +109,7 @@ describe('CitywayRemoteRouter - createRouterResponseFromJson', () => {
|
|
|
109
109
|
const routerResponse = CitywayRemoteRouter.createRouterResponseFromJson(json, fakeCoords, fakeCoords);
|
|
110
110
|
routerResponse.itineraries.forEach(verifyStepsCoherence);
|
|
111
111
|
|
|
112
|
-
expect(routerResponse.itineraries[1].mode).equal('
|
|
112
|
+
expect(routerResponse.itineraries[1].mode).equal('MULTI');
|
|
113
113
|
expect(routerResponse.itineraries[1].legs[1].mode).equal('TRAM');
|
|
114
114
|
expect(routerResponse.itineraries[1].legs[1].transportInfo?.name).equal('B');
|
|
115
115
|
});
|
|
@@ -35,7 +35,7 @@ describe('IdfmRouter - createRouterResponseFromJson', () => {
|
|
|
35
35
|
expect(itinerary1.to.equals(new Coordinates(48.877877, 2.351929))).true;
|
|
36
36
|
expect(itinerary1.distance).to.be.closeTo(5264, 1);
|
|
37
37
|
expect(itinerary1.duration).equal(1842);
|
|
38
|
-
expect(itinerary1.mode).equal('
|
|
38
|
+
expect(itinerary1.mode).equal('MULTI');
|
|
39
39
|
// Do not work because of the input time format
|
|
40
40
|
expect(itinerary1.startTime).equal(1637596640000);
|
|
41
41
|
expect(itinerary1.endTime).equal(1637598482000);
|
|
@@ -193,7 +193,8 @@ class IdfmRemoteRouter extends RemoteRouter {
|
|
|
193
193
|
|
|
194
194
|
const routerResponse = this.createRouterResponseFromJson(jsonResponse, waypoints[0], waypoints[1]);
|
|
195
195
|
|
|
196
|
-
const sameModeFound = routerResponse.itineraries.some((itinerary) => itinerary.
|
|
196
|
+
const sameModeFound = routerResponse.itineraries.some((itinerary) => itinerary.mode === mode);
|
|
197
|
+
|
|
197
198
|
if (!sameModeFound) {
|
|
198
199
|
return new RouterResponse({
|
|
199
200
|
routerName: this.rname,
|
|
@@ -268,7 +268,7 @@ class OsrmRemoteRouter extends RemoteRouter {
|
|
|
268
268
|
const routingModeCorrespondance = new Map<string, RoutingMode>();
|
|
269
269
|
routingModeCorrespondance.set('walking', 'WALK');
|
|
270
270
|
routingModeCorrespondance.set('driving', 'CAR');
|
|
271
|
-
routingModeCorrespondance.set('
|
|
271
|
+
routingModeCorrespondance.set('bike', 'BIKE');
|
|
272
272
|
const mode = routingModeCorrespondance.get(routingMode) || 'WALK';
|
|
273
273
|
|
|
274
274
|
routerResponse.itineraries = jsonRoutes.map(jsonItinerary => {
|
|
@@ -41,7 +41,7 @@ describe('OtpRouter - createRouterResponseFromJson', () => {
|
|
|
41
41
|
expect(itinerary1.startTime).equal(1614607210000);
|
|
42
42
|
expect(itinerary1.endTime).equal(1614608416000);
|
|
43
43
|
expect(itinerary1.legs.length).equal(3);
|
|
44
|
-
expect(itinerary1.mode).equal('
|
|
44
|
+
expect(itinerary1.mode).equal('MULTI');
|
|
45
45
|
|
|
46
46
|
const itinerary1leg1 = itinerary1.legs[0];
|
|
47
47
|
expect(itinerary1leg1.startTime).equal(1614607210000);
|
|
@@ -83,7 +83,7 @@ describe('OtpRouter - createRouterResponseFromJson', () => {
|
|
|
83
83
|
expect(itinerary1.to.equals(new Coordinates(45.18544, 5.73123))).true;
|
|
84
84
|
expect(itinerary1.legs.length).equal(5);
|
|
85
85
|
|
|
86
|
-
expect(itinerary1.mode).equal('
|
|
86
|
+
expect(itinerary1.mode).equal('MULTI');
|
|
87
87
|
|
|
88
88
|
expect(itinerary1.legs[0].mode).equal('WALK');
|
|
89
89
|
|