refs #748 Add operating attribute to CAirport

This commit is contained in:
Michał Garapich
2016-10-11 01:46:10 +02:00
committed by Mathew Sutcliffe
parent cf3e9f1f67
commit 9acfb89e65
3 changed files with 18 additions and 1 deletions

View File

@@ -72,6 +72,8 @@ namespace BlackMisc
Q_ASSERT(json.value("longitude").isDouble());
CCoordinateGeodetic pos(json.value("latitude").toDouble(), json.value("longitude").toDouble(), 0);
setPosition(pos);
setOperating(json.value("operating").toString() == QStringLiteral("Y"));
}
CAirport CAirport::fromDatabaseJson(const QJsonObject &json, const QString &prefix)
@@ -81,6 +83,7 @@ namespace BlackMisc
airport.setElevation(CLength(json.value("altitude").toInt(), CLengthUnit::ft()));
CCoordinateGeodetic pos(json.value("latitude").toDouble(), json.value("longitude").toDouble(), 0);
airport.setPosition(pos);
airport.setOperating(json.value("operating").toString() == QStringLiteral("Y"));
if (json.value("alpha3").isString() && json.value("country").isString())
{
@@ -106,6 +109,8 @@ namespace BlackMisc
return this->m_position.propertyByIndex(index.copyFrontRemoved());
case IndexElevation:
return this->getElevation().propertyByIndex(index.copyFrontRemoved());
case IndexOperating:
return CVariant::from(this->isOperating());
default:
return (ICoordinateWithRelativePosition::canHandleIndex(index)) ?
ICoordinateWithRelativePosition::propertyByIndex(index) :
@@ -128,6 +133,9 @@ namespace BlackMisc
case IndexPosition:
this->m_position.setPropertyByIndex(index.copyFrontRemoved(), variant);
break;
case IndexOperating:
this->setOperating(variant.toBool());
break;
default:
if (ICoordinateWithRelativePosition::canHandleIndex(index))
{