summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornetworkException <git@nwex.de>2025-04-06 16:37:45 +0200
committerBirte Friesel <derf@chaosdorf.de>2025-04-16 19:53:55 +0200
commit79bdd1a362b8829d00dc15df471b27e4c2f0d9f5 (patch)
tree68126e6487ed15b7a5223d9782cc5f0a5822827e
parent0385862974a55f0534f368f4ac27477a8ea37008 (diff)
Fix stop matching for DBRIS polylines
This patch fixes matching stops by name to route indices for DBRIS polylines. The format returned by Travel::Status::DE::DBRIS::Journey is slightly different to Travel::Status::DE::HAFAS::Journey, as it assigns a whole `stop` to a polyline coordinate, instead of `name` and `eva`. This fixes the train following train marker actually following DBRIS polylines.
-rw-r--r--lib/DBInfoscreen/Controller/Map.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/DBInfoscreen/Controller/Map.pm b/lib/DBInfoscreen/Controller/Map.pm
index adcb362..405b2e5 100644
--- a/lib/DBInfoscreen/Controller/Map.pm
+++ b/lib/DBInfoscreen/Controller/Map.pm
@@ -31,14 +31,16 @@ sub get_route_indexes {
for my $i ( 0 .. $#{$polyline} ) {
my $this_point = $polyline->[$i];
+ my $name = $this_point->{name} // $this_point->{stop}->{name};
+
if ( not defined $from_index
- and $this_point->{name}
- and $this_point->{name} eq $from_name )
+ and $name
+ and $name eq $from_name )
{
$from_index = $i;
}
- elsif ( $this_point->{name}
- and $this_point->{name} eq $to_name )
+ elsif ( $name
+ and $name eq $to_name )
{
$to_index = $i;
last;