mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-22 13:15:39 +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; }
|
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
|
// * we assume we find them faster
|
||||||
// * and need the more frequently (the recent ones)
|
// * and need the more frequently (the recent ones)
|
||||||
QWriteLocker l(&m_lockElvCoordinates);
|
QWriteLocker l(&m_lockElvCoordinates);
|
||||||
if (m_elvCoordinates.size() > MaxElevations) { m_elvCoordinates.pop_back(); }
|
if (m_elvCoordinates.size() > MaxElevations) { m_elvCoordinates.pop_back(); }
|
||||||
m_elvCoordinates.push_front(elevationCoordinate);
|
m_elvCoordinates.push_front(elevationCoordinate);
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -95,7 +94,19 @@ namespace BlackMisc
|
|||||||
CElevationPlane ISimulationEnvironmentProvider::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const
|
CElevationPlane ISimulationEnvironmentProvider::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const
|
||||||
{
|
{
|
||||||
const CCoordinateGeodetic coordinate = this->getElevationCoordinates().findClosestWithinRange(reference, minRange(range));
|
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
|
CSimulatorPluginInfo ISimulationEnvironmentProvider::getSimulatorPluginInfo() const
|
||||||
@@ -162,6 +173,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
QWriteLocker l(&m_lockElvCoordinates);
|
QWriteLocker l(&m_lockElvCoordinates);
|
||||||
m_elvCoordinates.clear();
|
m_elvCoordinates.clear();
|
||||||
|
m_elvFound = m_elvMissed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISimulationEnvironmentProvider::clearCGs()
|
void ISimulationEnvironmentProvider::clearCGs()
|
||||||
@@ -183,6 +195,12 @@ namespace BlackMisc
|
|||||||
return this->provider()->findClosestElevationWithinRange(reference, range);
|
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
|
CSimulatorPluginInfo CSimulationEnvironmentAware::getSimulatorPluginInfo() const
|
||||||
{
|
{
|
||||||
if (!this->hasProvider()) { return CSimulatorPluginInfo(); }
|
if (!this->hasProvider()) { return CSimulatorPluginInfo(); }
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QPair>
|
||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
@@ -39,6 +40,10 @@ namespace BlackMisc
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
Geo::CElevationPlane findClosestElevationWithinRange(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const;
|
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
|
//! Get the represented plugin
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
CSimulatorPluginInfo getSimulatorPluginInfo() const;
|
CSimulatorPluginInfo getSimulatorPluginInfo() const;
|
||||||
@@ -122,6 +127,8 @@ namespace BlackMisc
|
|||||||
CSimulatorPluginInfo m_simulatorPluginInfo; //!< info object
|
CSimulatorPluginInfo m_simulatorPluginInfo; //!< info object
|
||||||
Geo::CCoordinateGeodeticList m_elvCoordinates;
|
Geo::CCoordinateGeodeticList m_elvCoordinates;
|
||||||
QMap<Aviation::CCallsign, PhysicalQuantities::CLength> m_cgs; //! CGs
|
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_lockElvCoordinates; //!< lock m_coordinates
|
||||||
mutable QReadWriteLock m_lockCG; //!< lock CGs
|
mutable QReadWriteLock m_lockCG; //!< lock CGs
|
||||||
mutable QReadWriteLock m_lockModel; //!< lock models
|
mutable QReadWriteLock m_lockModel; //!< lock models
|
||||||
@@ -137,6 +144,9 @@ namespace BlackMisc
|
|||||||
//! \copydoc ISimulationEnvironmentProvider::findClosestElevationWithinRange
|
//! \copydoc ISimulationEnvironmentProvider::findClosestElevationWithinRange
|
||||||
Geo::CElevationPlane findClosestElevationWithinRange(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const;
|
Geo::CElevationPlane findClosestElevationWithinRange(const Geo::ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const;
|
||||||
|
|
||||||
|
//! \copydoc ISimulationEnvironmentProvider::getElevationsFoundMissed
|
||||||
|
QPair<int, int> getElevationsFoundMissed() const;
|
||||||
|
|
||||||
//! \copydoc ISimulationEnvironmentProvider::getSimulatorPluginInfo
|
//! \copydoc ISimulationEnvironmentProvider::getSimulatorPluginInfo
|
||||||
CSimulatorPluginInfo getSimulatorPluginInfo() const;
|
CSimulatorPluginInfo getSimulatorPluginInfo() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user