mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T229, adjusted CInterpolationStatus
* The `changed`flag in interpolation was faulty. * It was able to determine if the value was really changed by interpolation, which was the same as indicating that the value was interpolated. * But there were cases, when the value was interpolated and not changed. * Also there were cases when the value was changed, but not interpolated.
This commit is contained in:
@@ -373,39 +373,32 @@ namespace BlackMisc
|
||||
situation.setOnGround(CAircraftSituation::OnGround, CAircraftSituation::OnGroundByGuessing);
|
||||
}
|
||||
|
||||
void CInterpolationStatus::setInterpolationSucceeded(bool succeeded, const CAircraftSituation &situation)
|
||||
void CInterpolationStatus::setInterpolatedAndCheckSituation(bool succeeded, const CAircraftSituation &situation)
|
||||
{
|
||||
m_interpolationSucceeded = succeeded;
|
||||
this->setValidSituation(situation);
|
||||
m_isInterpolated = succeeded;
|
||||
this->checkIfValidSituation(situation);
|
||||
}
|
||||
|
||||
void CInterpolationStatus::setValidSituation(const CAircraftSituation &situation)
|
||||
void CInterpolationStatus::checkIfValidSituation(const CAircraftSituation &situation)
|
||||
{
|
||||
m_validSituation = !situation.isGeodeticHeightNull() && !situation.isPositionNull();
|
||||
m_isValidSituation = !situation.isGeodeticHeightNull() && !situation.isPositionNull();
|
||||
}
|
||||
|
||||
bool CInterpolationStatus::validAndChangedInterpolatedSituation() const
|
||||
bool CInterpolationStatus::hasValidInterpolatedSituation() const
|
||||
{
|
||||
return m_interpolationSucceeded && m_changedPosition && m_validSituation;
|
||||
}
|
||||
|
||||
bool CInterpolationStatus::validInterpolatedSituation() const
|
||||
{
|
||||
return m_interpolationSucceeded && m_validSituation;
|
||||
return m_isInterpolated && m_isValidSituation;
|
||||
}
|
||||
|
||||
void CInterpolationStatus::reset()
|
||||
{
|
||||
m_validSituation = false;
|
||||
m_changedPosition = false;
|
||||
m_interpolationSucceeded = false;
|
||||
m_isValidSituation = false;
|
||||
m_isInterpolated = false;
|
||||
}
|
||||
|
||||
QString CInterpolationStatus::toQString() const
|
||||
{
|
||||
return "Interpolation: " % boolToYesNo(m_interpolationSucceeded) %
|
||||
" situation valid: " % boolToYesNo(m_interpolationSucceeded) %
|
||||
" changed pos.: " % boolToYesNo(m_changedPosition);
|
||||
return QStringLiteral("Interpolated: ") % boolToYesNo(m_isInterpolated) %
|
||||
QStringLiteral(" | situation valid: ") % boolToYesNo(m_isValidSituation);
|
||||
}
|
||||
|
||||
bool CPartsStatus::allTrue() const
|
||||
|
||||
@@ -147,31 +147,22 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! Did interpolation succeed?
|
||||
bool didInterpolationSucceed() const { return m_interpolationSucceeded; }
|
||||
bool isInterpolated() const { return m_isInterpolated; }
|
||||
|
||||
//! Set succeeded
|
||||
void setInterpolationSucceeded(bool succeeded) { m_interpolationSucceeded = succeeded; }
|
||||
void setInterpolated(bool interpolated) { m_isInterpolated = interpolated; }
|
||||
|
||||
//! Set succeeded
|
||||
void setInterpolationSucceeded(bool succeeded, const Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! Changed position?
|
||||
bool hasChangedPosition() const { return m_changedPosition; }
|
||||
void setInterpolatedAndCheckSituation(bool succeeded, const Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! Is the corresponding position valid?
|
||||
bool hasValidSituation() const { return m_validSituation; }
|
||||
|
||||
//! Is that a valid position?
|
||||
void setValidSituation(const Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! Set as changed
|
||||
void setChangedPosition(bool changed) { m_changedPosition = changed; }
|
||||
|
||||
//! Valid interpolated situation which also changed
|
||||
bool validAndChangedInterpolatedSituation() const;
|
||||
bool hasValidSituation() const { return m_isValidSituation; }
|
||||
|
||||
//! Valid interpolated situation
|
||||
bool validInterpolatedSituation() const;
|
||||
bool hasValidInterpolatedSituation() const;
|
||||
|
||||
//! Is that a valid position?
|
||||
void checkIfValidSituation(const Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! Reset to default values
|
||||
void reset();
|
||||
@@ -180,9 +171,8 @@ namespace BlackMisc
|
||||
QString toQString() const;
|
||||
|
||||
private:
|
||||
bool m_changedPosition = false; //!< position was changed
|
||||
bool m_interpolationSucceeded = false; //!< interpolation succeeded (means enough values, etc.)
|
||||
bool m_validSituation = false; //!< is valid situation
|
||||
bool m_isInterpolated = false; //!< position is interpolated (means enough values, etc.)
|
||||
bool m_isValidSituation = false; //!< is valid situation
|
||||
};
|
||||
|
||||
//! Status regarding parts
|
||||
|
||||
Reference in New Issue
Block a user