diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2020-01-31 18:16:00 +0100 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2020-01-31 18:16:00 +0100 |
commit | aa7a7db2bcd6ae8cf0caef37d436bcb2ae162d5b (patch) | |
tree | 65c2b81918636d935f4dfd7424812a4641f635b3 /lib/Travelynx | |
parent | 7e92e6b5d454ca61c77ed4ee217d179fc0038459 (diff) |
map: show polylines by default
Diffstat (limited to 'lib/Travelynx')
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index 4d3c7d5..e294c8c 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -439,7 +439,12 @@ sub map_history { my $location = $self->app->coordinates_by_station; - my $with_polyline = $self->param('poly') ? 1 : 0; + if ( not $self->param('route_type') ) { + $self->param( route_type => 'polybee' ); + } + + my $route_type = $self->param('route_type'); + my $with_polyline = $route_type eq 'beeline' ? 0 : 1; my @journeys = $self->get_user_travels( with_polyline => $with_polyline ); @@ -470,8 +475,18 @@ sub map_history { my %seen; my @skipped_journeys; + my @polyline_journeys = grep { $_->{polyline} } @journeys; + my @beeline_journeys = grep { not $_->{polyline} } @journeys; + + if ( $route_type eq 'polyline' ) { + @beeline_journeys = (); + } + elsif ( $route_type eq 'beeline' ) { + push( @beeline_journeys, @polyline_journeys ); + @polyline_journeys = (); + } - for my $journey ( grep { $_->{polyline} } @journeys ) { + for my $journey (@polyline_journeys) { my @polyline = @{ $journey->{polyline} }; my $from_eva = $journey->{from_eva}; my $to_eva = $journey->{to_eva}; @@ -514,7 +529,7 @@ sub map_history { } } - for my $journey ( grep { not $_->{polyline} } @journeys ) { + for my $journey (@beeline_journeys) { my @route = map { $_->[0] } @{ $journey->{route} }; @@ -612,7 +627,7 @@ sub map_history { { polylines => \@coord_pairs, color => '#673ab7', - opacity => 0.9, + opacity => 0.8, } ], bounds => [ [ $min_lat, $min_lon ], [ $max_lat, $max_lon ] ], |