map: show polylines by default
This commit is contained in:
parent
7e92e6b5d4
commit
aa7a7db2bc
4 changed files with 49 additions and 9 deletions
|
@ -3641,7 +3641,6 @@ sub startup {
|
||||||
$authed_r->post('/account/privacy')->to('account#privacy');
|
$authed_r->post('/account/privacy')->to('account#privacy');
|
||||||
$authed_r->post('/account/hooks')->to('account#webhook');
|
$authed_r->post('/account/hooks')->to('account#webhook');
|
||||||
$authed_r->post('/account/insight')->to('account#insight');
|
$authed_r->post('/account/insight')->to('account#insight');
|
||||||
$authed_r->post('/history/map')->to('traveling#map_history');
|
|
||||||
$authed_r->post('/journey/add')->to('traveling#add_journey_form');
|
$authed_r->post('/journey/add')->to('traveling#add_journey_form');
|
||||||
$authed_r->post('/journey/comment')->to('traveling#comment_form');
|
$authed_r->post('/journey/comment')->to('traveling#comment_form');
|
||||||
$authed_r->post('/journey/edit')->to('traveling#edit_journey');
|
$authed_r->post('/journey/edit')->to('traveling#edit_journey');
|
||||||
|
|
|
@ -439,7 +439,12 @@ sub map_history {
|
||||||
|
|
||||||
my $location = $self->app->coordinates_by_station;
|
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 );
|
my @journeys = $self->get_user_travels( with_polyline => $with_polyline );
|
||||||
|
|
||||||
|
@ -470,8 +475,18 @@ sub map_history {
|
||||||
my %seen;
|
my %seen;
|
||||||
|
|
||||||
my @skipped_journeys;
|
my @skipped_journeys;
|
||||||
|
my @polyline_journeys = grep { $_->{polyline} } @journeys;
|
||||||
|
my @beeline_journeys = grep { not $_->{polyline} } @journeys;
|
||||||
|
|
||||||
for my $journey ( grep { $_->{polyline} } @journeys ) {
|
if ( $route_type eq 'polyline' ) {
|
||||||
|
@beeline_journeys = ();
|
||||||
|
}
|
||||||
|
elsif ( $route_type eq 'beeline' ) {
|
||||||
|
push( @beeline_journeys, @polyline_journeys );
|
||||||
|
@polyline_journeys = ();
|
||||||
|
}
|
||||||
|
|
||||||
|
for my $journey (@polyline_journeys) {
|
||||||
my @polyline = @{ $journey->{polyline} };
|
my @polyline = @{ $journey->{polyline} };
|
||||||
my $from_eva = $journey->{from_eva};
|
my $from_eva = $journey->{from_eva};
|
||||||
my $to_eva = $journey->{to_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} };
|
my @route = map { $_->[0] } @{ $journey->{route} };
|
||||||
|
|
||||||
|
@ -612,7 +627,7 @@ sub map_history {
|
||||||
{
|
{
|
||||||
polylines => \@coord_pairs,
|
polylines => \@coord_pairs,
|
||||||
color => '#673ab7',
|
color => '#673ab7',
|
||||||
opacity => 0.9,
|
opacity => 0.8,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
bounds => [ [ $min_lat, $min_lon ], [ $max_lat, $max_lon ] ],
|
bounds => [ [ $min_lat, $min_lon ], [ $max_lat, $max_lon ] ],
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12">
|
<div class="col s12">
|
||||||
<span style="color: #f03;">●</span> Ein-/Ausstiegsstation<br/>
|
<span style="color: #f03;">●</span> Ein-/Ausstiegsstation<br/>
|
||||||
<span style="color: #673ab7;">—</span> Luftlinie zwischen Unterwegshalten
|
<span style="color: #673ab7;">—</span> Streckenverlauf oder Luftlinie
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,34 @@
|
||||||
|
|
||||||
%= include '_map', station_coordinates => $station_coordinates, polyline_groups => $polyline_groups
|
%= include '_map', station_coordinates => $station_coordinates, polyline_groups => $polyline_groups
|
||||||
|
|
||||||
%= form_for '/history/map' => (method => 'POST') => begin
|
%= form_for '/history/map' => begin
|
||||||
%= csrf_field
|
<p>
|
||||||
|
Detailgrad und Filter:
|
||||||
|
</p>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<label>
|
||||||
|
%= radio_button route_type => 'polyline'
|
||||||
|
<span>Nur Zugfahrten mit bekanntem Streckenverlauf eintragen</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<label>
|
||||||
|
%= radio_button route_type => 'polybee'
|
||||||
|
<span>Streckenverlauf wenn bekannt, sonst Luftlinie zwischen Unterweghalten</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<label>
|
||||||
|
%= radio_button route_type => 'beeline'
|
||||||
|
<span>Immer Luftlinie zwischen Unterwegshalten zeigen</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="input-field col s12">
|
<div class="input-field col s12">
|
||||||
<label>
|
<label>
|
||||||
|
@ -23,7 +49,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12 center-align">
|
<div class="col s12 center-align">
|
||||||
<button class="btn wave-effect waves-light" type="submit" name="action" value="go">
|
<button class="btn wave-effect waves-light" type="submit">
|
||||||
Anzeigen
|
Anzeigen
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue