Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit e545a748 authored by Volker Krause's avatar Volker Krause

Oops, don't mix up longitude and latitude

parent 9e53c9ef
......@@ -56,8 +56,8 @@ private Q_SLOTS:
{
auto coord = AirportDb::coordinateForAirport(AirportDb::IataCode{"TXL"});
QVERIFY(coord.isValid());
QCOMPARE((int)coord.latitude, 13);
QCOMPARE((int)coord.longitude, 52);
QCOMPARE((int)coord.longitude, 13);
QCOMPARE((int)coord.latitude, 52);
coord = AirportDb::coordinateForAirport(AirportDb::IataCode{"XXX"});
QVERIFY(!coord.isValid());
......@@ -66,11 +66,11 @@ private Q_SLOTS:
// test coordinate parsing corner cases
coord = AirportDb::coordinateForAirport(AirportDb::IataCode{"LCY"});
QCOMPARE((int)coord.latitude, 0);
QVERIFY(coord.latitude > 0.0f);
QCOMPARE((int)coord.longitude, 0);
QVERIFY(coord.longitude > 0.0f);
coord = AirportDb::coordinateForAirport(AirportDb::IataCode{"LHR"});
QCOMPARE((int)coord.latitude, 0);
QVERIFY(coord.latitude < 0.0f);
QCOMPARE((int)coord.longitude, 0);
QVERIFY(coord.longitude < 0.0f);
// Köln-Bonn is a hybrid civilian/military airport, so that should be included
coord = AirportDb::coordinateForAirport(AirportDb::IataCode{"CGN"});
......
......@@ -12,8 +12,8 @@
"@type": "Airport",
"geo": {
"@type": "GeoCoordinates",
"latitude": -77.45580291748047,
"longitude": 38.944400787353516
"longitude": -77.45580291748047,
"latitude": 38.944400787353516
},
"iataCode": "IAD",
"name": "Washington Dulles International Airport"
......@@ -23,8 +23,8 @@
"@type": "Airport",
"geo": {
"@type": "GeoCoordinates",
"latitude": -122.30899810791016,
"longitude": 47.44889831542969
"longitude": -122.30899810791016,
"latitude": 47.44889831542969
},
"iataCode": "SEA",
"name": "Seattle-Tacoma International Airport"
......
......@@ -31,22 +31,22 @@ namespace AirportDb {
/** Geographical coordinate. */
struct Coordinate {
inline constexpr Coordinate()
: latitude(NAN)
, longitude(NAN)
: longitude(NAN)
, latitude(NAN)
{
}
inline explicit constexpr Coordinate(float lat, float lng)
: latitude(lat)
, longitude(lng)
inline explicit constexpr Coordinate(float lng, float lat)
: longitude(lng)
, latitude(lat)
{
}
bool isValid() const;
bool operator==(const Coordinate &other) const;
float latitude;
float longitude;
float latitude;
};
/** IATA airport code. */
......
......@@ -83,8 +83,8 @@ static void addGoToMapAction(QMenu *menu, const QVariant &place)
url.setScheme(QStringLiteral("https"));
url.setHost(QStringLiteral("www.openstreetmap.org"));
url.setPath(QStringLiteral("/"));
const QString fragment = QLatin1String("map=12/") + JsonLdDocument::readProperty(geo, "longitude").toString()
+ QLatin1String("/") + JsonLdDocument::readProperty(geo, "latitude").toString();
const QString fragment = QLatin1String("map=12/") + JsonLdDocument::readProperty(geo, "latitude").toString()
+ QLatin1String("/") + JsonLdDocument::readProperty(geo, "longitude").toString();
url.setFragment(fragment);
QDesktopServices::openUrl(url);
});
......
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