diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-08-14 22:00:15 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-08-14 22:00:15 +0200 |
commit | 655f69c2e956eaca9bb0ffc3cfbf947944d6b3fb (patch) | |
tree | 18afc3f04c00b85908661d36afff9d689548ab9f | |
parent | 43fc820e0c4843716c4de612538b17c72530d8e2 (diff) |
get_travel_distance: always return beeline distance2.8.18
-rwxr-xr-x | lib/Travelynx/Model/Journeys.pm | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm index 031b0b1..2a0a9ec 100755 --- a/lib/Travelynx/Model/Journeys.pm +++ b/lib/Travelynx/Model/Journeys.pm @@ -1128,16 +1128,16 @@ sub get_travel_distance { my $distance_polyline = 0; my $distance_intermediate = 0; - my $distance_beeline = 0; - my $skipped = 0; my $geo = GIS::Distance->new(); - my @route = after_incl { $_->[0] eq $from } @{$route_ref}; + my $distance_beeline + = $geo->distance_metal( @{$from_latlon}, @{$to_latlon} ); + my @route = after_incl { $_->[0] eq $from } @{$route_ref}; @route = before_incl { $_->[0] eq $to } @route; if ( @route < 2 ) { # I AM ERROR - return ( 0, 0, 0 ); + return ( 0, 0, $distance_beeline ); } my @polyline = after_incl { $_->[2] and $_->[2] == $from_eva } @@ -1155,7 +1155,7 @@ sub get_travel_distance { } if ( not( defined $route[0][2]{lat} and defined $route[0][2]{lon} ) ) { - return ( $distance_polyline, 0, 0 ); + return ( $distance_polyline, 0, $distance_beeline ); } $prev_station = shift @route; @@ -1169,10 +1169,7 @@ sub get_travel_distance { } } - $distance_beeline = $geo->distance_metal( @{$from_latlon}, @{$to_latlon} ); - - return ( $distance_polyline, $distance_intermediate, - $distance_beeline, $skipped ); + return ( $distance_polyline, $distance_intermediate, $distance_beeline ); } sub grep_single { |