mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Setting parent object for timers and formatting
This commit is contained in:
@@ -242,10 +242,10 @@ namespace BlackCore
|
||||
BlackMisc::CDigestSignal m_dsSendTextMessage { this, &CNetworkVatlib::emitConsolidatedTextMessages, 500, 10 };
|
||||
BlackMisc::Network::CTextMessageList m_textMessagesToConsolidate;
|
||||
|
||||
QTimer m_scheduledConfigUpdate;
|
||||
QTimer m_processingTimer;
|
||||
QTimer m_positionUpdateTimer;
|
||||
QTimer m_interimPositionUpdateTimer;
|
||||
QTimer m_scheduledConfigUpdate { this };
|
||||
QTimer m_processingTimer { this };
|
||||
QTimer m_positionUpdateTimer { this };
|
||||
QTimer m_interimPositionUpdateTimer { this };
|
||||
|
||||
static int const c_processingIntervalMsec = 100; //!< interval for the processing timer
|
||||
static int const c_updatePostionIntervalMsec = 5000; //!< interval for the position update timer (send our position to network)
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#define BLACKGUI_SHOWHIDEBAR_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
@@ -21,7 +20,6 @@
|
||||
class QWidget;
|
||||
|
||||
namespace Ui { class CShowHideBar; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
//! Show or hide (expand / collapse) another section
|
||||
@@ -34,7 +32,7 @@ namespace BlackGui
|
||||
explicit CShowHideBar(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CShowHideBar();
|
||||
virtual ~CShowHideBar();
|
||||
|
||||
//! Is shown?
|
||||
bool isShown() const;
|
||||
|
||||
@@ -67,16 +67,15 @@ namespace BlackMisc
|
||||
case CAircraftSituation::NotOnGround: return notog;
|
||||
case CAircraftSituation::OnGround: return og;
|
||||
case CAircraftSituation::OnGroundSituationUnknown:
|
||||
default:
|
||||
return unknown;
|
||||
default: return unknown;
|
||||
}
|
||||
}
|
||||
|
||||
const QString &CAircraftSituation::onGroundReliabilityToString(CAircraftSituation::OnGroundReliability reliability)
|
||||
{
|
||||
static const QString elv("by elevation");
|
||||
static const QString elvCg("by elevation/CG");
|
||||
static const QString inter("by interpolation");
|
||||
static const QString elv("elevation");
|
||||
static const QString elvCg("elevation/CG");
|
||||
static const QString inter("interpolation");
|
||||
static const QString guess("guessing");
|
||||
static const QString unknown("unknown");
|
||||
|
||||
|
||||
@@ -20,15 +20,15 @@ namespace BlackMisc
|
||||
{
|
||||
QString CElevationPlane::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s = "Geodetic: {%1, %2, %3} radius: %4";
|
||||
static const QString s = "Geodetic: {%1, %2, %3} radius: %4";
|
||||
return s.arg(this->latitude().valueRoundedWithUnit(6, i18n),
|
||||
this->longitude().valueRoundedWithUnit(6, i18n),
|
||||
this->geodeticHeight().valueRoundedWithUnit(6, i18n),
|
||||
this->m_radius.valueRoundedWithUnit(2, i18n)
|
||||
m_radius.valueRoundedWithUnit(2, i18n)
|
||||
);
|
||||
}
|
||||
|
||||
const CAltitude &CElevationPlane::getAltitudeIfWithinRadius(const BlackMisc::Geo::ICoordinateGeodetic &coordinate) const
|
||||
const CAltitude &CElevationPlane::getAltitudeIfWithinRadius(const ICoordinateGeodetic &coordinate) const
|
||||
{
|
||||
return (isWithinRange(coordinate)) ? geodeticHeight() : CAltitude::null();
|
||||
}
|
||||
@@ -67,10 +67,8 @@ namespace BlackMisc
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexRadius:
|
||||
return m_radius.propertyByIndex(index.copyFrontRemoved());
|
||||
default:
|
||||
break;
|
||||
case IndexRadius: return m_radius.propertyByIndex(index.copyFrontRemoved());
|
||||
default: break;
|
||||
}
|
||||
return CCoordinateGeodetic::propertyByIndex(index);
|
||||
}
|
||||
@@ -82,7 +80,7 @@ namespace BlackMisc
|
||||
switch (i)
|
||||
{
|
||||
case IndexRadius:
|
||||
this->m_radius.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||
m_radius.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||
break;
|
||||
default:
|
||||
CCoordinateGeodetic::setPropertyByIndex(index, variant);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BlackMisc
|
||||
{
|
||||
//! Hints for interpolator such as ground elevation
|
||||
class BLACKMISC_EXPORT CInterpolationHints :
|
||||
public BlackMisc::CValueObject<CInterpolationHints>
|
||||
public CValueObject<CInterpolationHints>
|
||||
{
|
||||
public:
|
||||
//! Property indexes
|
||||
@@ -44,29 +44,33 @@ namespace BlackMisc
|
||||
//! Constructor
|
||||
CInterpolationHints(bool isVtolAircraft, bool hasParts, bool log);
|
||||
|
||||
//! Get elevation
|
||||
const BlackMisc::Geo::CElevationPlane &getElevationPlane() const { return m_elevationPlane;}
|
||||
//! Get elevation plane
|
||||
const Geo::CElevationPlane &getElevationPlane() const { return m_elevationPlane;}
|
||||
|
||||
//! Set elevation
|
||||
void setElevationPlane(const BlackMisc::Geo::CElevationPlane &elevation) { m_elevationPlane = elevation; }
|
||||
//! \remark used to store a ground elevation and use it as well for nearby situatons
|
||||
void setElevationPlane(const Geo::CElevationPlane &elevation) { m_elevationPlane = elevation; }
|
||||
|
||||
//! Elevation plane set to null
|
||||
void resetElevationPlane();
|
||||
|
||||
//! Get elevation from CInterpolationHints::getElevationProvider or CInterpolationHints::getElevation
|
||||
Aviation::CAltitude getGroundElevation(const BlackMisc::Aviation::CAircraftSituation &situation) const;
|
||||
//! \remark avoid unnecessary calls on XPlane (calling elevation provider)
|
||||
//! \see setElevationProvider
|
||||
//! \see setElevationPlane
|
||||
Aviation::CAltitude getGroundElevation(const Aviation::CAircraftSituation &situation) const;
|
||||
|
||||
//! Check if elevation is within radius and can be used
|
||||
bool isWithinRange(const BlackMisc::Geo::ICoordinateGeodetic &coordinate) const;
|
||||
bool isWithinRange(const Geo::ICoordinateGeodetic &coordinate) const;
|
||||
|
||||
//! Get CG above ground
|
||||
const BlackMisc::PhysicalQuantities::CLength &getCGAboveGround() const { return m_cgAboveGround;}
|
||||
const PhysicalQuantities::CLength &getCGAboveGround() const { return m_cgAboveGround;}
|
||||
|
||||
//! Has CG above ground
|
||||
bool hasCGAboveGround() const { return m_cgAboveGround.isNull(); }
|
||||
|
||||
//! Set CG above ground
|
||||
void setCGAboveGround(const BlackMisc::PhysicalQuantities::CLength &cgAboveGround) { m_cgAboveGround = cgAboveGround; }
|
||||
void setCGAboveGround(const PhysicalQuantities::CLength &cgAboveGround) { m_cgAboveGround = cgAboveGround; }
|
||||
|
||||
//! VTOL aircraft?
|
||||
bool isVtolAircraft() const { return m_isVtol; }
|
||||
@@ -84,45 +88,44 @@ namespace BlackMisc
|
||||
bool hasAircraftParts() const { return m_hasParts; }
|
||||
|
||||
//! Aircraft parts required for interpolation
|
||||
BlackMisc::Aviation::CAircraftParts getAircraftParts() const { return m_aircraftParts; }
|
||||
Aviation::CAircraftParts getAircraftParts() const { return m_aircraftParts; }
|
||||
|
||||
//! Set aircraft parts required for interpolation if any
|
||||
//! \remark when used to reset value (default object) use hasParts false. Needed as there is no null parts object
|
||||
void setAircraftParts(const BlackMisc::Aviation::CAircraftParts &parts, bool hasParts = true);
|
||||
void setAircraftParts(const Aviation::CAircraftParts &parts, bool hasParts = true);
|
||||
|
||||
//! Function object that can obtain ground elevation
|
||||
using ElevationProvider = std::function<BlackMisc::Aviation::CAltitude(const BlackMisc::Aviation::CAircraftSituation &)>;
|
||||
using ElevationProvider = std::function<Aviation::CAltitude(const Aviation::CAircraftSituation &)>;
|
||||
|
||||
//! Has elevation provider
|
||||
bool hasElevationProvider() const;
|
||||
|
||||
//! Function object that can obtain ground elevation
|
||||
//! \remark either a provider or a value set can be used
|
||||
const ElevationProvider &getElevationProvider() const { return m_elevationProvider; }
|
||||
|
||||
//! Set function object that can obtain ground elevation
|
||||
//! \remark either a provider can be used or an elevation plan can be set
|
||||
//! \see setElevationPlane
|
||||
//! \see getGroundElevation
|
||||
void setElevationProvider(const ElevationProvider &ep) { m_elevationProvider = ep; }
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! For debugging
|
||||
QString debugInfo(const BlackMisc::Geo::CElevationPlane &deltaElevation) const;
|
||||
QString debugInfo(const Geo::CElevationPlane &deltaElevation) const;
|
||||
|
||||
private:
|
||||
bool m_isVtol = false; //!< VTOL aircraft?
|
||||
bool m_hasParts = false; //!< Has valid aircraft parts?
|
||||
bool m_logInterpolation = false; //!< log interpolation
|
||||
BlackMisc::Aviation::CAircraftParts m_aircraftParts; //!< Aircraft parts
|
||||
BlackMisc::Geo::CElevationPlane m_elevationPlane; //!< aircraft's elevation if available
|
||||
ElevationProvider m_elevationProvider; //!< Provider of ground elevation (lazy computation)
|
||||
BlackMisc::PhysicalQuantities::CLength m_cgAboveGround { 0, nullptr }; //!< center of gravity above ground
|
||||
Aviation::CAircraftParts m_aircraftParts; //!< Aircraft parts
|
||||
Geo::CElevationPlane m_elevationPlane; //!< aircraft's elevation if available
|
||||
ElevationProvider m_elevationProvider; //!< Provider of ground elevation (lazy computation)
|
||||
PhysicalQuantities::CLength m_cgAboveGround { 0, nullptr }; //!< center of gravity above ground
|
||||
|
||||
BLACK_METACLASS(
|
||||
CInterpolationHints,
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace BlackMisc
|
||||
Aviation::CAircraftSituationList m_aircraftSituations; //!< recent situations for one aircraft
|
||||
Aviation::CAircraftPartsList m_aircraftParts; //!< recent parts for one aircraft
|
||||
Aviation::CCallsign m_callsign; //!< callsign
|
||||
bool m_isFirstInterpolation = true; //!< set to false after the first successful interpolation
|
||||
bool m_isFirstInterpolation = true; //!< set to false after the first successful interpolation
|
||||
|
||||
//! Constructor
|
||||
CInterpolator(const QString &objectName, const Aviation::CCallsign &callsign, QObject *parent);
|
||||
|
||||
Reference in New Issue
Block a user