Commit 477a06c3 authored by Volker Krause's avatar Volker Krause
Browse files

Make coordinate-based OJP journey queries work

This is also the prerequisite for implementing parsing of walking sections
and turn description.
parent 73cb9cb9
Pipeline #79192 passed with stage
in 17 seconds
......@@ -6,7 +6,13 @@
<ojp:OJPTripRequest>
<ojp:Origin>
<ojp:PlaceRef>
<ojp:StopPlaceRef>8501687</ojp:StopPlaceRef>
<ojp:GeoPosition>
<siri:Longitude>7.78</siri:Longitude>
<siri:Latitude>46.1</siri:Latitude>
</ojp:GeoPosition>
<ojp:LocationName>
<ojp:Text>Randa</ojp:Text>
</ojp:LocationName>
</ojp:PlaceRef>
</ojp:Origin>
<ojp:Destination>
......
......@@ -6,7 +6,13 @@
<ojp:OJPTripRequest>
<ojp:Origin>
<ojp:PlaceRef>
<ojp:StopPlaceRef>8501687</ojp:StopPlaceRef>
<ojp:GeoPosition>
<siri:Longitude>7.78</siri:Longitude>
<siri:Latitude>46.1</siri:Latitude>
</ojp:GeoPosition>
<ojp:LocationName>
<ojp:Text> </ojp:Text>
</ojp:LocationName>
</ojp:PlaceRef>
<ojp:DepArrTime>2020-09-06T20:54:00Z</ojp:DepArrTime>
</ojp:Origin>
......
......@@ -110,7 +110,7 @@ private Q_SLOTS:
QTest::addColumn<QString>("refFileName");
Location from;
from.setIdentifier(QStringLiteral("uic"), QStringLiteral("8501687"));
from.setCoordinate(46.1, 7.78);
Location to;
to.setIdentifier(QStringLiteral("uic"), QStringLiteral("8500010"));
JourneyRequest req;
......@@ -122,6 +122,8 @@ private Q_SLOTS:
req.setIncludeIntermediateStops(true);
req.setIncludePaths(false);
QTest::newRow("journey-departure") << req << s(SOURCE_DIR "/data/ojp-request/journey-departure.xml");
from.setName(QStringLiteral("Randa"));
req.setFrom(from);
req.setIncludeIntermediateStops(false);
req.setIncludePaths(true);
req.setDateTimeMode(JourneyRequest::Arrival);
......
......@@ -34,9 +34,7 @@ bool OpenJourneyPlannerBackend::needsLocationQuery(const Location &loc, Abstract
if (!loc.identifier(QStringLiteral("uic")).isEmpty()) {// ### TODO configure identifier type
return false;
}
// TODO according to the docs this is supposed to work?
//return !loc.hasCoordinate() || type != AbstractBackend::QueryType::Journey;
return true;
return !loc.hasCoordinate() || type != AbstractBackend::QueryType::Journey;
}
bool OpenJourneyPlannerBackend::queryLocation(const LocationRequest &request, LocationReply *reply, QNetworkAccessManager *nam) const
......
......@@ -168,6 +168,10 @@ void OpenJourneyPlannerRequestBuilder::writePlaceRef(QXmlStreamWriter &w, const
w.writeTextElement(siriNS(), QStringLiteral("Longitude"), QString::number(loc.longitude()));
w.writeTextElement(siriNS(), QStringLiteral("Latitude"), QString::number(loc.latitude()));
w.writeEndElement(); // </ojp:GeoPosition>
w.writeStartElement(ojpNS(), QStringLiteral("LocationName"));
w.writeTextElement(ojpNS(), QStringLiteral("Text"), loc.name().isEmpty() ? QStringLiteral(" ") : loc.name());
w.writeEndElement(); // </ojp:LocationName>
}
w.writeEndElement(); // </ojp:PlaceRef>
}
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