[PQ] implemented "comparePropertyByIndex" for CAltitude for correct sorting

Bug report: https://discordapp.com/channels/539048679160676382/594962359441948682/651162172717662239
This commit is contained in:
Klaus Basan
2019-12-05 02:20:10 +01:00
committed by Mat Sutcliffe
parent e1498adc8e
commit fc9bb1277d
2 changed files with 13 additions and 4 deletions

View File

@@ -118,6 +118,12 @@ namespace BlackMisc
}
}
int CAltitude::comparePropertyByIndex(const CPropertyIndex &index, const CAltitude &compareValue) const
{
if (index.isMyself()) { return this->compare(compareValue); }
return CLength::comparePropertyByIndex(index, compareValue);
}
bool CAltitude::toFlightLevel()
{
if (m_datum != MeanSeaLevel && m_datum != FlightLevel) { return false; }

View File

@@ -45,7 +45,7 @@ namespace BlackMisc
public PhysicalQuantities::CLength,
public Mixin::MetaType<CAltitude>,
public Mixin::EqualsByMetaClass<CAltitude>,
public Mixin::CompareByMetaClass<CAltitude>,
// public Mixin::CompareByMetaClass<CAltitude>,
public Mixin::HashByMetaClass<CAltitude>,
public Mixin::DBusByMetaClass<CAltitude>,
public Mixin::DBusByMetaClass<CAltitude, LosslessTag>,
@@ -88,9 +88,6 @@ namespace BlackMisc
TrueAltitude //!< Height of the airplane above Mean Sea Level (MSL)
};
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;
//! Default constructor: 0m Altitude MSL
CAltitude() : CLength(0, PhysicalQuantities::CLengthUnit::m()), m_datum(MeanSeaLevel) {}
@@ -197,6 +194,12 @@ namespace BlackMisc
//! \copydoc PhysicalQuantities::CPhysicalQuantity::compare
int compare(const CAltitude &otherAltitude) const;
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;
//! \copydoc Mixin::Index::setPropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CAltitude &compareValue) const;
//! Round to the nearest 100ft, like needed for China and Russia
//! \remark https://en.wikipedia.org/wiki/Flight_level
CAltitude roundedToNearest100ft(bool roundDown) const;