summaryrefslogtreecommitdiff
path: root/lib/Travel/Routing/DE/EFA.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-06-16 22:28:53 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-06-16 22:28:53 +0200
commitffbf7ca613885ce8093cc4325d04cd14e147ab80 (patch)
tree8f712aaa60ae9d695b9b660bb07e8970c842e282 /lib/Travel/Routing/DE/EFA.pm
parent7e3cd10ffba1b29cea5fc48e518884cb0aa67cd2 (diff)
parse footpaths, print them when efa -E is used
Diffstat (limited to 'lib/Travel/Routing/DE/EFA.pm')
-rw-r--r--lib/Travel/Routing/DE/EFA.pm23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/Travel/Routing/DE/EFA.pm b/lib/Travel/Routing/DE/EFA.pm
index ec61caa..2ff9f64 100644
--- a/lib/Travel/Routing/DE/EFA.pm
+++ b/lib/Travel/Routing/DE/EFA.pm
@@ -514,7 +514,10 @@ sub parse_xml_part {
= XML::LibXML::XPathExpression->new('./itdDateTimeTarget/itdDate');
my $xp_stime
= XML::LibXML::XPathExpression->new('./itdDateTimeTarget/itdTime');
- my $xp_mot = XML::LibXML::XPathExpression->new('./itdMeansOfTransport');
+ my $xp_mot = XML::LibXML::XPathExpression->new('./itdMeansOfTransport');
+ my $xp_fp = XML::LibXML::XPathExpression->new('./itdFootPathInfo');
+ my $xp_fp_e
+ = XML::LibXML::XPathExpression->new('./itdFootPathInfo/itdFootPathElem');
my $xp_delay = XML::LibXML::XPathExpression->new('./itdRBLControlled');
my $xp_info
= XML::LibXML::XPathExpression->new('./itdInfoTextList/infoTextListElem');
@@ -557,11 +560,13 @@ sub parse_xml_part {
my $e_astime = ( $e_arr->findnodes($xp_stime) )[0];
my $e_mot = ( $e->findnodes($xp_mot) )[0];
my $e_delay = ( $e->findnodes($xp_delay) )[0];
+ my $e_fp = ( $e->findnodes($xp_fp) )[0];
my @e_info = $e->findnodes($xp_info);
my @e_dmap_rm = $e_dep->findnodes($xp_mapitem_rm);
my @e_dmap_sm = $e_dep->findnodes($xp_mapitem_sm);
my @e_amap_rm = $e_arr->findnodes($xp_mapitem_rm);
my @e_amap_sm = $e_arr->findnodes($xp_mapitem_sm);
+ my @e_fp_e = $e->findnodes($xp_fp_e);
# not all EFA services distinguish between scheduled and realtime
# data. Set sdate / stime to date / time when not provided.
@@ -608,6 +613,22 @@ sub parse_xml_part {
$hash->{$key} = decode( 'UTF-8', $hash->{$key} );
}
+ if ($e_fp) {
+
+ # Note that position=IDEST footpaths are coupled with a special
+ # "walking" connection, so their duration is already known and
+ # accounted for. However, we still save it here, since
+ # detecting and handling this is the API client's job (for now).
+ $hash->{footpath_type} = $e_fp->getAttribute('position');
+ $hash->{footpath_duration} = $e_fp->getAttribute('duration');
+ for my $e (@e_fp_e) {
+ push(
+ @{ $hash->{footpath_parts} },
+ [ $e->getAttribute('type'), $e->getAttribute('level') ]
+ );
+ }
+ }
+
$hash->{departure_routemaps} = \@dep_rms;
$hash->{departure_stationmaps} = \@dep_sms;
$hash->{arrival_routemaps} = \@arr_rms;