[gnome-maps/wip/mlundblad/resrobot-tourist-trains: 2/2] resrobot: Override tourist trains
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/resrobot-tourist-trains: 2/2] resrobot: Override tourist trains
- Date: Mon, 27 Jun 2022 21:06:01 +0000 (UTC)
commit 39304b39d9298d9d2f33c8c0f24a2ffed7515d09
Author: Marcus Lundblad <ml dfupdate se>
Date: Mon Jun 27 23:03:57 2022 +0200
resrobot: Override tourist trains
Override the route type for selected
heritage railway operators to show
the tourist train icon on journey legs.
src/transitplugins/resrobot.js | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/transitplugins/resrobot.js b/src/transitplugins/resrobot.js
index 7ce42d08..d019640e 100644
--- a/src/transitplugins/resrobot.js
+++ b/src/transitplugins/resrobot.js
@@ -88,7 +88,12 @@ const WALK_SEARCH_RADIUS = 2000;
// maximum distance for walk-only journey
const MAX_WALK_ONLY_DISTANCE = 2500;
-const TOURIST_TRAIN_AGENCIES = new Set(['Lennakatten']);
+/* set of transit agencies where "regional rail" is interpreted as
+ * HVT.TOURIST_RAILWAY_SERVICE, e.g. heritage rail
+ */
+const TOURIST_TRAIN_AGENCIES = new Set(['Engelsberg-Norbergs Jä',
+ 'Lennakatten',
+ 'TJF Smalspåret']);
export class Resrobot {
constructor(params) {
@@ -440,9 +445,15 @@ export class Resrobot {
let polyline = this._createPolylineForLeg(leg);
let duration = leg.duration ? this._parseDuration(leg.duration) : null;
- if (routeType === HVT.REGIONAL_RAIL_SERVICE &&
- TOURIST_TRAIN_AGENCIES.has(agencyName))
+ /* if the route leg is classified as regional rail and the agency
+ * is one of the heritage railways, use tourist rail to get the
+ * steam train icon
+ */
+ if ((routeType === HVT.REGIONAL_RAIL_SERVICE ||
+ routeType === HVT.SUBURBAN_RAILWAY_SERVICE ) &&
+ TOURIST_TRAIN_AGENCIES.has(agencyName)) {
routeType = HVT.TOURIST_RAILWAY_SERVICE;
+ }
let result = new Leg({ departure: departure,
arrival: arrival,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]