mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
refs #748 Support database format in CAirportDataReader
* CAirport is now database object * CAirportList is now datastore object list * CAirportDataReader adjustments
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a4b5b28cc1
commit
cf3e9f1f67
@@ -74,6 +74,24 @@ namespace BlackMisc
|
||||
setPosition(pos);
|
||||
}
|
||||
|
||||
CAirport CAirport::fromDatabaseJson(const QJsonObject &json, const QString &prefix)
|
||||
{
|
||||
CAirport airport(json.value("icao").toString());
|
||||
airport.setDescriptiveName(json.value("name").toString());
|
||||
airport.setElevation(CLength(json.value("altitude").toInt(), CLengthUnit::ft()));
|
||||
CCoordinateGeodetic pos(json.value("latitude").toDouble(), json.value("longitude").toDouble(), 0);
|
||||
airport.setPosition(pos);
|
||||
|
||||
if (json.value("alpha3").isString() && json.value("country").isString())
|
||||
{
|
||||
CCountry country(json.value("alpha3").toString(), json.value("country").toString());
|
||||
airport.setCountry(country);
|
||||
}
|
||||
|
||||
airport.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
return airport;
|
||||
}
|
||||
|
||||
CVariant CAirport::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
|
||||
Reference in New Issue
Block a user