mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
refs #748 Add operating attribute to CAirport
This commit is contained in:
committed by
Mathew Sutcliffe
parent
cf3e9f1f67
commit
9acfb89e65
@@ -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))
|
||||
{
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace BlackMisc
|
||||
IndexPosition,
|
||||
IndexCountry,
|
||||
IndexElevation,
|
||||
IndexOperating,
|
||||
};
|
||||
|
||||
//! Default constructor.
|
||||
@@ -98,6 +99,12 @@ namespace BlackMisc
|
||||
//! \sa setGeodeticHeight
|
||||
void setElevation(const BlackMisc::PhysicalQuantities::CLength &elevation) { return this->m_position.setGeodeticHeight(elevation); }
|
||||
|
||||
//! Is the airport still active?
|
||||
bool isOperating() const { return m_operating; }
|
||||
|
||||
//! Sets the value of \sa isOperating().
|
||||
void setOperating(bool operating) { m_operating = operating; }
|
||||
|
||||
//! \copydoc Geo::ICoordinateGeodetic::geodeticHeight
|
||||
//! \remarks this should be used for elevation as depicted here: http://en.wikipedia.org/wiki/Altitude#mediaviewer/File:Vertical_distances.svg
|
||||
const BlackMisc::PhysicalQuantities::CLength &geodeticHeight() const override { return this->m_position.geodeticHeight(); }
|
||||
@@ -146,6 +153,7 @@ namespace BlackMisc
|
||||
QString m_descriptiveName;
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_position;
|
||||
CCountry m_country;
|
||||
bool m_operating;
|
||||
|
||||
BLACK_METACLASS(
|
||||
CAirport,
|
||||
@@ -153,6 +161,7 @@ namespace BlackMisc
|
||||
BLACK_METAMEMBER(descriptiveName),
|
||||
BLACK_METAMEMBER(position),
|
||||
BLACK_METAMEMBER(country),
|
||||
BLACK_METAMEMBER(operating),
|
||||
BLACK_METAMEMBER(relativeDistance),
|
||||
BLACK_METAMEMBER(relativeBearing)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user