From 79bdd1a362b8829d00dc15df471b27e4c2f0d9f5 Mon Sep 17 00:00:00 2001 From: networkException Date: Sun, 6 Apr 2025 16:37:45 +0200 Subject: 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. --- lib/DBInfoscreen/Controller/Map.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/DBInfoscreen/Controller/Map.pm') 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; -- cgit v1.2.3