Commit 21c8e0bb authored by Volker Krause's avatar Volker Krause
Browse files

Parse location type from EFA location query responses when present

parent df321725
......@@ -6,6 +6,7 @@
"latitude": 49.80179977416992,
"locality": "Würzburg",
"longitude": 9.935779571533203,
"name": "Hauptbahnhof"
"name": "Hauptbahnhof",
"type": "Stop"
}
]
......@@ -6,7 +6,8 @@
},
"latitude": 48.14030838012695,
"longitude": 11.56112003326416,
"name": "München, Hauptbahnhof"
"name": "München, Hauptbahnhof",
"type": "Stop"
},
{
"identifier": {
......@@ -15,6 +16,7 @@
},
"latitude": 48.14115905761719,
"longitude": 11.560790061950684,
"name": "München, Hauptbahnhof Nord"
"name": "München, Hauptbahnhof Nord",
"type": "Stop"
}
]
......@@ -5,7 +5,8 @@
},
"latitude": 41.98918914794922,
"longitude": -87.88291931152344,
"name": "O'hare Airport Kiss-N-Fly Chicago"
"name": "O'hare Airport Kiss-N-Fly Chicago",
"type": "Stop"
},
{
"identifier": {
......
......@@ -35,8 +35,11 @@ Location EfaCompactParser::parseCompactSf(ScopedXmlStreamReader &&reader) const
if (reader.name() == QLatin1String("n")) {
loc.setName(reader.readElementText());
} else if (reader.name() == QLatin1String("ty")) {
if (reader.readElementText() != QLatin1String("stop")) {
return {};
const auto type = reader.readElementText();
if (type == QLatin1String("stop")) {
loc.setType(Location::Stop);
} else {
qCDebug(Log) << "unhandled location type:" << type;
}
} else if (reader.name() == QLatin1String("r")) {
auto sub = reader.subReader();
......
......@@ -47,6 +47,13 @@ void EfaXmlParser::parseLocationCommon(Location &loc, const ScopedXmlStreamReade
break;
}
}
const auto type = reader.attributes().value(QLatin1String("anyType"));
if (type == QLatin1String("stop")) {
loc.setType(Location::Stop);
} else if (!type.isEmpty()) {
qCDebug(Log) << "Unhandled EFA location type:" << type;
}
}
Location EfaXmlParser::parseItdOdvAssignedStop(const ScopedXmlStreamReader &reader) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment