@opentripplanner/core-utils 4.8.1-alpha → 4.9.0-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.
- package/esm/deprecated.js +309 -0
- package/esm/deprecated.js.map +1 -0
- package/esm/itinerary.js +16 -247
- package/esm/itinerary.js.map +1 -1
- package/esm/map.js +9 -25
- package/esm/map.js.map +1 -1
- package/esm/messages.js +4 -0
- package/esm/messages.js.map +1 -1
- package/esm/profile.js +7 -12
- package/esm/profile.js.map +1 -1
- package/esm/query-params.js +10 -7
- package/esm/query-params.js.map +1 -1
- package/esm/query.js +4 -19
- package/esm/query.js.map +1 -1
- package/esm/time.js +11 -4
- package/esm/time.js.map +1 -1
- package/lib/deprecated.js +338 -0
- package/lib/deprecated.js.map +1 -0
- package/lib/itinerary.js +64 -258
- package/lib/itinerary.js.map +1 -1
- package/lib/map.js +26 -32
- package/lib/map.js.map +1 -1
- package/lib/messages.js +5 -0
- package/lib/messages.js.map +1 -1
- package/lib/profile.js +7 -12
- package/lib/profile.js.map +1 -1
- package/lib/query-params.js +11 -6
- package/lib/query-params.js.map +1 -1
- package/lib/query.js +9 -14
- package/lib/query.js.map +1 -1
- package/lib/time.js +11 -4
- package/lib/time.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/query-params.js.snap +1 -1
- package/src/__tests__/__snapshots__/query.js.snap +6 -6
- package/src/deprecated.js +310 -0
- package/src/itinerary.js +33 -221
- package/src/map.js +13 -25
- package/src/messages.js +4 -0
- package/src/profile.js +6 -16
- package/src/query-params.js +13 -5
- package/src/query.js +6 -26
- package/src/time.js +9 -4
package/lib/itinerary.js
CHANGED
|
@@ -25,32 +25,76 @@ exports.hasMicromobility = hasMicromobility;
|
|
|
25
25
|
exports.hasHail = hasHail;
|
|
26
26
|
exports.hasRental = hasRental;
|
|
27
27
|
exports.getMapColor = getMapColor;
|
|
28
|
-
exports.getStepDirection = getStepDirection;
|
|
29
|
-
exports.getStepInstructions = getStepInstructions;
|
|
30
|
-
exports.getStepStreetName = getStepStreetName;
|
|
31
28
|
exports.toSentenceCase = toSentenceCase;
|
|
32
29
|
exports.getCompanyFromLeg = getCompanyFromLeg;
|
|
33
|
-
exports.getLegModeLabel = getLegModeLabel;
|
|
34
30
|
exports.getItineraryBounds = getItineraryBounds;
|
|
35
31
|
exports.getLegBounds = getLegBounds;
|
|
36
32
|
exports.legLocationAtDistance = legLocationAtDistance;
|
|
37
33
|
exports.legElevationAtDistance = legElevationAtDistance;
|
|
38
34
|
exports.getElevationProfile = getElevationProfile;
|
|
39
35
|
exports.getTextWidth = getTextWidth;
|
|
36
|
+
exports.getCompanyForNetwork = getCompanyForNetwork;
|
|
40
37
|
exports.getCompaniesLabelFromNetworks = getCompaniesLabelFromNetworks;
|
|
41
|
-
exports.getModeForPlace = getModeForPlace;
|
|
42
|
-
exports.getPlaceName = getPlaceName;
|
|
43
38
|
exports.getTNCLocation = getTNCLocation;
|
|
44
39
|
exports.calculatePhysicalActivity = calculatePhysicalActivity;
|
|
45
|
-
exports.getTransitFare = getTransitFare;
|
|
46
|
-
exports.calculateFares = calculateFares;
|
|
47
40
|
exports.getTimeZoneOffset = getTimeZoneOffset;
|
|
41
|
+
exports.calculateTncFares = calculateTncFares;
|
|
42
|
+
Object.defineProperty(exports, "calculateFares", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _deprecated.calculateFares;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "getLegModeLabel", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _deprecated.getLegModeLabel;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "getModeForPlace", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _deprecated.getModeForPlace;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "getPlaceName", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _deprecated.getPlaceName;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "getStepDirection", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _deprecated.getStepDirection;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "getStepInstructions", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _deprecated.getStepInstructions;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "getStepStreetName", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _deprecated.getStepStreetName;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "getTransitFare", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _deprecated.getTransitFare;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
48
90
|
exports.transitModes = void 0;
|
|
49
91
|
|
|
50
92
|
var _polyline = _interopRequireDefault(require("@mapbox/polyline"));
|
|
51
93
|
|
|
52
94
|
var _along = _interopRequireDefault(require("@turf/along"));
|
|
53
95
|
|
|
96
|
+
var _deprecated = require("./deprecated");
|
|
97
|
+
|
|
54
98
|
// All OTP transit modes
|
|
55
99
|
const transitModes = ["TRAM", "BUS", "SUBWAY", "FERRY", "RAIL", "GONDOLA"];
|
|
56
100
|
/**
|
|
@@ -203,64 +247,6 @@ function getMapColor(mode) {
|
|
|
203
247
|
if (mode === "CAR") return "#444";
|
|
204
248
|
if (mode === "MICROMOBILITY") return "#f5a729";
|
|
205
249
|
return "#aaa";
|
|
206
|
-
} // TODO: temporary code; handle via migrated OTP i18n language table
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
function getStepDirection(step) {
|
|
210
|
-
switch (step.relativeDirection) {
|
|
211
|
-
case "DEPART":
|
|
212
|
-
return `Head ${step.absoluteDirection.toLowerCase()}`;
|
|
213
|
-
|
|
214
|
-
case "LEFT":
|
|
215
|
-
return "Left";
|
|
216
|
-
|
|
217
|
-
case "HARD_LEFT":
|
|
218
|
-
return "Hard left";
|
|
219
|
-
|
|
220
|
-
case "SLIGHTLY_LEFT":
|
|
221
|
-
return "Slight left";
|
|
222
|
-
|
|
223
|
-
case "CONTINUE":
|
|
224
|
-
return "Continue";
|
|
225
|
-
|
|
226
|
-
case "SLIGHTLY_RIGHT":
|
|
227
|
-
return "Slight right";
|
|
228
|
-
|
|
229
|
-
case "RIGHT":
|
|
230
|
-
return "Right";
|
|
231
|
-
|
|
232
|
-
case "HARD_RIGHT":
|
|
233
|
-
return "Hard right";
|
|
234
|
-
|
|
235
|
-
case "CIRCLE_CLOCKWISE":
|
|
236
|
-
return "Follow circle clockwise";
|
|
237
|
-
|
|
238
|
-
case "CIRCLE_COUNTERCLOCKWISE":
|
|
239
|
-
return "Follow circle counterclockwise";
|
|
240
|
-
|
|
241
|
-
case "ELEVATOR":
|
|
242
|
-
return "Take elevator";
|
|
243
|
-
|
|
244
|
-
case "UTURN_LEFT":
|
|
245
|
-
return "Left U-turn";
|
|
246
|
-
|
|
247
|
-
case "UTURN_RIGHT":
|
|
248
|
-
return "Right U-turn";
|
|
249
|
-
|
|
250
|
-
default:
|
|
251
|
-
return step.relativeDirection;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function getStepInstructions(step) {
|
|
256
|
-
const conjunction = step.relativeDirection === "ELEVATOR" ? "to" : "on";
|
|
257
|
-
return `${getStepDirection(step)} ${conjunction} ${step.streetName}`;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
function getStepStreetName(step) {
|
|
261
|
-
if (step.streetName === "road") return "Unnamed Road";
|
|
262
|
-
if (step.streetName === "path") return "Unnamed Path";
|
|
263
|
-
return step.streetName;
|
|
264
250
|
}
|
|
265
251
|
|
|
266
252
|
function toSentenceCase(str) {
|
|
@@ -306,29 +292,6 @@ function getCompanyFromLeg(leg) {
|
|
|
306
292
|
return null;
|
|
307
293
|
}
|
|
308
294
|
|
|
309
|
-
function getLegModeLabel(leg) {
|
|
310
|
-
switch (leg.mode) {
|
|
311
|
-
case "BICYCLE_RENT":
|
|
312
|
-
return "Biketown";
|
|
313
|
-
|
|
314
|
-
case "CAR":
|
|
315
|
-
return leg.hailedCar ? "Ride" : "Drive";
|
|
316
|
-
|
|
317
|
-
case "GONDOLA":
|
|
318
|
-
return "Aerial Tram";
|
|
319
|
-
|
|
320
|
-
case "TRAM":
|
|
321
|
-
if (leg.routeLongName.toLowerCase().indexOf("streetcar") !== -1) return "Streetcar";
|
|
322
|
-
return "Light Rail";
|
|
323
|
-
|
|
324
|
-
case "MICROMOBILITY":
|
|
325
|
-
return "Ride";
|
|
326
|
-
|
|
327
|
-
default:
|
|
328
|
-
return toSentenceCase(leg.mode);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
295
|
function getItineraryBounds(itinerary) {
|
|
333
296
|
let coords = [];
|
|
334
297
|
itinerary.legs.forEach(leg => {
|
|
@@ -507,54 +470,6 @@ function getCompanyForNetwork(networkString, companies = []) {
|
|
|
507
470
|
function getCompaniesLabelFromNetworks(networks, companies = []) {
|
|
508
471
|
return networks.map(network => getCompanyForNetwork(network, companies)).filter(co => !!co).map(co => co.label).join("/");
|
|
509
472
|
}
|
|
510
|
-
/**
|
|
511
|
-
* Returns mode name by checking the vertex type (VertexType class in OTP) for
|
|
512
|
-
* the provided place. NOTE: this is currently only intended for vehicles at
|
|
513
|
-
* the moment (not transit or walking).
|
|
514
|
-
*
|
|
515
|
-
* TODO: I18N
|
|
516
|
-
* @param {string} place place from itinerary leg
|
|
517
|
-
*/
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
function getModeForPlace(place) {
|
|
521
|
-
switch (place.vertexType) {
|
|
522
|
-
case "CARSHARE":
|
|
523
|
-
return "car";
|
|
524
|
-
|
|
525
|
-
case "VEHICLERENTAL":
|
|
526
|
-
return "E-scooter";
|
|
527
|
-
// TODO: Should the type change depending on bike vertex type?
|
|
528
|
-
|
|
529
|
-
case "BIKESHARE":
|
|
530
|
-
case "BIKEPARK":
|
|
531
|
-
return "bike";
|
|
532
|
-
// If company offers more than one mode, default to `vehicle` string.
|
|
533
|
-
|
|
534
|
-
default:
|
|
535
|
-
return "vehicle";
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
function getPlaceName(place, companies) {
|
|
540
|
-
// If address is provided (i.e. for carshare station, use it)
|
|
541
|
-
if (place.address) return place.address.split(",")[0];
|
|
542
|
-
|
|
543
|
-
if (place.networks && place.vertexType === "VEHICLERENTAL") {
|
|
544
|
-
// For vehicle rental pick up, do not use the place name. Rather, use
|
|
545
|
-
// company name + vehicle type (e.g., SPIN E-scooter). Place name is often just
|
|
546
|
-
// a UUID that has no relevance to the actual vehicle. For bikeshare, however,
|
|
547
|
-
// there are often hubs or bikes that have relevant names to the user.
|
|
548
|
-
const company = getCompanyForNetwork(place.networks[0], companies);
|
|
549
|
-
|
|
550
|
-
if (company) {
|
|
551
|
-
return `${company.label} ${getModeForPlace(place)}`;
|
|
552
|
-
}
|
|
553
|
-
} // Default to place name
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
return place.name;
|
|
557
|
-
}
|
|
558
473
|
|
|
559
474
|
function getTNCLocation(leg, type) {
|
|
560
475
|
const location = leg[type];
|
|
@@ -575,135 +490,26 @@ function calculatePhysicalActivity(itinerary) {
|
|
|
575
490
|
walkDuration
|
|
576
491
|
};
|
|
577
492
|
}
|
|
578
|
-
/**
|
|
579
|
-
* For a given fare component (either total fare or component parts), returns
|
|
580
|
-
* an object with string formatters and the fare value (in cents).
|
|
581
|
-
*/
|
|
582
493
|
|
|
494
|
+
function getTimeZoneOffset(itinerary) {
|
|
495
|
+
if (!itinerary.legs || !itinerary.legs.length) return 0; // Determine if there is a DST offset between now and the itinerary start date
|
|
583
496
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
let digits = 2;
|
|
587
|
-
let transitFare = 0;
|
|
588
|
-
let symbol = "$";
|
|
589
|
-
let currencyCode = "USD";
|
|
590
|
-
|
|
591
|
-
if (fareComponent) {
|
|
592
|
-
// Assign values without declaration. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#assignment_without_declaration
|
|
593
|
-
({
|
|
594
|
-
currencyCode,
|
|
595
|
-
defaultFractionDigits: digits,
|
|
596
|
-
symbol
|
|
597
|
-
} = fareComponent.currency);
|
|
598
|
-
transitFare = fareComponent.cents;
|
|
599
|
-
} // For cents to string conversion, use digits from fare component.
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
const centsToString = cents => {
|
|
603
|
-
const dollars = (cents / 10 ** digits).toFixed(digits);
|
|
604
|
-
return `${symbol}${dollars}`;
|
|
605
|
-
}; // For dollars to string conversion, assume we're rounding to two digits.
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
const dollarsToString = dollars => `${symbol}${dollars.toFixed(2)}`;
|
|
609
|
-
|
|
610
|
-
return {
|
|
611
|
-
centsToString,
|
|
612
|
-
currencyCode,
|
|
613
|
-
dollarsToString,
|
|
614
|
-
transitFare
|
|
615
|
-
};
|
|
497
|
+
const dstOffset = new Date(itinerary.startTime).getTimezoneOffset() - new Date().getTimezoneOffset();
|
|
498
|
+
return itinerary.legs[0].agencyTimeZoneOffset + (new Date().getTimezoneOffset() + dstOffset) * 60000;
|
|
616
499
|
}
|
|
617
|
-
/**
|
|
618
|
-
* For an itinerary, calculates the transit/TNC fares and returns an object with
|
|
619
|
-
* these values, currency info, as well as string formatters.
|
|
620
|
-
* It is assumed that the same currency is used for transit and TNC legs.
|
|
621
|
-
*
|
|
622
|
-
* multiple being set to true will change the output behavior:
|
|
623
|
-
* - dollarsToString and centsToString will be returned as part of each fare
|
|
624
|
-
* - currencyCode will be returned separately for each fare
|
|
625
|
-
* - tnc currency code will be returned separately
|
|
626
|
-
* - each fare type will be returned separately within a new transitFares property
|
|
627
|
-
*
|
|
628
|
-
* FIXME: a new approach to fare calculation must be found:
|
|
629
|
-
* the current approach is not sustainable, as centsToString and DollarsToString
|
|
630
|
-
* must be replaced by i18n anyway.
|
|
631
|
-
*
|
|
632
|
-
* However, the current behavior should ideally be kept to avoid a breaking change.
|
|
633
|
-
* The "multiple" mode is helpful, but only prevents tnc fare calculation from being duplicated.
|
|
634
|
-
* This method could be split out into a new one, along with tnc fare calculation.
|
|
635
|
-
* If this is done, the individual fare calculation should also be modified to support
|
|
636
|
-
* a default fare not being called "regular". However, this again would be a breaking change.
|
|
637
|
-
* This breaking change is avoided by adding the "multiple" parameter.
|
|
638
|
-
*
|
|
639
|
-
* When centsToString and dollarsToString are removed, this method should be split into
|
|
640
|
-
* individual fare calculation on a variable fare key, fare calculation of an entire leg,
|
|
641
|
-
* which will get fares for every fare key in the leg, and a method to calculate the fare of
|
|
642
|
-
* a tnc ride within the leg. This will make typescripting easier, as the types will be cleaner.
|
|
643
|
-
*/
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
function calculateFares(itinerary, multiple = false) {
|
|
647
|
-
// Process any TNC fares
|
|
648
|
-
let minTNCFare = 0;
|
|
649
|
-
let maxTNCFare = 0;
|
|
650
|
-
let tncCurrencyCode;
|
|
651
|
-
itinerary.legs.forEach(leg => {
|
|
652
|
-
if (leg.mode === "CAR" && leg.hailedCar && leg.tncData) {
|
|
653
|
-
const {
|
|
654
|
-
currency,
|
|
655
|
-
maxCost,
|
|
656
|
-
minCost
|
|
657
|
-
} = leg.tncData; // TODO: Support non-USD
|
|
658
|
-
|
|
659
|
-
minTNCFare += minCost;
|
|
660
|
-
maxTNCFare += maxCost;
|
|
661
|
-
tncCurrencyCode = currency;
|
|
662
|
-
}
|
|
663
|
-
});
|
|
664
|
-
|
|
665
|
-
if (multiple) {
|
|
666
|
-
// Return object of fares
|
|
667
|
-
const transitFares = {};
|
|
668
|
-
|
|
669
|
-
if (itinerary && itinerary.fare && itinerary.fare.fare) {
|
|
670
|
-
Object.keys(itinerary.fare.fare).forEach(fareKey => {
|
|
671
|
-
const fareComponent = itinerary.fare.fare[fareKey];
|
|
672
|
-
transitFares[fareKey] = getTransitFare(fareComponent);
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
return {
|
|
677
|
-
maxTNCFare,
|
|
678
|
-
minTNCFare,
|
|
679
|
-
tncCurrencyCode,
|
|
680
|
-
transitFares
|
|
681
|
-
};
|
|
682
|
-
} // Extract fare total from itinerary fares.
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
const fareComponent = itinerary.fare && itinerary.fare.fare && itinerary.fare.fare.regular; // Get string formatters and itinerary fare.
|
|
686
500
|
|
|
501
|
+
function calculateTncFares(itinerary) {
|
|
502
|
+
// TODO: don't rely on deprecated methods!
|
|
503
|
+
// At the moment this is safe as none of these exported variables contain strings
|
|
687
504
|
const {
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
} = getTransitFare(fareComponent);
|
|
505
|
+
maxTNCFare,
|
|
506
|
+
minTNCFare,
|
|
507
|
+
tncCurrencyCode
|
|
508
|
+
} = (0, _deprecated.calculateFares)(itinerary, true);
|
|
693
509
|
return {
|
|
694
|
-
centsToString,
|
|
695
|
-
currencyCode: transitCurrencyCode || tncCurrencyCode,
|
|
696
|
-
dollarsToString,
|
|
697
510
|
maxTNCFare,
|
|
698
511
|
minTNCFare,
|
|
699
|
-
|
|
512
|
+
tncCurrencyCode
|
|
700
513
|
};
|
|
701
514
|
}
|
|
702
|
-
|
|
703
|
-
function getTimeZoneOffset(itinerary) {
|
|
704
|
-
if (!itinerary.legs || !itinerary.legs.length) return 0; // Determine if there is a DST offset between now and the itinerary start date
|
|
705
|
-
|
|
706
|
-
const dstOffset = new Date(itinerary.startTime).getTimezoneOffset() - new Date().getTimezoneOffset();
|
|
707
|
-
return itinerary.legs[0].agencyTimeZoneOffset + (new Date().getTimezoneOffset() + dstOffset) * 60000;
|
|
708
|
-
}
|
|
709
515
|
//# sourceMappingURL=itinerary.js.map
|
package/lib/itinerary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/itinerary.js"],"names":["transitModes","getTransitModes","config","modes","map","tm","mode","isTransit","includes","isReservationRequired","leg","boardRule","isContinuousDropoff","alightRule","isFlex","isAdvanceBookingRequired","info","latestBookingTime","daysPrior","legDropoffRequiresAdvanceBooking","dropOffBookingInfo","isWalk","isBicycle","isBicycleRent","isCar","startsWith","isMicromobility","isAccessMode","hasTransit","modesStr","split","some","hasCar","hasBike","hasMicromobility","hasHail","indexOf","hasRental","getMapColor","get","getStepDirection","step","relativeDirection","absoluteDirection","toLowerCase","getStepInstructions","conjunction","streetName","getStepStreetName","toSentenceCase","str","String","charAt","toUpperCase","substr","getCompanyFromLeg","from","rentedBike","rentedCar","rentedVehicle","tncData","networks","company","getLegModeLabel","hailedCar","routeLongName","getItineraryBounds","itinerary","coords","legs","forEach","legCoords","polyline","toGeoJSON","legGeometry","points","coordinates","c","getLegBounds","length","push","lat","lon","to","legLocationAtDistance","distance","line","pt","units","geometry","e","legElevationAtDistance","traversed","unshift","i","start","elevDistanceSpan","console","warn","pct","elevSpan","getElevationProfile","steps","unitConversion","minElev","maxElev","gain","loss","previous","elevation","elev","diff","second","first","convertedElevation","getTextWidth","text","font","canvas","document","createElement","context","getContext","metrics","measureText","width","getCompanyForNetwork","networkString","companies","find","co","id","getCompaniesLabelFromNetworks","network","filter","label","join","getModeForPlace","place","vertexType","getPlaceName","address","name","getTNCLocation","type","location","toFixed","calculatePhysicalActivity","walkDuration","bikeDuration","duration","caloriesBurned","getTransitFare","fareComponent","digits","transitFare","symbol","currencyCode","defaultFractionDigits","currency","cents","centsToString","dollars","dollarsToString","calculateFares","multiple","minTNCFare","maxTNCFare","tncCurrencyCode","maxCost","minCost","transitFares","fare","Object","keys","fareKey","regular","transitCurrencyCode","getTimeZoneOffset","dstOffset","Date","startTime","getTimezoneOffset","agencyTimeZoneOffset"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;AACO,MAAMA,YAAY,GAAG,CAC1B,MAD0B,EAE1B,KAF0B,EAG1B,QAH0B,EAI1B,OAJ0B,EAK1B,MAL0B,EAM1B,SAN0B,CAArB;AASP;AACA;AACA;AACA;;;;AAEO,SAASC,eAAT,CAAyBC,MAAzB,EAAiC;AACtC,MAAI,CAACA,MAAD,IAAW,CAACA,MAAM,CAACC,KAAnB,IAA4B,CAACD,MAAM,CAACC,KAAP,CAAaH,YAA9C,EACE,OAAOA,YAAP;AACF,SAAOE,MAAM,CAACC,KAAP,CAAaH,YAAb,CAA0BI,GAA1B,CAA8BC,EAAE,IAAIA,EAAE,CAACC,IAAvC,CAAP;AACD;;AAEM,SAASC,SAAT,CAAmBD,IAAnB,EAAyB;AAC9B,SAAON,YAAY,CAACQ,QAAb,CAAsBF,IAAtB,KAA+BA,IAAI,KAAK,SAA/C;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASG,qBAAT,CAA+BC,GAA/B,EAAoC;AACzC,SAAOA,GAAG,CAACC,SAAJ,KAAkB,WAAzB;AACD;AACD;AACA;AACA;AACA;AACA;;;AACO,SAASC,mBAAT,CAA6BF,GAA7B,EAAkC;AACvC,SAAOA,GAAG,CAACG,UAAJ,KAAmB,sBAA1B;AACD;AACD;AACA;AACA;AACA;;;AACO,SAASC,MAAT,CAAgBJ,GAAhB,EAAqB;AAC1B,SAAOD,qBAAqB,CAACC,GAAD,CAArB,IAA8BE,mBAAmB,CAACF,GAAD,CAAxD;AACD;;AAEM,SAASK,wBAAT,CAAkCC,IAAlC,EAAwC;AAAA;;AAC7C,SAAO,CAAAA,IAAI,SAAJ,IAAAA,IAAI,WAAJ,qCAAAA,IAAI,CAAEC,iBAAN,gFAAyBC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,WAAO;AACLc,MAAAA,UADK;AAELD,MAAAA,UAFK;AAGLE,MAAAA,eAHK;AAILG,MAAAA;AAJK,KAAP;AAMD,GA/ByD,CAiC1D;;;AACA,QAAMlB,aAAa,GACjBtF,SAAS,CAACyG,IAAV,IAAkBzG,SAAS,CAACyG,IAAV,CAAeA,IAAjC,IAAyCzG,SAAS,CAACyG,IAAV,CAAeA,IAAf,CAAoBI,OAD/D,CAlC0D,CAoC1D;;AACA,QAAM;AACJf,IAAAA,aADI;AAEJJ,IAAAA,YAAY,EAAEoB,mBAFV;AAGJd,IAAAA,eAHI;AAIJR,IAAAA;AAJI,MAKFH,cAAc,CAACC,aAAD,CALlB;AAOA,SAAO;AACLQ,IAAAA,aADK;AAELJ,IAAAA,YAAY,EAAEoB,mBAAmB,IAAIT,eAFhC;AAGLL,IAAAA,eAHK;AAILI,IAAAA,UAJK;AAKLD,IAAAA,UALK;AAMLX,IAAAA;AANK,GAAP;AAQD;;AAEM,SAASuB,iBAAT,CAA2B/G,SAA3B,EAAsC;AAC3C,MAAI,CAACA,SAAS,CAACE,IAAX,IAAmB,CAACF,SAAS,CAACE,IAAV,CAAeU,MAAvC,EAA+C,OAAO,CAAP,CADJ,CAG3C;;AACA,QAAMoG,SAAS,GACb,IAAIC,IAAJ,CAASjH,SAAS,CAACkH,SAAnB,EAA8BC,iBAA9B,KACA,IAAIF,IAAJ,GAAWE,iBAAX,EAFF;AAIA,SACEnH,SAAS,CAACE,IAAV,CAAe,CAAf,EAAkBkH,oBAAlB,GACA,CAAC,IAAIH,IAAJ,GAAWE,iBAAX,KAAiCH,SAAlC,IAA+C,KAFjD;AAID","sourcesContent":["import polyline from \"@mapbox/polyline\";\nimport turfAlong from \"@turf/along\";\n\n// All OTP transit modes\nexport const transitModes = [\n \"TRAM\",\n \"BUS\",\n \"SUBWAY\",\n \"FERRY\",\n \"RAIL\",\n \"GONDOLA\"\n];\n\n/**\n * @param {config} config OTP-RR configuration object\n * @return {Array} List of all transit modes defined in config; otherwise default mode list\n */\n\nexport function getTransitModes(config) {\n if (!config || !config.modes || !config.modes.transitModes)\n return transitModes;\n return config.modes.transitModes.map(tm => tm.mode);\n}\n\nexport function isTransit(mode) {\n return transitModes.includes(mode) || mode === \"TRANSIT\";\n}\n\n/**\n * Returns true if the leg pickup rules enabled which require\n * calling ahead for the service to run. \"mustPhone\" is the only\n * property of boardRule which encodes this info.\n */\nexport function isReservationRequired(leg) {\n return leg.boardRule === \"mustPhone\";\n}\n/**\n * Returns true if the leg has continuous dropoff enabled which requires\n * asking the driver to let the user off. \"coordinateWithDriver\" is the only\n * property of alightRule which encodes this info.\n */\nexport function isContinuousDropoff(leg) {\n return leg.alightRule === \"coordinateWithDriver\";\n}\n/**\n * The two rules checked by the above two functions are the only values\n * returned by OTP when a leg is a flex leg.\n */\nexport function isFlex(leg) {\n return isReservationRequired(leg) || isContinuousDropoff(leg);\n}\n\nexport function isAdvanceBookingRequired(info) {\n return info?.latestBookingTime?.daysPrior > 0;\n}\nexport function legDropoffRequiresAdvanceBooking(leg) {\n return isAdvanceBookingRequired(leg.dropOffBookingInfo);\n}\n\nexport function isWalk(mode) {\n if (!mode) return false;\n\n return mode === \"WALK\";\n}\n\nexport function isBicycle(mode) {\n if (!mode) return false;\n\n return mode === \"BICYCLE\";\n}\n\nexport function isBicycleRent(mode) {\n if (!mode) return false;\n\n return mode === \"BICYCLE_RENT\";\n}\n\nexport function isCar(mode) {\n if (!mode) return false;\n return mode.startsWith(\"CAR\");\n}\n\nexport function isMicromobility(mode) {\n if (!mode) return false;\n return mode.startsWith(\"MICROMOBILITY\");\n}\n\nexport function isAccessMode(mode) {\n return (\n isWalk(mode) ||\n isBicycle(mode) ||\n isBicycleRent(mode) ||\n isCar(mode) ||\n isMicromobility(mode)\n );\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are transit modes\n */\nexport function hasTransit(modesStr) {\n return modesStr.split(\",\").some(mode => isTransit(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are car-based modes\n */\nexport function hasCar(modesStr) {\n return modesStr.split(\",\").some(mode => isCar(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are bicycle-based modes\n */\nexport function hasBike(modesStr) {\n return modesStr\n .split(\",\")\n .some(mode => isBicycle(mode) || isBicycleRent(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are micromobility-based modes\n */\nexport function hasMicromobility(modesStr) {\n return modesStr.split(\",\").some(mode => isMicromobility(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes is a hailing mode\n */\nexport function hasHail(modesStr) {\n return modesStr.split(\",\").some(mode => mode.indexOf(\"_HAIL\") > -1);\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes is a rental mode\n */\nexport function hasRental(modesStr) {\n return modesStr.split(\",\").some(mode => mode.indexOf(\"_RENT\") > -1);\n}\n\nexport function getMapColor(mode) {\n mode = mode || this.get(\"mode\");\n if (mode === \"WALK\") return \"#444\";\n if (mode === \"BICYCLE\") return \"#0073e5\";\n if (mode === \"SUBWAY\") return \"#e60000\";\n if (mode === \"RAIL\") return \"#b00\";\n if (mode === \"BUS\") return \"#080\";\n if (mode === \"TRAM\") return \"#800\";\n if (mode === \"FERRY\") return \"#008\";\n if (mode === \"CAR\") return \"#444\";\n if (mode === \"MICROMOBILITY\") return \"#f5a729\";\n return \"#aaa\";\n}\n\n// TODO: temporary code; handle via migrated OTP i18n language table\nexport function getStepDirection(step) {\n switch (step.relativeDirection) {\n case \"DEPART\":\n return `Head ${step.absoluteDirection.toLowerCase()}`;\n case \"LEFT\":\n return \"Left\";\n case \"HARD_LEFT\":\n return \"Hard left\";\n case \"SLIGHTLY_LEFT\":\n return \"Slight left\";\n case \"CONTINUE\":\n return \"Continue\";\n case \"SLIGHTLY_RIGHT\":\n return \"Slight right\";\n case \"RIGHT\":\n return \"Right\";\n case \"HARD_RIGHT\":\n return \"Hard right\";\n case \"CIRCLE_CLOCKWISE\":\n return \"Follow circle clockwise\";\n case \"CIRCLE_COUNTERCLOCKWISE\":\n return \"Follow circle counterclockwise\";\n case \"ELEVATOR\":\n return \"Take elevator\";\n case \"UTURN_LEFT\":\n return \"Left U-turn\";\n case \"UTURN_RIGHT\":\n return \"Right U-turn\";\n default:\n return step.relativeDirection;\n }\n}\n\nexport function getStepInstructions(step) {\n const conjunction = step.relativeDirection === \"ELEVATOR\" ? \"to\" : \"on\";\n return `${getStepDirection(step)} ${conjunction} ${step.streetName}`;\n}\n\nexport function getStepStreetName(step) {\n if (step.streetName === \"road\") return \"Unnamed Road\";\n if (step.streetName === \"path\") return \"Unnamed Path\";\n return step.streetName;\n}\n\nexport function toSentenceCase(str) {\n if (str == null) {\n return \"\";\n }\n str = String(str);\n return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase();\n}\n\n/**\n * Derive the company string based on mode and network associated with leg.\n */\nexport function getCompanyFromLeg(leg) {\n if (!leg) return null;\n const { from, mode, rentedBike, rentedCar, rentedVehicle, tncData } = leg;\n if (mode === \"CAR\" && rentedCar) {\n return from.networks[0];\n }\n if (mode === \"CAR\" && tncData) {\n return tncData.company;\n }\n if (mode === \"BICYCLE\" && rentedBike && from.networks) {\n return from.networks[0];\n }\n if (mode === \"MICROMOBILITY\" && rentedVehicle && from.networks) {\n return from.networks[0];\n }\n return null;\n}\n\nexport function getLegModeLabel(leg) {\n switch (leg.mode) {\n case \"BICYCLE_RENT\":\n return \"Biketown\";\n case \"CAR\":\n return leg.hailedCar ? \"Ride\" : \"Drive\";\n case \"GONDOLA\":\n return \"Aerial Tram\";\n case \"TRAM\":\n if (leg.routeLongName.toLowerCase().indexOf(\"streetcar\") !== -1)\n return \"Streetcar\";\n return \"Light Rail\";\n case \"MICROMOBILITY\":\n return \"Ride\";\n default:\n return toSentenceCase(leg.mode);\n }\n}\n\nexport function getItineraryBounds(itinerary) {\n let coords = [];\n itinerary.legs.forEach(leg => {\n const legCoords = polyline\n .toGeoJSON(leg.legGeometry.points)\n .coordinates.map(c => [c[1], c[0]]);\n coords = [...coords, ...legCoords];\n });\n return coords;\n}\n\n/**\n * Return a coords object that encloses the given leg's geometry.\n */\nexport function getLegBounds(leg) {\n const coords = polyline\n .toGeoJSON(leg.legGeometry.points)\n .coordinates.map(c => [c[1], c[0]]);\n\n // in certain cases, there might be zero-length coordinates in the leg\n // geometry. In these cases, build us an array of coordinates using the from\n // and to data of the leg.\n if (coords.length === 0) {\n coords.push([leg.from.lat, leg.from.lon], [leg.to.lat, leg.to.lon]);\n }\n return coords;\n}\n\n/* Returns an interpolated lat-lon at a specified distance along a leg */\n\nexport function legLocationAtDistance(leg, distance) {\n if (!leg.legGeometry) return null;\n\n try {\n const line = polyline.toGeoJSON(leg.legGeometry.points);\n const pt = turfAlong(line, distance, { units: \"meters\" });\n if (pt && pt.geometry && pt.geometry.coordinates) {\n return [pt.geometry.coordinates[1], pt.geometry.coordinates[0]];\n }\n } catch (e) {\n // FIXME handle error!\n }\n\n return null;\n}\n\n/* Returns an interpolated elevation at a specified distance along a leg */\n\nexport function legElevationAtDistance(points, distance) {\n // Iterate through the combined elevation profile\n let traversed = 0;\n // If first point distance is not zero, insert starting point at zero with\n // null elevation. Encountering this value should trigger the warning below.\n if (points[0][0] > 0) {\n points.unshift([0, null]);\n }\n for (let i = 1; i < points.length; i++) {\n const start = points[i - 1];\n const elevDistanceSpan = points[i][0] - start[0];\n if (distance >= traversed && distance <= traversed + elevDistanceSpan) {\n // Distance falls within this point and the previous one;\n // compute & return iterpolated elevation value\n if (start[1] === null) {\n console.warn(\n \"Elevation value does not exist for distance.\",\n distance,\n traversed\n );\n return null;\n }\n const pct = (distance - traversed) / elevDistanceSpan;\n const elevSpan = points[i][1] - start[1];\n return start[1] + elevSpan * pct;\n }\n traversed += elevDistanceSpan;\n }\n console.warn(\n \"Elevation value does not exist for distance.\",\n distance,\n traversed\n );\n return null;\n}\n\n// Iterate through the steps, building the array of elevation points and\n// keeping track of the minimum and maximum elevations reached\nexport function getElevationProfile(steps, unitConversion = 1) {\n let minElev = 100000;\n let maxElev = -100000;\n let traversed = 0;\n let gain = 0;\n let loss = 0;\n let previous = null;\n const points = [];\n steps.forEach(step => {\n if (!step.elevation || step.elevation.length === 0) {\n traversed += step.distance;\n return;\n }\n for (let i = 0; i < step.elevation.length; i++) {\n const elev = step.elevation[i];\n if (previous) {\n const diff = (elev.second - previous.second) * unitConversion;\n if (diff > 0) gain += diff;\n else loss += diff;\n }\n if (i === 0 && elev.first !== 0) {\n // console.warn(`No elevation data available for step ${stepIndex}-${i} at beginning of segment`, elev)\n }\n const convertedElevation = elev.second * unitConversion;\n if (convertedElevation < minElev) minElev = convertedElevation;\n if (convertedElevation > maxElev) maxElev = convertedElevation;\n points.push([traversed + elev.first, elev.second]);\n // Insert \"filler\" point if the last point in elevation profile does not\n // reach the full distance of the step.\n if (i === step.elevation.length - 1 && elev.first !== step.distance) {\n // points.push([traversed + step.distance, elev.second])\n }\n previous = elev;\n }\n traversed += step.distance;\n });\n return { maxElev, minElev, points, traversed, gain, loss };\n}\n\n/**\n * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.\n *\n * @param {string} text The text to be rendered.\n * @param {string} font The css font descriptor that text is to be rendered with (e.g. \"bold 14px verdana\").\n *\n * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393\n */\nexport function getTextWidth(text, font = \"22px Arial\") {\n // re-use canvas object for better performance\n const canvas =\n getTextWidth.canvas ||\n (getTextWidth.canvas = document.createElement(\"canvas\"));\n const context = canvas.getContext(\"2d\");\n context.font = font;\n const metrics = context.measureText(text);\n return metrics.width;\n}\n\n/**\n * Get the configured company object for the given network string if the company\n * has been defined in the provided companies array config.\n */\nfunction getCompanyForNetwork(networkString, companies = []) {\n const company = companies.find(co => co.id === networkString);\n if (!company) {\n console.warn(\n `No company found in config.yml that matches rented vehicle network: ${networkString}`,\n companies\n );\n }\n return company;\n}\n\n/**\n * Get a string label to display from a list of vehicle rental networks.\n *\n * @param {Array<string>} networks A list of network ids.\n * @param {Array<object>} [companies=[]] An optional list of the companies config.\n * @return {string} A label for use in presentation on a website.\n */\nexport function getCompaniesLabelFromNetworks(networks, companies = []) {\n return networks\n .map(network => getCompanyForNetwork(network, companies))\n .filter(co => !!co)\n .map(co => co.label)\n .join(\"/\");\n}\n\n/**\n * Returns mode name by checking the vertex type (VertexType class in OTP) for\n * the provided place. NOTE: this is currently only intended for vehicles at\n * the moment (not transit or walking).\n *\n * TODO: I18N\n * @param {string} place place from itinerary leg\n */\nexport function getModeForPlace(place) {\n switch (place.vertexType) {\n case \"CARSHARE\":\n return \"car\";\n case \"VEHICLERENTAL\":\n return \"E-scooter\";\n // TODO: Should the type change depending on bike vertex type?\n case \"BIKESHARE\":\n case \"BIKEPARK\":\n return \"bike\";\n // If company offers more than one mode, default to `vehicle` string.\n default:\n return \"vehicle\";\n }\n}\n\nexport function getPlaceName(place, companies) {\n // If address is provided (i.e. for carshare station, use it)\n if (place.address) return place.address.split(\",\")[0];\n if (place.networks && place.vertexType === \"VEHICLERENTAL\") {\n // For vehicle rental pick up, do not use the place name. Rather, use\n // company name + vehicle type (e.g., SPIN E-scooter). Place name is often just\n // a UUID that has no relevance to the actual vehicle. For bikeshare, however,\n // there are often hubs or bikes that have relevant names to the user.\n const company = getCompanyForNetwork(place.networks[0], companies);\n if (company) {\n return `${company.label} ${getModeForPlace(place)}`;\n }\n }\n // Default to place name\n return place.name;\n}\n\nexport function getTNCLocation(leg, type) {\n const location = leg[type];\n return `${location.lat.toFixed(5)},${location.lon.toFixed(5)}`;\n}\n\nexport function calculatePhysicalActivity(itinerary) {\n let walkDuration = 0;\n let bikeDuration = 0;\n itinerary.legs.forEach(leg => {\n if (leg.mode.startsWith(\"WALK\")) walkDuration += leg.duration;\n if (leg.mode.startsWith(\"BICYCLE\")) bikeDuration += leg.duration;\n });\n const caloriesBurned =\n (walkDuration / 3600) * 280 + (bikeDuration / 3600) * 290;\n return {\n bikeDuration,\n caloriesBurned,\n walkDuration\n };\n}\n\n/**\n * For a given fare component (either total fare or component parts), returns\n * an object with string formatters and the fare value (in cents).\n */\nexport function getTransitFare(fareComponent) {\n // Default values (if fare component is not valid).\n let digits = 2;\n let transitFare = 0;\n let symbol = \"$\";\n let currencyCode = \"USD\";\n if (fareComponent) {\n // Assign values without declaration. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#assignment_without_declaration\n ({\n currencyCode,\n defaultFractionDigits: digits,\n symbol\n } = fareComponent.currency);\n transitFare = fareComponent.cents;\n }\n // For cents to string conversion, use digits from fare component.\n const centsToString = cents => {\n const dollars = (cents / 10 ** digits).toFixed(digits);\n return `${symbol}${dollars}`;\n };\n // For dollars to string conversion, assume we're rounding to two digits.\n const dollarsToString = dollars => `${symbol}${dollars.toFixed(2)}`;\n return {\n centsToString,\n currencyCode,\n dollarsToString,\n transitFare\n };\n}\n\n/**\n * For an itinerary, calculates the transit/TNC fares and returns an object with\n * these values, currency info, as well as string formatters.\n * It is assumed that the same currency is used for transit and TNC legs.\n *\n * multiple being set to true will change the output behavior:\n * - dollarsToString and centsToString will be returned as part of each fare\n * - currencyCode will be returned separately for each fare\n * - tnc currency code will be returned separately\n * - each fare type will be returned separately within a new transitFares property\n *\n * FIXME: a new approach to fare calculation must be found:\n * the current approach is not sustainable, as centsToString and DollarsToString\n * must be replaced by i18n anyway.\n *\n * However, the current behavior should ideally be kept to avoid a breaking change.\n * The \"multiple\" mode is helpful, but only prevents tnc fare calculation from being duplicated.\n * This method could be split out into a new one, along with tnc fare calculation.\n * If this is done, the individual fare calculation should also be modified to support\n * a default fare not being called \"regular\". However, this again would be a breaking change.\n * This breaking change is avoided by adding the \"multiple\" parameter.\n *\n * When centsToString and dollarsToString are removed, this method should be split into\n * individual fare calculation on a variable fare key, fare calculation of an entire leg,\n * which will get fares for every fare key in the leg, and a method to calculate the fare of\n * a tnc ride within the leg. This will make typescripting easier, as the types will be cleaner.\n */\nexport function calculateFares(itinerary, multiple = false) {\n // Process any TNC fares\n let minTNCFare = 0;\n let maxTNCFare = 0;\n let tncCurrencyCode;\n itinerary.legs.forEach(leg => {\n if (leg.mode === \"CAR\" && leg.hailedCar && leg.tncData) {\n const { currency, maxCost, minCost } = leg.tncData;\n // TODO: Support non-USD\n minTNCFare += minCost;\n maxTNCFare += maxCost;\n tncCurrencyCode = currency;\n }\n });\n\n if (multiple) {\n // Return object of fares\n const transitFares = {};\n if (itinerary && itinerary.fare && itinerary.fare.fare) {\n Object.keys(itinerary.fare.fare).forEach(fareKey => {\n const fareComponent = itinerary.fare.fare[fareKey];\n transitFares[fareKey] = getTransitFare(fareComponent);\n });\n }\n\n return {\n maxTNCFare,\n minTNCFare,\n tncCurrencyCode,\n transitFares\n };\n }\n\n // Extract fare total from itinerary fares.\n const fareComponent =\n itinerary.fare && itinerary.fare.fare && itinerary.fare.fare.regular;\n // Get string formatters and itinerary fare.\n const {\n centsToString,\n currencyCode: transitCurrencyCode,\n dollarsToString,\n transitFare\n } = getTransitFare(fareComponent);\n\n return {\n centsToString,\n currencyCode: transitCurrencyCode || tncCurrencyCode,\n dollarsToString,\n maxTNCFare,\n minTNCFare,\n transitFare\n };\n}\n\nexport function getTimeZoneOffset(itinerary) {\n if (!itinerary.legs || !itinerary.legs.length) return 0;\n\n // Determine if there is a DST offset between now and the itinerary start date\n const dstOffset =\n new Date(itinerary.startTime).getTimezoneOffset() -\n new Date().getTimezoneOffset();\n\n return (\n itinerary.legs[0].agencyTimeZoneOffset +\n (new Date().getTimezoneOffset() + dstOffset) * 60000\n );\n}\n"],"file":"itinerary.js"}
|
|
1
|
+
{"version":3,"sources":["../src/itinerary.js"],"names":["transitModes","getTransitModes","config","modes","map","tm","mode","isTransit","includes","isReservationRequired","leg","boardRule","isContinuousDropoff","alightRule","isFlex","isAdvanceBookingRequired","info","latestBookingTime","daysPrior","legDropoffRequiresAdvanceBooking","dropOffBookingInfo","isWalk","isBicycle","isBicycleRent","isCar","startsWith","isMicromobility","isAccessMode","hasTransit","modesStr","split","some","hasCar","hasBike","hasMicromobility","hasHail","indexOf","hasRental","getMapColor","get","toSentenceCase","str","String","charAt","toUpperCase","substr","toLowerCase","getCompanyFromLeg","from","rentedBike","rentedCar","rentedVehicle","tncData","networks","company","getItineraryBounds","itinerary","coords","legs","forEach","legCoords","polyline","toGeoJSON","legGeometry","points","coordinates","c","getLegBounds","length","push","lat","lon","to","legLocationAtDistance","distance","line","pt","units","geometry","e","legElevationAtDistance","traversed","unshift","i","start","elevDistanceSpan","console","warn","pct","elevSpan","getElevationProfile","steps","unitConversion","minElev","maxElev","gain","loss","previous","step","elevation","elev","diff","second","first","convertedElevation","getTextWidth","text","font","canvas","document","createElement","context","getContext","metrics","measureText","width","getCompanyForNetwork","networkString","companies","find","co","id","getCompaniesLabelFromNetworks","network","filter","label","join","getTNCLocation","type","location","toFixed","calculatePhysicalActivity","walkDuration","bikeDuration","duration","caloriesBurned","getTimeZoneOffset","dstOffset","Date","startTime","getTimezoneOffset","agencyTimeZoneOffset","calculateTncFares","maxTNCFare","minTNCFare","tncCurrencyCode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AAsBA;AACO,MAAMA,YAAY,GAAG,CAC1B,MAD0B,EAE1B,KAF0B,EAG1B,QAH0B,EAI1B,OAJ0B,EAK1B,MAL0B,EAM1B,SAN0B,CAArB;AASP;AACA;AACA;AACA;;;;AAEO,SAASC,eAAT,CAAyBC,MAAzB,EAAiC;AACtC,MAAI,CAACA,MAAD,IAAW,CAACA,MAAM,CAACC,KAAnB,IAA4B,CAACD,MAAM,CAACC,KAAP,CAAaH,YAA9C,EACE,OAAOA,YAAP;AAC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,YADK;AAELE,IAAAA,cAFK;AAGLH,IAAAA;AAHK,GAAP;AAKD;;AAEM,SAASI,iBAAT,CAA2BhF,SAA3B,EAAsC;AAC3C,MAAI,CAACA,SAAS,CAACE,IAAX,IAAmB,CAACF,SAAS,CAACE,IAAV,CAAeU,MAAvC,EAA+C,OAAO,CAAP,CADJ,CAG3C;;AACA,QAAMqE,SAAS,GACb,IAAIC,IAAJ,CAASlF,SAAS,CAACmF,SAAnB,EAA8BC,iBAA9B,KACA,IAAIF,IAAJ,GAAWE,iBAAX,EAFF;AAIA,SACEpF,SAAS,CAACE,IAAV,CAAe,CAAf,EAAkBmF,oBAAlB,GACA,CAAC,IAAIH,IAAJ,GAAWE,iBAAX,KAAiCH,SAAlC,IAA+C,KAFjD;AAID;;AAEM,SAASK,iBAAT,CAA2BtF,SAA3B,EAAsC;AAC3C;AACA;AACA,QAAM;AAAEuF,IAAAA,UAAF;AAAcC,IAAAA,UAAd;AAA0BC,IAAAA;AAA1B,MAA8C,gCAClDzF,SADkD,EAElD,IAFkD,CAApD;AAIA,SAAO;AAAEuF,IAAAA,UAAF;AAAcC,IAAAA,UAAd;AAA0BC,IAAAA;AAA1B,GAAP;AACD","sourcesContent":["import polyline from \"@mapbox/polyline\";\nimport turfAlong from \"@turf/along\";\n\nimport {\n calculateFares,\n getLegModeLabel,\n getModeForPlace,\n getPlaceName,\n getStepDirection,\n getStepInstructions,\n getStepStreetName,\n getTransitFare\n} from \"./deprecated\";\n\nexport {\n calculateFares,\n getLegModeLabel,\n getModeForPlace,\n getPlaceName,\n getStepDirection,\n getStepInstructions,\n getStepStreetName,\n getTransitFare\n};\n\n// All OTP transit modes\nexport const transitModes = [\n \"TRAM\",\n \"BUS\",\n \"SUBWAY\",\n \"FERRY\",\n \"RAIL\",\n \"GONDOLA\"\n];\n\n/**\n * @param {config} config OTP-RR configuration object\n * @return {Array} List of all transit modes defined in config; otherwise default mode list\n */\n\nexport function getTransitModes(config) {\n if (!config || !config.modes || !config.modes.transitModes)\n return transitModes;\n return config.modes.transitModes.map(tm => tm.mode);\n}\n\nexport function isTransit(mode) {\n return transitModes.includes(mode) || mode === \"TRANSIT\";\n}\n\n/**\n * Returns true if the leg pickup rules enabled which require\n * calling ahead for the service to run. \"mustPhone\" is the only\n * property of boardRule which encodes this info.\n */\nexport function isReservationRequired(leg) {\n return leg.boardRule === \"mustPhone\";\n}\n/**\n * Returns true if the leg has continuous dropoff enabled which requires\n * asking the driver to let the user off. \"coordinateWithDriver\" is the only\n * property of alightRule which encodes this info.\n */\nexport function isContinuousDropoff(leg) {\n return leg.alightRule === \"coordinateWithDriver\";\n}\n/**\n * The two rules checked by the above two functions are the only values\n * returned by OTP when a leg is a flex leg.\n */\nexport function isFlex(leg) {\n return isReservationRequired(leg) || isContinuousDropoff(leg);\n}\n\nexport function isAdvanceBookingRequired(info) {\n return info?.latestBookingTime?.daysPrior > 0;\n}\nexport function legDropoffRequiresAdvanceBooking(leg) {\n return isAdvanceBookingRequired(leg.dropOffBookingInfo);\n}\n\nexport function isWalk(mode) {\n if (!mode) return false;\n\n return mode === \"WALK\";\n}\n\nexport function isBicycle(mode) {\n if (!mode) return false;\n\n return mode === \"BICYCLE\";\n}\n\nexport function isBicycleRent(mode) {\n if (!mode) return false;\n\n return mode === \"BICYCLE_RENT\";\n}\n\nexport function isCar(mode) {\n if (!mode) return false;\n return mode.startsWith(\"CAR\");\n}\n\nexport function isMicromobility(mode) {\n if (!mode) return false;\n return mode.startsWith(\"MICROMOBILITY\");\n}\n\nexport function isAccessMode(mode) {\n return (\n isWalk(mode) ||\n isBicycle(mode) ||\n isBicycleRent(mode) ||\n isCar(mode) ||\n isMicromobility(mode)\n );\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are transit modes\n */\nexport function hasTransit(modesStr) {\n return modesStr.split(\",\").some(mode => isTransit(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are car-based modes\n */\nexport function hasCar(modesStr) {\n return modesStr.split(\",\").some(mode => isCar(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are bicycle-based modes\n */\nexport function hasBike(modesStr) {\n return modesStr\n .split(\",\")\n .some(mode => isBicycle(mode) || isBicycleRent(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes are micromobility-based modes\n */\nexport function hasMicromobility(modesStr) {\n return modesStr.split(\",\").some(mode => isMicromobility(mode));\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes is a hailing mode\n */\nexport function hasHail(modesStr) {\n return modesStr.split(\",\").some(mode => mode.indexOf(\"_HAIL\") > -1);\n}\n\n/**\n * @param {string} modesStr a comma-separated list of OTP modes\n * @return {boolean} whether any of the modes is a rental mode\n */\nexport function hasRental(modesStr) {\n return modesStr.split(\",\").some(mode => mode.indexOf(\"_RENT\") > -1);\n}\n\nexport function getMapColor(mode) {\n mode = mode || this.get(\"mode\");\n if (mode === \"WALK\") return \"#444\";\n if (mode === \"BICYCLE\") return \"#0073e5\";\n if (mode === \"SUBWAY\") return \"#e60000\";\n if (mode === \"RAIL\") return \"#b00\";\n if (mode === \"BUS\") return \"#080\";\n if (mode === \"TRAM\") return \"#800\";\n if (mode === \"FERRY\") return \"#008\";\n if (mode === \"CAR\") return \"#444\";\n if (mode === \"MICROMOBILITY\") return \"#f5a729\";\n return \"#aaa\";\n}\n\nexport function toSentenceCase(str) {\n if (str == null) {\n return \"\";\n }\n str = String(str);\n return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase();\n}\n\n/**\n * Derive the company string based on mode and network associated with leg.\n */\nexport function getCompanyFromLeg(leg) {\n if (!leg) return null;\n const { from, mode, rentedBike, rentedCar, rentedVehicle, tncData } = leg;\n if (mode === \"CAR\" && rentedCar) {\n return from.networks[0];\n }\n if (mode === \"CAR\" && tncData) {\n return tncData.company;\n }\n if (mode === \"BICYCLE\" && rentedBike && from.networks) {\n return from.networks[0];\n }\n if (mode === \"MICROMOBILITY\" && rentedVehicle && from.networks) {\n return from.networks[0];\n }\n return null;\n}\n\nexport function getItineraryBounds(itinerary) {\n let coords = [];\n itinerary.legs.forEach(leg => {\n const legCoords = polyline\n .toGeoJSON(leg.legGeometry.points)\n .coordinates.map(c => [c[1], c[0]]);\n coords = [...coords, ...legCoords];\n });\n return coords;\n}\n\n/**\n * Return a coords object that encloses the given leg's geometry.\n */\nexport function getLegBounds(leg) {\n const coords = polyline\n .toGeoJSON(leg.legGeometry.points)\n .coordinates.map(c => [c[1], c[0]]);\n\n // in certain cases, there might be zero-length coordinates in the leg\n // geometry. In these cases, build us an array of coordinates using the from\n // and to data of the leg.\n if (coords.length === 0) {\n coords.push([leg.from.lat, leg.from.lon], [leg.to.lat, leg.to.lon]);\n }\n return coords;\n}\n\n/* Returns an interpolated lat-lon at a specified distance along a leg */\n\nexport function legLocationAtDistance(leg, distance) {\n if (!leg.legGeometry) return null;\n\n try {\n const line = polyline.toGeoJSON(leg.legGeometry.points);\n const pt = turfAlong(line, distance, { units: \"meters\" });\n if (pt && pt.geometry && pt.geometry.coordinates) {\n return [pt.geometry.coordinates[1], pt.geometry.coordinates[0]];\n }\n } catch (e) {\n // FIXME handle error!\n }\n\n return null;\n}\n\n/* Returns an interpolated elevation at a specified distance along a leg */\n\nexport function legElevationAtDistance(points, distance) {\n // Iterate through the combined elevation profile\n let traversed = 0;\n // If first point distance is not zero, insert starting point at zero with\n // null elevation. Encountering this value should trigger the warning below.\n if (points[0][0] > 0) {\n points.unshift([0, null]);\n }\n for (let i = 1; i < points.length; i++) {\n const start = points[i - 1];\n const elevDistanceSpan = points[i][0] - start[0];\n if (distance >= traversed && distance <= traversed + elevDistanceSpan) {\n // Distance falls within this point and the previous one;\n // compute & return iterpolated elevation value\n if (start[1] === null) {\n console.warn(\n \"Elevation value does not exist for distance.\",\n distance,\n traversed\n );\n return null;\n }\n const pct = (distance - traversed) / elevDistanceSpan;\n const elevSpan = points[i][1] - start[1];\n return start[1] + elevSpan * pct;\n }\n traversed += elevDistanceSpan;\n }\n console.warn(\n \"Elevation value does not exist for distance.\",\n distance,\n traversed\n );\n return null;\n}\n\n// Iterate through the steps, building the array of elevation points and\n// keeping track of the minimum and maximum elevations reached\nexport function getElevationProfile(steps, unitConversion = 1) {\n let minElev = 100000;\n let maxElev = -100000;\n let traversed = 0;\n let gain = 0;\n let loss = 0;\n let previous = null;\n const points = [];\n steps.forEach(step => {\n if (!step.elevation || step.elevation.length === 0) {\n traversed += step.distance;\n return;\n }\n for (let i = 0; i < step.elevation.length; i++) {\n const elev = step.elevation[i];\n if (previous) {\n const diff = (elev.second - previous.second) * unitConversion;\n if (diff > 0) gain += diff;\n else loss += diff;\n }\n if (i === 0 && elev.first !== 0) {\n // console.warn(`No elevation data available for step ${stepIndex}-${i} at beginning of segment`, elev)\n }\n const convertedElevation = elev.second * unitConversion;\n if (convertedElevation < minElev) minElev = convertedElevation;\n if (convertedElevation > maxElev) maxElev = convertedElevation;\n points.push([traversed + elev.first, elev.second]);\n // Insert \"filler\" point if the last point in elevation profile does not\n // reach the full distance of the step.\n if (i === step.elevation.length - 1 && elev.first !== step.distance) {\n // points.push([traversed + step.distance, elev.second])\n }\n previous = elev;\n }\n traversed += step.distance;\n });\n return { maxElev, minElev, points, traversed, gain, loss };\n}\n\n/**\n * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.\n *\n * @param {string} text The text to be rendered.\n * @param {string} font The css font descriptor that text is to be rendered with (e.g. \"bold 14px verdana\").\n *\n * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393\n */\nexport function getTextWidth(text, font = \"22px Arial\") {\n // re-use canvas object for better performance\n const canvas =\n getTextWidth.canvas ||\n (getTextWidth.canvas = document.createElement(\"canvas\"));\n const context = canvas.getContext(\"2d\");\n context.font = font;\n const metrics = context.measureText(text);\n return metrics.width;\n}\n\n/**\n * Get the configured company object for the given network string if the company\n * has been defined in the provided companies array config.\n */\nexport function getCompanyForNetwork(networkString, companies = []) {\n const company = companies.find(co => co.id === networkString);\n if (!company) {\n console.warn(\n `No company found in config.yml that matches rented vehicle network: ${networkString}`,\n companies\n );\n }\n return company;\n}\n\n/**\n * Get a string label to display from a list of vehicle rental networks.\n *\n * @param {Array<string>} networks A list of network ids.\n * @param {Array<object>} [companies=[]] An optional list of the companies config.\n * @return {string} A label for use in presentation on a website.\n */\nexport function getCompaniesLabelFromNetworks(networks, companies = []) {\n return networks\n .map(network => getCompanyForNetwork(network, companies))\n .filter(co => !!co)\n .map(co => co.label)\n .join(\"/\");\n}\n\nexport function getTNCLocation(leg, type) {\n const location = leg[type];\n return `${location.lat.toFixed(5)},${location.lon.toFixed(5)}`;\n}\n\nexport function calculatePhysicalActivity(itinerary) {\n let walkDuration = 0;\n let bikeDuration = 0;\n itinerary.legs.forEach(leg => {\n if (leg.mode.startsWith(\"WALK\")) walkDuration += leg.duration;\n if (leg.mode.startsWith(\"BICYCLE\")) bikeDuration += leg.duration;\n });\n const caloriesBurned =\n (walkDuration / 3600) * 280 + (bikeDuration / 3600) * 290;\n return {\n bikeDuration,\n caloriesBurned,\n walkDuration\n };\n}\n\nexport function getTimeZoneOffset(itinerary) {\n if (!itinerary.legs || !itinerary.legs.length) return 0;\n\n // Determine if there is a DST offset between now and the itinerary start date\n const dstOffset =\n new Date(itinerary.startTime).getTimezoneOffset() -\n new Date().getTimezoneOffset();\n\n return (\n itinerary.legs[0].agencyTimeZoneOffset +\n (new Date().getTimezoneOffset() + dstOffset) * 60000\n );\n}\n\nexport function calculateTncFares(itinerary) {\n // TODO: don't rely on deprecated methods!\n // At the moment this is safe as none of these exported variables contain strings\n const { maxTNCFare, minTNCFare, tncCurrencyCode } = calculateFares(\n itinerary,\n true\n );\n return { maxTNCFare, minTNCFare, tncCurrencyCode };\n}\n"],"file":"itinerary.js"}
|
package/lib/map.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports.latlngToString = latlngToString;
|
|
9
|
-
exports.coordsToString = coordsToString;
|
|
10
6
|
exports.currentPositionToLocation = currentPositionToLocation;
|
|
11
7
|
exports.stringToCoords = stringToCoords;
|
|
12
8
|
exports.constructLocation = constructLocation;
|
|
13
|
-
exports.getDetailText = getDetailText;
|
|
14
9
|
exports.formatStoredPlaceName = formatStoredPlaceName;
|
|
15
10
|
exports.matchLatLon = matchLatLon;
|
|
16
11
|
exports.itineraryToTransitive = itineraryToTransitive;
|
|
@@ -20,18 +15,28 @@ exports.isCarWalkTransition = isCarWalkTransition;
|
|
|
20
15
|
exports.isValidLat = isValidLat;
|
|
21
16
|
exports.isValidLng = isValidLng;
|
|
22
17
|
exports.isValidLatLng = isValidLatLng;
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
Object.defineProperty(exports, "coordsToString", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _deprecated.coordsToString;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "getDetailText", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _deprecated.getDetailText;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "latlngToString", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _deprecated.latlngToString;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
25
36
|
|
|
26
37
|
var _itinerary = require("./itinerary");
|
|
27
38
|
|
|
28
|
-
|
|
29
|
-
return latlng && `${latlng.lat.toFixed(5)}, ${(latlng.lng || latlng.lon).toFixed(5)}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function coordsToString(coords) {
|
|
33
|
-
return coords.length && coords.map(c => (+c).toFixed(5)).join(", ");
|
|
34
|
-
}
|
|
39
|
+
var _deprecated = require("./deprecated");
|
|
35
40
|
|
|
36
41
|
function currentPositionToLocation(currentPosition) {
|
|
37
42
|
if (currentPosition.error || !currentPosition.coords) {
|
|
@@ -42,7 +47,6 @@ function currentPositionToLocation(currentPosition) {
|
|
|
42
47
|
return {
|
|
43
48
|
lat: currentPosition.coords.latitude,
|
|
44
49
|
lon: currentPosition.coords.longitude,
|
|
45
|
-
name: "(Current Location)",
|
|
46
50
|
category: "CURRENT_LOCATION"
|
|
47
51
|
};
|
|
48
52
|
}
|
|
@@ -53,33 +57,20 @@ function stringToCoords(str) {
|
|
|
53
57
|
|
|
54
58
|
function constructLocation(latlng) {
|
|
55
59
|
return {
|
|
56
|
-
name: latlngToString(latlng),
|
|
57
60
|
lat: latlng.lat,
|
|
58
61
|
lon: latlng.lng
|
|
59
62
|
};
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (location.type === "home" || location.type === "work") {
|
|
66
|
-
detailText = location.name;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (location.type === "stop") {
|
|
70
|
-
detailText = location.id;
|
|
71
|
-
} else if (location.type === "recent" && location.timestamp) {
|
|
72
|
-
detailText = (0, _moment.default)(location.timestamp).fromNow();
|
|
65
|
+
function formatStoredPlaceName(location, withDetails = true) {
|
|
66
|
+
if (withDetails) {
|
|
67
|
+
(0, _deprecated.logDeprecationWarning)("the formatStoredPlaceName withDetails parameter");
|
|
73
68
|
}
|
|
74
69
|
|
|
75
|
-
return detailText;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function formatStoredPlaceName(location, withDetails = true) {
|
|
79
70
|
let displayName = location.type === "home" || location.type === "work" ? (0, _itinerary.toSentenceCase)(location.type) : location.name;
|
|
80
71
|
|
|
81
72
|
if (withDetails) {
|
|
82
|
-
const detailText = getDetailText(location);
|
|
73
|
+
const detailText = (0, _deprecated.getDetailText)(location);
|
|
83
74
|
if (detailText) displayName += ` (${detailText})`;
|
|
84
75
|
}
|
|
85
76
|
|
|
@@ -115,6 +106,7 @@ function itineraryToTransitive(itin, companies, getRouteLabel, disableFlexArc) {
|
|
|
115
106
|
let patternId = 0;
|
|
116
107
|
const journey = {
|
|
117
108
|
journey_id: "itin",
|
|
109
|
+
// This string is not shown in the UI
|
|
118
110
|
journey_name: "Iterarary-derived Journey",
|
|
119
111
|
segments: []
|
|
120
112
|
}; // add 'from' and 'to' places to the tdata places array
|
|
@@ -188,6 +180,7 @@ function itineraryToTransitive(itin, companies, getRouteLabel, disableFlexArc) {
|
|
|
188
180
|
});
|
|
189
181
|
tdata.places.push({
|
|
190
182
|
place_id: toPlaceId,
|
|
183
|
+
// This string is not shown in the UI
|
|
191
184
|
place_name: (0, _itinerary.getPlaceName)(leg.to, companies),
|
|
192
185
|
place_lat: leg.to.lat,
|
|
193
186
|
place_lon: leg.to.lon
|
|
@@ -212,6 +205,7 @@ function itineraryToTransitive(itin, companies, getRouteLabel, disableFlexArc) {
|
|
|
212
205
|
const ptnId = `ptn_${patternId}`;
|
|
213
206
|
const pattern = {
|
|
214
207
|
pattern_id: ptnId,
|
|
208
|
+
// This string is not shown in the UI
|
|
215
209
|
pattern_name: `Pattern ${patternId}`,
|
|
216
210
|
route_id: leg.routeId,
|
|
217
211
|
stops: []
|