line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Travel::Status::DE::HAFAS::Stop; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# vim:foldmethod=marker |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
7
|
1
|
|
|
1
|
|
30
|
use 5.014; |
|
1
|
|
|
|
|
4
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use parent 'Class::Accessor'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '4.17'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Travel::Status::DE::HAFAS::Stop->mk_ro_accessors( |
14
|
|
|
|
|
|
|
qw(eva name lat lon distance_m weight)); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# {{{ Constructor |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
0
|
|
|
0
|
1
|
|
my ( $obj, %opt ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $loc = $opt{loc}; |
22
|
|
|
|
|
|
|
my $ref = { |
23
|
|
|
|
|
|
|
eva => $loc->{extId} + 0, |
24
|
|
|
|
|
|
|
name => $loc->{name}, |
25
|
|
|
|
|
|
|
lat => $loc->{crd}{y} * 1e-6, |
26
|
|
|
|
|
|
|
lon => $loc->{crd}{x} * 1e-6, |
27
|
|
|
|
|
|
|
weight => $loc->{wt}, |
28
|
|
|
|
|
|
|
distance_m => $loc->{dist}, |
29
|
0
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
if ( $opt{extra} ) { |
32
|
0
|
|
|
|
|
|
while ( my ( $k, $v ) = each %{ $opt{extra} } ) { |
|
0
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$ref->{$k} = $v; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
bless( $ref, $obj ); |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return $ref; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# }}} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub TO_JSON { |
45
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $ret = { %{$self} }; |
|
0
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
for my $k ( keys %{$ret} ) { |
|
0
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
if ( ref( $ret->{$k} ) eq 'DateTime' ) { |
51
|
0
|
|
|
|
|
|
$ret->{$k} = $ret->{$k}->epoch; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return $ret; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 NAME |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Travel::Status::DE::HAFAS::Stop - Information about a HAFAS stop. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SYNOPSIS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# in geoSearch mode |
69
|
|
|
|
|
|
|
for my $stop ($status->results) { |
70
|
|
|
|
|
|
|
printf( |
71
|
|
|
|
|
|
|
"%5.1f km %8d %s\n", |
72
|
|
|
|
|
|
|
$result->distance_m * 1e-3, |
73
|
|
|
|
|
|
|
$result->eva, $result->name |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 VERSION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
version 4.17 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 DESCRIPTION |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Travel::Status::DE::HAFAS::Stop describes a HAFAS stop. It may be part of a |
84
|
|
|
|
|
|
|
journey or part of a geoSearch / locationSearch request. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Journey-, geoSearch- and locationSearch-specific accessors are annotated |
87
|
|
|
|
|
|
|
accordingly and return undef in other contexts. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 METHODS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 ACCESSORS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=over |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item $stop->name |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Stop name, e.g. "Essen Hbf" or "Unter den Linden/B75, Tostedt". |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item $stop->eva |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
EVA ID, e.g. 8000080. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item $stop->lat |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Stop latitude (WGS-84) |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item $stop->lon |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Stop longitude (WGS-84) |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item $stop->distance_m (geoSearch) |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Distance in meters between the requested coordinates and this stop. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item $stop->weight |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Weight / Relevance / Importance of this stop using an unknown metric. |
118
|
|
|
|
|
|
|
Higher values indicate more relevant stops. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item $stop->rt_arr (journey) |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
DateTime object for actual arrival. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item $stop->sched_arr (journey) |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
DateTime object for scheduled arrival. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item $stop->arr (journey) |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
DateTime object for actual or scheduled arrival. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item $stop->arr_delay (journey) |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Arrival delay in minutes. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item $stop->arr_cancelled (journey) |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Arrival is cancelled. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item $stop->rt_dep (journey) |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
DateTime object for actual departure. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item $stop->sched_dep (journey) |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
DateTime object for scheduled departure. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item $stop->dep (journey) |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
DateTIme object for actual or scheduled departure. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item $stop->dep_delay (journey) |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Departure delay in minutes. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item $stop->dep_cancelled (journey) |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Departure is cancelled. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item $stop->delay (journey) |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Departure or arrival delay in minutes. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item $stop->direction (journey) |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Direction signage from this stop on, undef if unchanged. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item $stop->rt_platform (journey) |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Actual platform. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item $stop->sched_platform (journey) |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Scheduled platform. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item $stop->platform (journey) |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Actual or scheduled platform. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item $stop->is_changed_platform (journey) |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
True if real-time and scheduled platform disagree. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item $stop->load (journey) |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Expected utilization / passenger load from this stop on. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=back |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
None. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=over |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item Class::Accessor(3pm) |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=back |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
None known. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head1 SEE ALSO |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
Travel::Status::DE::HAFAS(3pm). |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head1 AUTHOR |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Copyright (C) 2023 by Birthe Friesel E<lt>derf@finalrewind.orgE<gt> |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head1 LICENSE |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
This module is licensed under the same terms as Perl itself. |