@wemap/providers 6.2.2 → 7.0.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/dist/wemap-providers.es.js +345 -56
- package/dist/wemap-providers.es.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { deg2rad, Vector3, Matrix, Quaternion, Matrix3, Matrix4, Vector, Rotations, std, diffAngleLines, diffAngle, rad2deg } from '@wemap/maths';
|
|
2
2
|
import { BrowserUtils, Browser, PromiseUtils, TimeUtils } from '@wemap/utils';
|
|
3
3
|
import Logger from '@wemap/logger';
|
|
4
|
-
import {
|
|
4
|
+
import { Coordinates, Network, GraphRouterOptions, Attitude, RelativePosition, Constants as Constants$2, MapMatching, UserPosition, GraphEdge, AbsoluteHeading, GeoRelativePosition as GeoRelativePosition$1, Level } from '@wemap/geo';
|
|
5
5
|
import geomagnetism from '@wemap/geomagnetism';
|
|
6
6
|
import '@wemap/osm';
|
|
7
7
|
import { SharedCameras, Camera, CameraUtils } from '@wemap/camera';
|
|
@@ -917,28 +917,22 @@ class LevelChange {
|
|
|
917
917
|
type = null;
|
|
918
918
|
|
|
919
919
|
/**
|
|
920
|
-
* @param {
|
|
921
|
-
* @param {
|
|
922
|
-
* @returns {
|
|
920
|
+
* @param {LevelChange} obj1
|
|
921
|
+
* @param {LevelChange} obj2
|
|
922
|
+
* @returns {Boolean}
|
|
923
923
|
*/
|
|
924
|
-
static
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
if (edge.builtFrom.isElevator) {
|
|
931
|
-
levelChange.type = 'elevator';
|
|
932
|
-
} else if (edge.builtFrom.isConveying) {
|
|
933
|
-
levelChange.type = 'conveyor';
|
|
934
|
-
} else if (edge.builtFrom.areStairs) {
|
|
935
|
-
levelChange.type = 'stairs';
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
levelChange.difference = Level.diff(firstNode.coords.level, secondNode.coords.level);
|
|
939
|
-
levelChange.direction = levelChange.difference > 0 ? 'up' : 'down';
|
|
924
|
+
static equalsTo(obj1, obj2) {
|
|
925
|
+
return obj1.difference === obj2.difference
|
|
926
|
+
&& obj1.direction === obj2.direction
|
|
927
|
+
&& obj1.type === obj2.type;
|
|
928
|
+
}
|
|
940
929
|
|
|
941
|
-
|
|
930
|
+
/**
|
|
931
|
+
* @param {LevelChange} obj
|
|
932
|
+
* @returns {Boolean}
|
|
933
|
+
*/
|
|
934
|
+
equalsTo(obj) {
|
|
935
|
+
return LevelChange.equalsTo(this, obj);
|
|
942
936
|
}
|
|
943
937
|
|
|
944
938
|
/**
|
|
@@ -1009,6 +1003,45 @@ class Step {
|
|
|
1009
1003
|
/** @type {!number} */
|
|
1010
1004
|
_idCoordsInLeg = null;
|
|
1011
1005
|
|
|
1006
|
+
/**
|
|
1007
|
+
* @param {Step} obj1
|
|
1008
|
+
* @param {Step} obj2
|
|
1009
|
+
* @returns {Boolean}
|
|
1010
|
+
*/
|
|
1011
|
+
static equalsTo(obj1, obj2) {
|
|
1012
|
+
return obj1.firstStep === obj2.firstStep
|
|
1013
|
+
&& obj1.lastStep === obj2.lastStep
|
|
1014
|
+
&& obj1.number === obj2.number
|
|
1015
|
+
&& obj1.coords.equalsTo(obj2.coords)
|
|
1016
|
+
&& obj1.angle === obj2.angle
|
|
1017
|
+
&& obj1.previousBearing === obj2.previousBearing
|
|
1018
|
+
&& obj1.nextBearing === obj2.nextBearing
|
|
1019
|
+
&& obj1.distance === obj2.distance
|
|
1020
|
+
&& obj1.duration === obj2.duration
|
|
1021
|
+
&& obj1.name === obj2.name
|
|
1022
|
+
&& (
|
|
1023
|
+
obj1.levelChange === obj2.levelChange
|
|
1024
|
+
|| obj1.levelChange !== null && obj1.levelChange.equalsTo(obj2.levelChange)
|
|
1025
|
+
)
|
|
1026
|
+
&& (
|
|
1027
|
+
obj1.extras === obj2.extras
|
|
1028
|
+
|| (
|
|
1029
|
+
obj1.extras !== null
|
|
1030
|
+
&& obj1.extras.subwayEntrance === obj2.extras.subwayEntrance
|
|
1031
|
+
&& obj1.extras.subwayEntranceRef === obj2.extras.subwayEntranceRef
|
|
1032
|
+
)
|
|
1033
|
+
)
|
|
1034
|
+
&& obj1._idCoordsInLeg === obj2._idCoordsInLeg;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* @param {Step} obj
|
|
1039
|
+
* @returns {Boolean}
|
|
1040
|
+
*/
|
|
1041
|
+
equalsTo(obj) {
|
|
1042
|
+
return Step.equalsTo(this, obj);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1012
1045
|
/**
|
|
1013
1046
|
* @returns {object}
|
|
1014
1047
|
*/
|
|
@@ -1056,31 +1089,62 @@ class Step {
|
|
|
1056
1089
|
step.nextBearing = json.nextBearing;
|
|
1057
1090
|
step.distance = json.distance;
|
|
1058
1091
|
step._idCoordsInLeg = json._idCoordsInLeg;
|
|
1059
|
-
if (json.firstStep) {
|
|
1092
|
+
if (typeof json.firstStep === 'boolean') {
|
|
1060
1093
|
step.firstStep = json.firstStep;
|
|
1061
1094
|
}
|
|
1062
|
-
if (json.lastStep) {
|
|
1095
|
+
if (typeof json.lastStep === 'boolean') {
|
|
1063
1096
|
step.lastStep = json.lastStep;
|
|
1064
1097
|
}
|
|
1065
|
-
if (json.duration) {
|
|
1098
|
+
if (typeof json.duration === 'number') {
|
|
1066
1099
|
step.duration = json.duration;
|
|
1067
1100
|
}
|
|
1068
|
-
if (json.name) {
|
|
1101
|
+
if (typeof json.name === 'string') {
|
|
1069
1102
|
step.name = json.name;
|
|
1070
1103
|
}
|
|
1071
|
-
if (json.levelChange) {
|
|
1104
|
+
if (typeof json.levelChange === 'object') {
|
|
1072
1105
|
step.levelChange = LevelChange.fromJson(json.levelChange);
|
|
1073
1106
|
}
|
|
1074
|
-
if (json.extras) {
|
|
1107
|
+
if (typeof json.extras === 'object') {
|
|
1075
1108
|
step.extras = json.extras;
|
|
1076
1109
|
}
|
|
1077
1110
|
return step;
|
|
1078
1111
|
}
|
|
1079
1112
|
}
|
|
1080
1113
|
|
|
1114
|
+
const Constants$1 = {};
|
|
1115
|
+
|
|
1116
|
+
Constants$1.ROUTING_MODE = {
|
|
1117
|
+
AIRPLANE: 'AIRPLANE',
|
|
1118
|
+
BOAT: 'BOAT',
|
|
1119
|
+
BIKE: 'BIKE',
|
|
1120
|
+
BUS: 'BUS',
|
|
1121
|
+
CAR: 'CAR',
|
|
1122
|
+
FERRY: 'FERRY',
|
|
1123
|
+
FUNICULAR: 'FUNICULAR',
|
|
1124
|
+
METRO: 'METRO',
|
|
1125
|
+
MOTO: 'MOTO',
|
|
1126
|
+
TRAIN: 'TRAIN',
|
|
1127
|
+
TAXI: 'TAXI',
|
|
1128
|
+
TRAM: 'TRAM',
|
|
1129
|
+
WALK: 'WALK',
|
|
1130
|
+
MULTI: 'MULTI',
|
|
1131
|
+
UNKNOWN: 'UNKNOWN'
|
|
1132
|
+
};
|
|
1133
|
+
|
|
1134
|
+
Constants$1.PUBLIC_TRANSPORT = [
|
|
1135
|
+
Constants$1.ROUTING_MODE.AIRPLANE,
|
|
1136
|
+
Constants$1.ROUTING_MODE.BOAT,
|
|
1137
|
+
Constants$1.ROUTING_MODE.BUS,
|
|
1138
|
+
Constants$1.ROUTING_MODE.FERRY,
|
|
1139
|
+
Constants$1.ROUTING_MODE.FUNICULAR,
|
|
1140
|
+
Constants$1.ROUTING_MODE.METRO,
|
|
1141
|
+
Constants$1.ROUTING_MODE.TRAIN,
|
|
1142
|
+
Constants$1.ROUTING_MODE.TRAM
|
|
1143
|
+
];
|
|
1144
|
+
|
|
1081
1145
|
class Leg {
|
|
1082
1146
|
|
|
1083
|
-
/** @type {!string} can be
|
|
1147
|
+
/** @type {!string} can be values in Constants.ROUTING_MODE */
|
|
1084
1148
|
mode;
|
|
1085
1149
|
|
|
1086
1150
|
/** @type {!number} */
|
|
@@ -1110,6 +1174,10 @@ class Leg {
|
|
|
1110
1174
|
/** @type {?(Step[])} */
|
|
1111
1175
|
steps = null;
|
|
1112
1176
|
|
|
1177
|
+
isPublicTransport() {
|
|
1178
|
+
return Constants$1.PUBLIC_TRANSPORT.includes(this.mode);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1113
1181
|
/**
|
|
1114
1182
|
* @returns {Network}
|
|
1115
1183
|
*/
|
|
@@ -1117,6 +1185,72 @@ class Leg {
|
|
|
1117
1185
|
return Network.fromCoordinates([this.coords]);
|
|
1118
1186
|
}
|
|
1119
1187
|
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* @param {Leg} obj1
|
|
1191
|
+
* @param {Leg} obj2
|
|
1192
|
+
* @returns {Boolean}
|
|
1193
|
+
*/
|
|
1194
|
+
// eslint-disable-next-line complexity
|
|
1195
|
+
static equalsTo(obj1, obj2) {
|
|
1196
|
+
const intermediate = obj1.mode === obj2.mode
|
|
1197
|
+
&& obj1.distance === obj2.distance
|
|
1198
|
+
&& obj1.duration === obj2.duration
|
|
1199
|
+
&& obj1.startTime === obj2.startTime
|
|
1200
|
+
&& obj1.endTime === obj2.endTime
|
|
1201
|
+
&& obj1.from.name === obj2.from.name
|
|
1202
|
+
&& obj1.from.coords.equalsTo(obj2.from.coords)
|
|
1203
|
+
&& obj1.to.name === obj2.to.name
|
|
1204
|
+
&& obj1.to.coords.equalsTo(obj2.to.coords)
|
|
1205
|
+
&& obj1.coords.length === obj2.coords.length
|
|
1206
|
+
&& (
|
|
1207
|
+
obj1.steps === obj2.steps
|
|
1208
|
+
|| obj1.steps.length === obj2.steps.length
|
|
1209
|
+
);
|
|
1210
|
+
|
|
1211
|
+
if (!intermediate) {
|
|
1212
|
+
return false;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
let i;
|
|
1216
|
+
for (i = 0; i < obj1.coords.length; i++) {
|
|
1217
|
+
if (!obj1.coords[i].equalsTo(obj2.coords[i])) {
|
|
1218
|
+
return false;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
if (obj1.steps) {
|
|
1222
|
+
for (i = 0; i < obj1.steps.length; i++) {
|
|
1223
|
+
if (!obj1.steps[i].equalsTo(obj2.steps[i])) {
|
|
1224
|
+
return false;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
if (obj1.transportInfo !== obj2.transportInfo) {
|
|
1230
|
+
if (obj1.transportInfo === null) {
|
|
1231
|
+
return false;
|
|
1232
|
+
}
|
|
1233
|
+
if (
|
|
1234
|
+
obj1.transportInfo.name !== obj2.transportInfo.name
|
|
1235
|
+
|| obj1.transportInfo.routeColor !== obj2.transportInfo.routeColor
|
|
1236
|
+
|| obj1.transportInfo.routeTextColor !== obj2.transportInfo.routeTextColor
|
|
1237
|
+
|| obj1.transportInfo.directionName !== obj2.transportInfo.directionName
|
|
1238
|
+
) {
|
|
1239
|
+
return false;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
return true;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* @param {Leg} obj
|
|
1248
|
+
* @returns {Boolean}
|
|
1249
|
+
*/
|
|
1250
|
+
equalsTo(obj) {
|
|
1251
|
+
return Leg.equalsTo(this, obj);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1120
1254
|
/**
|
|
1121
1255
|
* @returns {object}
|
|
1122
1256
|
*/
|
|
@@ -1129,18 +1263,18 @@ class Leg {
|
|
|
1129
1263
|
duration: this.duration,
|
|
1130
1264
|
coords: this.coords.map(coords => coords.toCompressedJson())
|
|
1131
1265
|
};
|
|
1132
|
-
if (this.from.name) {
|
|
1133
|
-
output.from.name = this.from.name;
|
|
1134
|
-
}
|
|
1135
|
-
if (this.to.name) {
|
|
1136
|
-
output.to.name = this.to.name;
|
|
1137
|
-
}
|
|
1138
1266
|
if (this.startTime !== null) {
|
|
1139
1267
|
output.startTime = this.startTime;
|
|
1140
1268
|
}
|
|
1141
1269
|
if (this.endTime !== null) {
|
|
1142
1270
|
output.endTime = this.endTime;
|
|
1143
1271
|
}
|
|
1272
|
+
if (this.from.name !== null) {
|
|
1273
|
+
output.from.name = this.from.name;
|
|
1274
|
+
}
|
|
1275
|
+
if (this.to.name !== null) {
|
|
1276
|
+
output.to.name = this.to.name;
|
|
1277
|
+
}
|
|
1144
1278
|
if (this.transportInfo !== null) {
|
|
1145
1279
|
output.transportInfo = this.transportInfo;
|
|
1146
1280
|
}
|
|
@@ -1158,27 +1292,31 @@ class Leg {
|
|
|
1158
1292
|
static fromJson(json) {
|
|
1159
1293
|
const leg = new Leg();
|
|
1160
1294
|
leg.mode = json.mode;
|
|
1161
|
-
leg.from = { coords: Coordinates.fromCompressedJson(json.from.coords) };
|
|
1162
|
-
leg.to = { coords: Coordinates.fromCompressedJson(json.to.coords) };
|
|
1163
1295
|
leg.distance = json.distance;
|
|
1164
1296
|
leg.duration = json.duration;
|
|
1165
|
-
|
|
1166
|
-
if (json.
|
|
1167
|
-
leg.from.name = json.from.name;
|
|
1168
|
-
}
|
|
1169
|
-
if (json.to.name) {
|
|
1170
|
-
leg.to.name = json.to.name;
|
|
1171
|
-
}
|
|
1172
|
-
if (json.startTime) {
|
|
1297
|
+
|
|
1298
|
+
if (typeof json.startTime === 'number') {
|
|
1173
1299
|
leg.startTime = json.startTime;
|
|
1174
1300
|
}
|
|
1175
|
-
if (json.endTime) {
|
|
1301
|
+
if (typeof json.endTime === 'number') {
|
|
1176
1302
|
leg.endTime = json.endTime;
|
|
1177
1303
|
}
|
|
1178
|
-
|
|
1304
|
+
|
|
1305
|
+
leg.from = {
|
|
1306
|
+
coords: Coordinates.fromCompressedJson(json.from.coords),
|
|
1307
|
+
name: typeof json.from.name === 'string' ? json.from.name : null
|
|
1308
|
+
};
|
|
1309
|
+
leg.to = {
|
|
1310
|
+
coords: Coordinates.fromCompressedJson(json.to.coords),
|
|
1311
|
+
name: typeof json.to.name === 'string' ? json.to.name : null
|
|
1312
|
+
};
|
|
1313
|
+
|
|
1314
|
+
leg.coords = json.coords.map(Coordinates.fromCompressedJson);
|
|
1315
|
+
|
|
1316
|
+
if (typeof json.transportInfo === 'object') {
|
|
1179
1317
|
leg.transportInfo = json.transportInfo;
|
|
1180
1318
|
}
|
|
1181
|
-
if (json.steps) {
|
|
1319
|
+
if (typeof json.steps === 'object') {
|
|
1182
1320
|
leg.steps = json.steps.map(Step.fromJson);
|
|
1183
1321
|
}
|
|
1184
1322
|
return leg;
|
|
@@ -1266,14 +1404,14 @@ class Itinerary {
|
|
|
1266
1404
|
|
|
1267
1405
|
get mode() {
|
|
1268
1406
|
if (!this._mode) {
|
|
1269
|
-
let isPublicTransport;
|
|
1270
|
-
let isBicycle;
|
|
1271
|
-
let isDriving;
|
|
1407
|
+
let isPublicTransport = false;
|
|
1408
|
+
let isBicycle = false;
|
|
1409
|
+
let isDriving = false;
|
|
1272
1410
|
|
|
1273
1411
|
this.legs.forEach((leg) => {
|
|
1274
|
-
isPublicTransport = isPublicTransport ||
|
|
1275
|
-
isBicycle = isBicycle ||
|
|
1276
|
-
isDriving = isDriving || leg.mode ===
|
|
1412
|
+
isPublicTransport = isPublicTransport || Constants$1.PUBLIC_TRANSPORT.includes(leg.mode);
|
|
1413
|
+
isBicycle = isBicycle || leg.mode === Constants$1.ROUTING_MODE.BIKE;
|
|
1414
|
+
isDriving = isDriving || leg.mode === Constants$1.ROUTING_MODE.CAR;
|
|
1277
1415
|
});
|
|
1278
1416
|
|
|
1279
1417
|
if (isPublicTransport) {
|
|
@@ -1381,6 +1519,42 @@ class Itinerary {
|
|
|
1381
1519
|
return itinerary;
|
|
1382
1520
|
}
|
|
1383
1521
|
|
|
1522
|
+
|
|
1523
|
+
/**
|
|
1524
|
+
* @param {Itinerary} obj1
|
|
1525
|
+
* @param {Itinerary} obj2
|
|
1526
|
+
* @returns {Boolean}
|
|
1527
|
+
*/
|
|
1528
|
+
static equalsTo(obj1, obj2) {
|
|
1529
|
+
const intermediate = obj1.from.equalsTo(obj2.from)
|
|
1530
|
+
&& obj1.to.equalsTo(obj2.to)
|
|
1531
|
+
&& obj1.distance === obj2.distance
|
|
1532
|
+
&& obj1.duration === obj2.duration
|
|
1533
|
+
&& obj1.startTime === obj2.startTime
|
|
1534
|
+
&& obj1.endTime === obj2.endTime
|
|
1535
|
+
&& obj1.legs.length === obj2.legs.length;
|
|
1536
|
+
|
|
1537
|
+
if (!intermediate) {
|
|
1538
|
+
return false;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
for (let i = 0; i < obj1.legs.length; i++) {
|
|
1542
|
+
if (!obj1.legs[i].equalsTo(obj2.legs[i])) {
|
|
1543
|
+
return false;
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
return true;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
/**
|
|
1551
|
+
* @param {Itinerary} obj
|
|
1552
|
+
* @returns {Boolean}
|
|
1553
|
+
*/
|
|
1554
|
+
equalsTo(obj) {
|
|
1555
|
+
return Itinerary.equalsTo(this, obj);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1384
1558
|
/**
|
|
1385
1559
|
* @returns {object}
|
|
1386
1560
|
*/
|
|
@@ -1413,10 +1587,10 @@ class Itinerary {
|
|
|
1413
1587
|
itinerary.distance = json.distance;
|
|
1414
1588
|
itinerary.duration = json.duration;
|
|
1415
1589
|
itinerary.legs = json.legs.map(Leg.fromJson);
|
|
1416
|
-
if (json.startTime) {
|
|
1590
|
+
if (typeof json.startTime === 'number') {
|
|
1417
1591
|
itinerary.startTime = json.startTime;
|
|
1418
1592
|
}
|
|
1419
|
-
if (json.endTime) {
|
|
1593
|
+
if (typeof json.endTime === 'number') {
|
|
1420
1594
|
itinerary.endTime = json.endTime;
|
|
1421
1595
|
}
|
|
1422
1596
|
return itinerary;
|
|
@@ -1455,6 +1629,18 @@ class WemapRouterOptions extends GraphRouterOptions {
|
|
|
1455
1629
|
|
|
1456
1630
|
deg2rad(20);
|
|
1457
1631
|
|
|
1632
|
+
/* eslint-disable max-statements */
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* Input mode correspondance
|
|
1636
|
+
*/
|
|
1637
|
+
const inputModeCorrespondance$2 = new Map();
|
|
1638
|
+
inputModeCorrespondance$2.set(Constants$1.ROUTING_MODE.CAR, 'driving');
|
|
1639
|
+
inputModeCorrespondance$2.set(Constants$1.ROUTING_MODE.WALK, 'walking');
|
|
1640
|
+
inputModeCorrespondance$2.set(Constants$1.ROUTING_MODE.BIKE, 'bike');
|
|
1641
|
+
inputModeCorrespondance$2.set(Constants$1.ROUTING_MODE.BUS, 'bus');
|
|
1642
|
+
inputModeCorrespondance$2.set(Constants$1.ROUTING_MODE.MULTI, 'walking');
|
|
1643
|
+
|
|
1458
1644
|
function createCommonjsModule(fn) {
|
|
1459
1645
|
var module = { exports: {} };
|
|
1460
1646
|
return fn(module, module.exports), module.exports;
|
|
@@ -1623,6 +1809,109 @@ if (module.exports) {
|
|
|
1623
1809
|
}
|
|
1624
1810
|
});
|
|
1625
1811
|
|
|
1812
|
+
/* eslint-disable max-statements */
|
|
1813
|
+
|
|
1814
|
+
/**
|
|
1815
|
+
* Input mode correspondance
|
|
1816
|
+
*/
|
|
1817
|
+
const inputModeCorrespondance$1 = new Map();
|
|
1818
|
+
inputModeCorrespondance$1.set(Constants$1.ROUTING_MODE.CAR, 'CAR');
|
|
1819
|
+
inputModeCorrespondance$1.set(Constants$1.ROUTING_MODE.WALK, 'WALK');
|
|
1820
|
+
inputModeCorrespondance$1.set(Constants$1.ROUTING_MODE.BIKE, 'BICYCLE');
|
|
1821
|
+
inputModeCorrespondance$1.set(Constants$1.ROUTING_MODE.BUS, 'WALK,TRANSIT');
|
|
1822
|
+
inputModeCorrespondance$1.set(Constants$1.ROUTING_MODE.MULTI, 'WALK,TRANSIT');
|
|
1823
|
+
|
|
1824
|
+
/* eslint-disable max-depth */
|
|
1825
|
+
|
|
1826
|
+
/**
|
|
1827
|
+
* Input mode correspondance
|
|
1828
|
+
*/
|
|
1829
|
+
const inputModeCorrespondance = new Map();
|
|
1830
|
+
inputModeCorrespondance.set(Constants$1.ROUTING_MODE.CAR, 'Car');
|
|
1831
|
+
inputModeCorrespondance.set(Constants$1.ROUTING_MODE.WALK, 'Walk');
|
|
1832
|
+
inputModeCorrespondance.set(Constants$1.ROUTING_MODE.BIKE, 'Bike');
|
|
1833
|
+
inputModeCorrespondance.set(Constants$1.ROUTING_MODE.BUS, 'PT');
|
|
1834
|
+
inputModeCorrespondance.set(Constants$1.ROUTING_MODE.MULTI, 'PT');
|
|
1835
|
+
|
|
1836
|
+
|
|
1837
|
+
/**
|
|
1838
|
+
* List of all routing modes supported by the API
|
|
1839
|
+
*/
|
|
1840
|
+
const routingModeCorrespondance$1 = new Map();
|
|
1841
|
+
routingModeCorrespondance$1.set('WALK', Constants$1.ROUTING_MODE.WALK);
|
|
1842
|
+
routingModeCorrespondance$1.set('BICYCLE', Constants$1.ROUTING_MODE.BIKE);
|
|
1843
|
+
routingModeCorrespondance$1.set('TRAMWAY', Constants$1.ROUTING_MODE.TRAM);
|
|
1844
|
+
routingModeCorrespondance$1.set('METRO', Constants$1.ROUTING_MODE.METRO);
|
|
1845
|
+
routingModeCorrespondance$1.set('FUNICULAR', Constants$1.ROUTING_MODE.FUNICULAR);
|
|
1846
|
+
routingModeCorrespondance$1.set('BUS', Constants$1.ROUTING_MODE.BUS);
|
|
1847
|
+
routingModeCorrespondance$1.set('COACH', Constants$1.ROUTING_MODE.BUS);
|
|
1848
|
+
routingModeCorrespondance$1.set('SCHOOL', Constants$1.ROUTING_MODE.BUS);
|
|
1849
|
+
routingModeCorrespondance$1.set('BUS_PMR', Constants$1.ROUTING_MODE.BUS);
|
|
1850
|
+
routingModeCorrespondance$1.set('MINIBUS', Constants$1.ROUTING_MODE.BUS);
|
|
1851
|
+
routingModeCorrespondance$1.set('TROLLEY_BUS', Constants$1.ROUTING_MODE.BUS);
|
|
1852
|
+
routingModeCorrespondance$1.set('TAXIBUS', Constants$1.ROUTING_MODE.BUS);
|
|
1853
|
+
routingModeCorrespondance$1.set('SHUTTLE', Constants$1.ROUTING_MODE.BUS);
|
|
1854
|
+
routingModeCorrespondance$1.set('TRAIN', Constants$1.ROUTING_MODE.TRAIN);
|
|
1855
|
+
routingModeCorrespondance$1.set('HST', Constants$1.ROUTING_MODE.TRAIN);
|
|
1856
|
+
routingModeCorrespondance$1.set('LOCAL_TRAIN', Constants$1.ROUTING_MODE.TRAIN);
|
|
1857
|
+
routingModeCorrespondance$1.set('AIR', Constants$1.ROUTING_MODE.AIRPLANE);
|
|
1858
|
+
routingModeCorrespondance$1.set('FERRY', Constants$1.ROUTING_MODE.BOAT);
|
|
1859
|
+
routingModeCorrespondance$1.set('TAXI', Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1860
|
+
routingModeCorrespondance$1.set('CAR_POOL', Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1861
|
+
routingModeCorrespondance$1.set('PRIVATE_VEHICLE', Constants$1.ROUTING_MODE.CAR);
|
|
1862
|
+
routingModeCorrespondance$1.set('SCOOTER', Constants$1.ROUTING_MODE.MOTO);
|
|
1863
|
+
|
|
1864
|
+
/**
|
|
1865
|
+
* List of all plan trip supported by the API
|
|
1866
|
+
* Routing mode UNKNOWN means that the itinerary will not be parsed by the router
|
|
1867
|
+
*/
|
|
1868
|
+
const planTripType = new Map();
|
|
1869
|
+
planTripType.set(0, Constants$1.ROUTING_MODE.BUS);
|
|
1870
|
+
planTripType.set(1, Constants$1.ROUTING_MODE.WALK);
|
|
1871
|
+
planTripType.set(2, Constants$1.ROUTING_MODE.BIKE);
|
|
1872
|
+
planTripType.set(3, Constants$1.ROUTING_MODE.CAR);
|
|
1873
|
+
planTripType.set(4, Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1874
|
+
planTripType.set(5, Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1875
|
+
planTripType.set(6, Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1876
|
+
planTripType.set(7, Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1877
|
+
planTripType.set(8, Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1878
|
+
planTripType.set(9, Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1879
|
+
planTripType.set(10, Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1880
|
+
planTripType.set(11, Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1881
|
+
planTripType.set(12, Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1882
|
+
planTripType.set(13, Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1883
|
+
planTripType.set(14, Constants$1.ROUTING_MODE.UNKNOWN);
|
|
1884
|
+
|
|
1885
|
+
/* eslint-disable max-statements */
|
|
1886
|
+
|
|
1887
|
+
/**
|
|
1888
|
+
* List of all modes supported by the API
|
|
1889
|
+
* http://doc.navitia.io/#physical-mode
|
|
1890
|
+
*/
|
|
1891
|
+
|
|
1892
|
+
const routingModeCorrespondance = new Map();
|
|
1893
|
+
routingModeCorrespondance.set('Air', Constants$1.ROUTING_MODE.AIRPLANE);
|
|
1894
|
+
routingModeCorrespondance.set('Boat', Constants$1.ROUTING_MODE.BOAT);
|
|
1895
|
+
routingModeCorrespondance.set('Bus', Constants$1.ROUTING_MODE.BUS);
|
|
1896
|
+
routingModeCorrespondance.set('BusRapidTransit', Constants$1.ROUTING_MODE.BUS);
|
|
1897
|
+
routingModeCorrespondance.set('Coach', Constants$1.ROUTING_MODE.BUS);
|
|
1898
|
+
routingModeCorrespondance.set('Ferry', Constants$1.ROUTING_MODE.FERRY);
|
|
1899
|
+
routingModeCorrespondance.set('Funicular', Constants$1.ROUTING_MODE.FUNICULAR);
|
|
1900
|
+
routingModeCorrespondance.set('LocalTrain', Constants$1.ROUTING_MODE.TRAIN);
|
|
1901
|
+
routingModeCorrespondance.set('LongDistanceTrain', Constants$1.ROUTING_MODE.TRAIN);
|
|
1902
|
+
routingModeCorrespondance.set('Metro', Constants$1.ROUTING_MODE.METRO);
|
|
1903
|
+
routingModeCorrespondance.set('Métro', Constants$1.ROUTING_MODE.METRO);
|
|
1904
|
+
routingModeCorrespondance.set('RailShuttle', Constants$1.ROUTING_MODE.TRAIN);
|
|
1905
|
+
routingModeCorrespondance.set('RapidTransit', Constants$1.ROUTING_MODE.BUS);
|
|
1906
|
+
routingModeCorrespondance.set('Shuttle', Constants$1.ROUTING_MODE.BUS);
|
|
1907
|
+
routingModeCorrespondance.set('SuspendedCableCar', Constants$1.ROUTING_MODE.FUNICULAR);
|
|
1908
|
+
routingModeCorrespondance.set('Taxi', Constants$1.ROUTING_MODE.TAXI);
|
|
1909
|
+
routingModeCorrespondance.set('Train', Constants$1.ROUTING_MODE.TRAIN);
|
|
1910
|
+
routingModeCorrespondance.set('RER', Constants$1.ROUTING_MODE.TRAIN);
|
|
1911
|
+
routingModeCorrespondance.set('Tramway', Constants$1.ROUTING_MODE.TRAM);
|
|
1912
|
+
routingModeCorrespondance.set('walking', Constants$1.ROUTING_MODE.WALK);
|
|
1913
|
+
routingModeCorrespondance.set('bike', Constants$1.ROUTING_MODE.BIKE);
|
|
1914
|
+
|
|
1626
1915
|
const DEFAULT_RELATIVE_NOISES = {
|
|
1627
1916
|
acc: 0.5,
|
|
1628
1917
|
gyr: 0.3
|
|
@@ -2685,7 +2974,7 @@ class StepDetector extends Provider {
|
|
|
2685
2974
|
// Linear acceleration in ENU
|
|
2686
2975
|
static computeLinearAcceleration(quaternion, acc) {
|
|
2687
2976
|
const linearAcc = Quaternion.rotate(Quaternion.inverse(quaternion), acc);
|
|
2688
|
-
linearAcc[2] -= Constants$
|
|
2977
|
+
linearAcc[2] -= Constants$2.EARTH_GRAVITY;
|
|
2689
2978
|
return linearAcc;
|
|
2690
2979
|
}
|
|
2691
2980
|
}
|