mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 18:25:37 +08:00
Ref T243, Ref T273, added info about elevation (where did we obtain it?)
This commit is contained in:
@@ -158,12 +158,12 @@ namespace BlackMisc
|
||||
if (!oldSituation.canLikelySkipNearGroundInterpolation() && !oldSituation.hasGroundElevation())
|
||||
{
|
||||
const CElevationPlane planeOld = this->findClosestElevationWithinRange(oldSituation, CElevationPlane::singlePointRadius());
|
||||
oldSituation.setGroundElevationChecked(planeOld);
|
||||
oldSituation.setGroundElevationChecked(planeOld, CAircraftSituation::FromCache);
|
||||
}
|
||||
if (!newSituation.canLikelySkipNearGroundInterpolation() && !newSituation.hasGroundElevation())
|
||||
{
|
||||
const CElevationPlane planeNew = this->findClosestElevationWithinRange(newSituation, CElevationPlane::singlePointRadius());
|
||||
newSituation.setGroundElevationChecked(planeNew);
|
||||
newSituation.setGroundElevationChecked(planeNew, CAircraftSituation::FromCache);
|
||||
}
|
||||
} // modified situations
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (m_s[i].hasGroundElevation()) { continue; } // do not override existing values
|
||||
const CElevationPlane plane = this->findClosestElevationWithinRange(m_s[i], CElevationPlane::singlePointRadius());
|
||||
const bool u = m_s[i].setGroundElevationChecked(plane);
|
||||
const bool u = m_s[i].setGroundElevationChecked(plane, CAircraftSituation::FromCache);
|
||||
updated |= u;
|
||||
}
|
||||
return updated;
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace BlackMisc
|
||||
return c;
|
||||
}
|
||||
|
||||
void CRemoteAircraftProvider::storeAircraftSituation(const CAircraftSituation &situation)
|
||||
void CRemoteAircraftProvider::storeAircraftSituation(const CAircraftSituation &situation, bool allowTestOffset)
|
||||
{
|
||||
const CCallsign cs = situation.getCallsign();
|
||||
if (cs.isEmpty()) { return; }
|
||||
@@ -202,7 +202,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
// add offset (for testing only)
|
||||
CAircraftSituation situationCorrected(this->testAddAltitudeOffsetToSituation(situation));
|
||||
CAircraftSituation situationCorrected(allowTestOffset ? this->testAddAltitudeOffsetToSituation(situation) : situation);
|
||||
|
||||
// list from new to old
|
||||
const qint64 ts = QDateTime::currentMSecsSinceEpoch();
|
||||
@@ -385,7 +385,7 @@ namespace BlackMisc
|
||||
return c > 0;
|
||||
}
|
||||
|
||||
int CRemoteAircraftProvider::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation)
|
||||
int CRemoteAircraftProvider::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation, CAircraftSituation::GndElevationInfo info)
|
||||
{
|
||||
if (!this->isAircraftInRange(callsign)) { return 0; }
|
||||
|
||||
@@ -396,14 +396,14 @@ namespace BlackMisc
|
||||
{
|
||||
QWriteLocker l(&m_lockSituations);
|
||||
CAircraftSituationList &situations = m_situationsByCallsign[callsign];
|
||||
updated = situations.setGroundElevationCheckedAndGuessGround(elevation, model);
|
||||
updated = situations.setGroundElevationCheckedAndGuessGround(elevation, info, model);
|
||||
if (updated < 1) { return 0; }
|
||||
m_situationsLastModified[callsign] = ts;
|
||||
}
|
||||
|
||||
// aircraft updates
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
const int c = m_aircraftInRange.setGroundElevationChecked(callsign, elevation);
|
||||
const int c = m_aircraftInRange.setGroundElevationChecked(callsign, elevation, info);
|
||||
Q_UNUSED(c); // just for info, expect 1
|
||||
|
||||
return updated; // updated situations
|
||||
@@ -716,10 +716,10 @@ namespace BlackMisc
|
||||
return this->provider()->updateAircraftRendered(callsign, rendered);
|
||||
}
|
||||
|
||||
int CRemoteAircraftAware::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation)
|
||||
int CRemoteAircraftAware::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation, CAircraftSituation::GndElevationInfo info)
|
||||
{
|
||||
Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
|
||||
return this->provider()->updateAircraftGroundElevation(callsign, elevation);
|
||||
return this->provider()->updateAircraftGroundElevation(callsign, elevation, info);
|
||||
}
|
||||
|
||||
void CRemoteAircraftAware::updateMarkAllAsNotRendered()
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace BlackMisc
|
||||
|
||||
//! Update the ground elevation
|
||||
//! \threadsafe
|
||||
virtual int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation) = 0;
|
||||
virtual int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation, Aviation::CAircraftSituation::GndElevationInfo info) = 0;
|
||||
|
||||
//! Update the CG
|
||||
//! \threadsafe
|
||||
@@ -261,7 +261,7 @@ namespace BlackMisc
|
||||
virtual bool updateAircraftNetworkModel(const Aviation::CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator) override;
|
||||
virtual bool updateFastPositionEnabled(const Aviation::CCallsign &callsign, bool enableFastPositonUpdates) override;
|
||||
virtual bool updateAircraftRendered(const Aviation::CCallsign &callsign, bool rendered) override;
|
||||
virtual int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation) override;
|
||||
virtual int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation, Aviation::CAircraftSituation::GndElevationInfo info) override;
|
||||
virtual bool updateCG(const Aviation::CCallsign &callsign, const PhysicalQuantities::CLength &cg) override;
|
||||
virtual void updateMarkAllAsNotRendered() override;
|
||||
virtual CStatusMessageList getAircraftPartsHistory(const Aviation::CCallsign &callsign) const override;
|
||||
@@ -364,7 +364,7 @@ namespace BlackMisc
|
||||
//! Store an aircraft situation
|
||||
//! \remark latest situations are kept first
|
||||
//! \threadsafe
|
||||
void storeAircraftSituation(const Aviation::CAircraftSituation &situation);
|
||||
void storeAircraftSituation(const Aviation::CAircraftSituation &situation, bool allowTestOffset = true);
|
||||
|
||||
//! Store an aircraft part
|
||||
//! \remark latest parts are kept first
|
||||
@@ -468,7 +468,7 @@ namespace BlackMisc
|
||||
bool updateAircraftRendered(const Aviation::CCallsign &callsign, bool rendered);
|
||||
|
||||
//! \copydoc IRemoteAircraftProvider::updateAircraftGroundElevation
|
||||
int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation);
|
||||
int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation, Aviation::CAircraftSituation::GndElevationInfo info);
|
||||
|
||||
//! \copydoc IRemoteAircraftProvider::updateMarkAllAsNotRendered
|
||||
void updateMarkAllAsNotRendered();
|
||||
|
||||
@@ -28,13 +28,13 @@ namespace BlackMisc
|
||||
{
|
||||
CSimulatedAircraft::CSimulatedAircraft()
|
||||
{
|
||||
init();
|
||||
this->init();
|
||||
}
|
||||
|
||||
CSimulatedAircraft::CSimulatedAircraft(const CAircraftModel &model) : m_models({model, model})
|
||||
{
|
||||
this->setCallsign(model.getCallsign());
|
||||
init();
|
||||
this->init();
|
||||
}
|
||||
|
||||
CSimulatedAircraft::CSimulatedAircraft(const CCallsign &callsign, const CUser &user, const CAircraftSituation &situation) :
|
||||
@@ -47,7 +47,7 @@ namespace BlackMisc
|
||||
m_callsign(callsign), m_pilot(user), m_situation(situation)
|
||||
{
|
||||
this->setModel(model);
|
||||
init();
|
||||
this->init();
|
||||
}
|
||||
|
||||
void CSimulatedAircraft::init()
|
||||
|
||||
@@ -214,10 +214,10 @@ namespace BlackMisc
|
||||
const Aviation::CAltitude &getGroundElevation() const { return m_situation.getGroundElevation(); }
|
||||
|
||||
//! \copydoc BlackMisc::Aviation::CAircraftSituation::setGroundElevation
|
||||
void setGroundElevation(const Geo::CElevationPlane &elevation) { m_situation.setGroundElevation(elevation); }
|
||||
void setGroundElevation(const Geo::CElevationPlane &elevation, Aviation::CAircraftSituation::GndElevationInfo info) { m_situation.setGroundElevation(elevation, info); }
|
||||
|
||||
//! \copydoc BlackMisc::Aviation::CAircraftSituation::setGroundElevation
|
||||
void setGroundElevationChecked(const Geo::CElevationPlane &elevation) { m_situation.setGroundElevationChecked(elevation); }
|
||||
void setGroundElevationChecked(const Geo::CElevationPlane &elevation, Aviation::CAircraftSituation::GndElevationInfo info) { m_situation.setGroundElevationChecked(elevation, info); }
|
||||
|
||||
//! \copydoc BlackMisc::Aviation::CAircraftSituation::getHeading
|
||||
const Aviation::CHeading &getHeading() const { return m_situation.getHeading(); }
|
||||
|
||||
@@ -186,13 +186,13 @@ namespace BlackMisc
|
||||
return c;
|
||||
}
|
||||
|
||||
int CSimulatedAircraftList::setGroundElevationChecked(const CCallsign &callsign, const CElevationPlane &elevation, bool onlyFirst)
|
||||
int CSimulatedAircraftList::setGroundElevationChecked(const CCallsign &callsign, const CElevationPlane &elevation, CAircraftSituation::GndElevationInfo info, bool onlyFirst)
|
||||
{
|
||||
int c = 0;
|
||||
for (CSimulatedAircraft &aircraft : (*this))
|
||||
{
|
||||
if (aircraft.getCallsign() != callsign) { continue; }
|
||||
aircraft.setGroundElevationChecked(elevation);
|
||||
aircraft.setGroundElevationChecked(elevation, info);
|
||||
c++;
|
||||
if (onlyFirst) break;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace BlackMisc
|
||||
int setAircraftSituation(const Aviation::CCallsign &callsign, const Aviation::CAircraftSituation &situation, bool onlyFirst = true);
|
||||
|
||||
//! Set ground elevation
|
||||
int setGroundElevationChecked(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation, bool onlyFirst = true);
|
||||
int setGroundElevationChecked(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation, Aviation::CAircraftSituation::GndElevationInfo info, bool onlyFirst = true);
|
||||
|
||||
//! Enabled?
|
||||
bool isEnabled(const Aviation::CCallsign &callsign) const;
|
||||
|
||||
Reference in New Issue
Block a user