mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-11 23:05:34 +08:00
Ref T273, high level functions to compare "equal" situations
Remark: "==" compares a lot of attributes, those will only compare values to determine equal PBH/vector ...
This commit is contained in:
@@ -234,6 +234,16 @@ namespace BlackMisc
|
||||
return this->isPositionNull();
|
||||
}
|
||||
|
||||
bool CAircraftSituation::equalPbh(const CAircraftSituation &other) const
|
||||
{
|
||||
return this->getPitch() == other.getPitch() && this->getBank() == other.getBank() && this->getHeading() == other.getHeading();
|
||||
}
|
||||
|
||||
bool CAircraftSituation::equalPbhAndVector(const CAircraftSituation &other) const
|
||||
{
|
||||
return this->equalNormalVectorDouble(other.normalVectorDouble()) && this->equalPbh(other);
|
||||
}
|
||||
|
||||
void CAircraftSituation::setNull()
|
||||
{
|
||||
m_position.setNull();
|
||||
@@ -482,6 +492,21 @@ namespace BlackMisc
|
||||
return this->onGroundAsString() % QLatin1Char(' ') % this->getOnDetailsAsString();
|
||||
}
|
||||
|
||||
bool CAircraftSituation::canTransferGroundElevation(const CAircraftSituation &otherSituation, const CLength &radius) const
|
||||
{
|
||||
if (!this->hasGroundElevation()) { return false; }
|
||||
const CLength distance = this->getGroundElevationPlane().calculateGreatCircleDistance(otherSituation);
|
||||
const bool transferable = distance <= radius;
|
||||
return transferable;
|
||||
}
|
||||
|
||||
bool CAircraftSituation::transferGroundElevation(CAircraftSituation &otherSituation, const CLength &radius) const
|
||||
{
|
||||
if (!this->canTransferGroundElevation(otherSituation, radius)) { return false; }
|
||||
otherSituation.setGroundElevation(this->getGroundElevationPlane());
|
||||
return true;
|
||||
}
|
||||
|
||||
CAircraftSituation::IsOnGround CAircraftSituation::isOnGroundByElevation() const
|
||||
{
|
||||
return this->isOnGroundByElevation(m_cg);
|
||||
@@ -548,6 +573,11 @@ namespace BlackMisc
|
||||
return false;
|
||||
}
|
||||
|
||||
void CAircraftSituation::resetGroundElevation()
|
||||
{
|
||||
m_groundElevationPlane = CElevationPlane::null();
|
||||
}
|
||||
|
||||
const CLength &CAircraftSituation::getGroundElevationRadius() const
|
||||
{
|
||||
if (!this->hasGroundElevation()) { return CLength::null(); }
|
||||
|
||||
Reference in New Issue
Block a user