Commit 07bc3dc7 authored by Volker Krause's avatar Volker Krause
Browse files

Do the fast pre-check for stations on a slightly enlarged bounding box

Further down we look for stations in proximity of terminals, even of those
extend beyond the airport bounds. Usually the bounding box check doesn't
drop those, as airports are rarely perfectly aligned with their bounding
box. There are exceptions to this though, as the SHA test case shows.
parent a8aefce2
......@@ -266,7 +266,7 @@ private Q_SLOTS:
QTest::newRow("REC") << s("REC") << -8.1314735f << -34.9177565f << 150;
QTest::newRow("RIG") << s("RIX") << 56.92188f << 23.97976f << 50;
QTest::newRow("SFO") << s("SFO") << 37.6162238f << -122.3915235f << 50;
QTest::newRow("SHA") << s("SHA") << 31.19624f << 121.32377f << 100;
QTest::newRow("SHA") << s("SHA") << 31.19624f << 121.32377f << 200;
QTest::newRow("STR") << s("STR") << 48.69052f << 9.19302f << 50;
QTest::newRow("SXB") << s("SXB") << 48.54444f << 7.62783f << 50;
QTest::newRow("SXF") << s("SXF") << 52.38856f << 13.51809f << 100;
......@@ -300,7 +300,6 @@ private Q_SLOTS:
QEXPECT_FAIL("PRG", "private/military terminals 3 and 4 interfering", Continue);
QEXPECT_FAIL("PVG", "complicated", Continue);
QEXPECT_FAIL("RIG", "open polygon in OSM", Continue);
QEXPECT_FAIL("SHA", "station not detected?", Continue);
QEXPECT_FAIL("SXF", "w630509626 (government terminal) interfering", Continue);
QVERIFY(d <= dist);
#endif
......
......@@ -253,7 +253,11 @@ void OSMAirportDb::loadStation(OSM::Element elem)
// we need the exact path here, the bounding box can contain a lot more stuff
// the bounding box check is just for speed
if (!OSM::contains(airport.bbox, elem.center())) {
// as we also look for stations in close proximity to terminals, we technically need a slightly larger bounding box though
// in most cases this just works, SHA being one of the counter examples due to perfect alignment with its bounding box
const auto adjustedBbox = OSM::BoundingBox(OSM::Coordinate(airport.bbox.min.latitude - 100'000, airport.bbox.min.longitude - 100'000),
OSM::Coordinate(airport.bbox.max.latitude + 100'000, airport.bbox.max.longitude + 100'000));
if (!OSM::contains(adjustedBbox, elem.center())) {
continue;
}
......
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