This commit is contained in:
Klaus Basan
2018-07-07 19:52:43 +02:00
parent 53a7ef2df3
commit ead1a93597
16 changed files with 93 additions and 90 deletions

View File

@@ -31,7 +31,7 @@ namespace BlackMisc
CAltitude CAltitude::withOffset(const CLength &offset) const
{
if (this->isNull()) { return CAltitude(offset, CAltitude::MeanSeaLevel); }
if (this->isNull()) { return CAltitude::null(); }
CAltitude copy(*this);
if (!offset.isNull() && !offset.isZeroEpsilonConsidered())
{

View File

@@ -83,7 +83,7 @@ namespace BlackMisc
//! Normal vector with double precision
virtual std::array<double, 3> normalVectorDouble() const = 0;
//! Is equal, epsilon considered?
//! Is equal? Epsilon considered.
bool equalNormalVectorDouble(const std::array<double, 3> &otherVector) const;
//! Is equal, epsilon considered?
@@ -120,7 +120,7 @@ namespace BlackMisc
//! \copydoc Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
//! Compare by index
//! \copydoc Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateGeodetic &compareValue) const;
//! \copydoc Mixin::String::toQString
@@ -184,7 +184,7 @@ namespace BlackMisc
//! \copydoc Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
//! Compare by index
//! \copydoc Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateWithRelativePosition &compareValue) const;
//! \copydoc Mixin::String::toQString

View File

@@ -286,6 +286,11 @@ namespace BlackMisc
int Index<Derived>::comparePropertyByIndex(const CPropertyIndex &index, const Derived &compareValue) const
{
if (this == &compareValue) { return 0; }
if (index.isMyself()) {
// slow, only last resort
return derived()->toQString().compare(compareValue.toQString());
}
const auto i = index.frontCasted<ColumnIndex>();
switch (i)
{
@@ -295,6 +300,8 @@ namespace BlackMisc
default:
break;
}
// slow, only last resort
return derived()->toQString().compare(compareValue.toQString());
}
} // Mixin

View File

@@ -246,10 +246,10 @@ namespace BlackMisc
// list from new to old
CAircraftSituationList updatedSituations; // copy of updated situations
{
const qint64 ts = QDateTime::currentMSecsSinceEpoch();
const qint64 now = QDateTime::currentMSecsSinceEpoch();
QWriteLocker lock(&m_lockSituations);
m_situationsAdded++;
m_situationsLastModified[cs] = ts;
m_situationsLastModified[cs] = now;
CAircraftSituationList &newSituationsList = m_situationsByCallsign[cs];
newSituationsList.setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst);
const int situations = newSituationsList.size();
@@ -469,7 +469,7 @@ namespace BlackMisc
if (!this->isAircraftInRange(callsign)) { return 0; }
// update aircraft situation
const qint64 ts = QDateTime::currentMSecsSinceEpoch();
const qint64 now = QDateTime::currentMSecsSinceEpoch();
const CAircraftModel model = this->getAircraftInRangeModelForCallsign(callsign);
CAircraftSituationChange change;
int updated = 0;
@@ -479,11 +479,11 @@ namespace BlackMisc
if (situations.isEmpty()) { return 0; }
updated = situations.setGroundElevationCheckedAndGuessGround(elevation, info, model, &change);
if (updated < 1) { return 0; }
m_situationsLastModified[callsign] = ts;
const CAircraftSituation latest = situations.front();
if (info == CAircraftSituation::FromProvider && latest.isOnGround())
m_situationsLastModified[callsign] = now;
const CAircraftSituation latestSituation = situations.front();
if (info == CAircraftSituation::FromProvider && latestSituation.isOnGround())
{
m_latestOnGroundProviderElevation[callsign] = latest;
m_latestOnGroundProviderElevation[callsign] = latestSituation;
}
}