mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 12:15:29 +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);
|
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;
|
m_isInterpolated = succeeded;
|
||||||
this->setValidSituation(situation);
|
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;
|
return m_isInterpolated && m_isValidSituation;
|
||||||
}
|
|
||||||
|
|
||||||
bool CInterpolationStatus::validInterpolatedSituation() const
|
|
||||||
{
|
|
||||||
return m_interpolationSucceeded && m_validSituation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInterpolationStatus::reset()
|
void CInterpolationStatus::reset()
|
||||||
{
|
{
|
||||||
m_validSituation = false;
|
m_isValidSituation = false;
|
||||||
m_changedPosition = false;
|
m_isInterpolated = false;
|
||||||
m_interpolationSucceeded = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CInterpolationStatus::toQString() const
|
QString CInterpolationStatus::toQString() const
|
||||||
{
|
{
|
||||||
return "Interpolation: " % boolToYesNo(m_interpolationSucceeded) %
|
return QStringLiteral("Interpolated: ") % boolToYesNo(m_isInterpolated) %
|
||||||
" situation valid: " % boolToYesNo(m_interpolationSucceeded) %
|
QStringLiteral(" | situation valid: ") % boolToYesNo(m_isValidSituation);
|
||||||
" changed pos.: " % boolToYesNo(m_changedPosition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPartsStatus::allTrue() const
|
bool CPartsStatus::allTrue() const
|
||||||
|
|||||||
@@ -147,31 +147,22 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Did interpolation succeed?
|
//! Did interpolation succeed?
|
||||||
bool didInterpolationSucceed() const { return m_interpolationSucceeded; }
|
bool isInterpolated() const { return m_isInterpolated; }
|
||||||
|
|
||||||
//! Set succeeded
|
//! Set succeeded
|
||||||
void setInterpolationSucceeded(bool succeeded) { m_interpolationSucceeded = succeeded; }
|
void setInterpolated(bool interpolated) { m_isInterpolated = interpolated; }
|
||||||
|
|
||||||
//! Set succeeded
|
//! Set succeeded
|
||||||
void setInterpolationSucceeded(bool succeeded, const Aviation::CAircraftSituation &situation);
|
void setInterpolatedAndCheckSituation(bool succeeded, const Aviation::CAircraftSituation &situation);
|
||||||
|
|
||||||
//! Changed position?
|
|
||||||
bool hasChangedPosition() const { return m_changedPosition; }
|
|
||||||
|
|
||||||
//! Is the corresponding position valid?
|
//! Is the corresponding position valid?
|
||||||
bool hasValidSituation() const { return m_validSituation; }
|
bool hasValidSituation() const { return m_isValidSituation; }
|
||||||
|
|
||||||
//! 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;
|
|
||||||
|
|
||||||
//! Valid interpolated situation
|
//! Valid interpolated situation
|
||||||
bool validInterpolatedSituation() const;
|
bool hasValidInterpolatedSituation() const;
|
||||||
|
|
||||||
|
//! Is that a valid position?
|
||||||
|
void checkIfValidSituation(const Aviation::CAircraftSituation &situation);
|
||||||
|
|
||||||
//! Reset to default values
|
//! Reset to default values
|
||||||
void reset();
|
void reset();
|
||||||
@@ -180,9 +171,8 @@ namespace BlackMisc
|
|||||||
QString toQString() const;
|
QString toQString() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_changedPosition = false; //!< position was changed
|
bool m_isInterpolated = false; //!< position is interpolated (means enough values, etc.)
|
||||||
bool m_interpolationSucceeded = false; //!< interpolation succeeded (means enough values, etc.)
|
bool m_isValidSituation = false; //!< is valid situation
|
||||||
bool m_validSituation = false; //!< is valid situation
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Status regarding parts
|
//! Status regarding parts
|
||||||
|
|||||||
Reference in New Issue
Block a user