mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
Ref T259, Ref T243 elevation provider statistics
This commit is contained in:
@@ -24,13 +24,12 @@ namespace BlackMisc
|
||||
if (m_elvCoordinates.containsObjectInRange(elevationCoordinate, minRange(epsilon))) { return false; }
|
||||
}
|
||||
{
|
||||
// we keep latest at fron
|
||||
// we keep latest at front
|
||||
// * we assume we find them faster
|
||||
// * and need the more frequently (the recent ones)
|
||||
QWriteLocker l(&m_lockElvCoordinates);
|
||||
if (m_elvCoordinates.size() > MaxElevations) { m_elvCoordinates.pop_back(); }
|
||||
m_elvCoordinates.push_front(elevationCoordinate);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -95,7 +94,19 @@ namespace BlackMisc
|
||||
CElevationPlane ISimulationEnvironmentProvider::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const
|
||||
{
|
||||
const CCoordinateGeodetic coordinate = this->getElevationCoordinates().findClosestWithinRange(reference, minRange(range));
|
||||
return CElevationPlane(coordinate, reference); // plane with radis = distnace to reference
|
||||
const bool found = !coordinate.isNull();
|
||||
{
|
||||
QWriteLocker l{&m_lockElvCoordinates };
|
||||
if (found) { m_elvFound++; }
|
||||
else { m_elvMissed++; }
|
||||
}
|
||||
return CElevationPlane(coordinate, reference); // plane with radis = distance to reference
|
||||
}
|
||||
|
||||
QPair<int, int> ISimulationEnvironmentProvider::getElevationsFoundMissed() const
|
||||
{
|
||||
QReadLocker l(&m_lockElvCoordinates);
|
||||
return QPair<int, int>(m_elvFound, m_elvMissed);
|
||||
}
|
||||
|
||||
CSimulatorPluginInfo ISimulationEnvironmentProvider::getSimulatorPluginInfo() const
|
||||
@@ -162,6 +173,7 @@ namespace BlackMisc
|
||||
{
|
||||
QWriteLocker l(&m_lockElvCoordinates);
|
||||
m_elvCoordinates.clear();
|
||||
m_elvFound = m_elvMissed = 0;
|
||||
}
|
||||
|
||||
void ISimulationEnvironmentProvider::clearCGs()
|
||||
@@ -183,6 +195,12 @@ namespace BlackMisc
|
||||
return this->provider()->findClosestElevationWithinRange(reference, range);
|
||||
}
|
||||
|
||||
QPair<int, int> CSimulationEnvironmentAware::getElevationsFoundMissed() const
|
||||
{
|
||||
if (!this->hasProvider()) { return QPair<int, int>(0, 0); }
|
||||
return this->provider()->getElevationsFoundMissed();
|
||||
}
|
||||
|
||||
CSimulatorPluginInfo CSimulationEnvironmentAware::getSimulatorPluginInfo() const
|
||||
{
|
||||
if (!this->hasProvider()) { return CSimulatorPluginInfo(); }
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QPair>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -39,6 +40,10 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
Geo::CElevationPlane findClosestElevationWithinRange(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const;
|
||||
|
||||
//! Elevations found/missed statistics
|
||||
//! \threadsafe
|
||||
QPair<int, int> getElevationsFoundMissed() const;
|
||||
|
||||
//! Get the represented plugin
|
||||
//! \threadsafe
|
||||
CSimulatorPluginInfo getSimulatorPluginInfo() const;
|
||||
@@ -122,6 +127,8 @@ namespace BlackMisc
|
||||
CSimulatorPluginInfo m_simulatorPluginInfo; //!< info object
|
||||
Geo::CCoordinateGeodeticList m_elvCoordinates;
|
||||
QMap<Aviation::CCallsign, PhysicalQuantities::CLength> m_cgs; //! CGs
|
||||
mutable int m_elvFound = 0; //!< statistics only
|
||||
mutable int m_elvMissed = 0; //!< statistics only
|
||||
mutable QReadWriteLock m_lockElvCoordinates; //!< lock m_coordinates
|
||||
mutable QReadWriteLock m_lockCG; //!< lock CGs
|
||||
mutable QReadWriteLock m_lockModel; //!< lock models
|
||||
@@ -137,6 +144,9 @@ namespace BlackMisc
|
||||
//! \copydoc ISimulationEnvironmentProvider::findClosestElevationWithinRange
|
||||
Geo::CElevationPlane findClosestElevationWithinRange(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const;
|
||||
|
||||
//! \copydoc ISimulationEnvironmentProvider::getElevationsFoundMissed
|
||||
QPair<int, int> getElevationsFoundMissed() const;
|
||||
|
||||
//! \copydoc ISimulationEnvironmentProvider::getSimulatorPluginInfo
|
||||
CSimulatorPluginInfo getSimulatorPluginInfo() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user