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:
Michał Garapich
2016-09-16 01:36:07 +02:00
committed by Mathew Sutcliffe
parent a4b5b28cc1
commit cf3e9f1f67
11 changed files with 98 additions and 83 deletions

View File

@@ -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); }