mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 13:55:36 +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::CDigestSignal m_dsSendTextMessage { this, &CNetworkVatlib::emitConsolidatedTextMessages, 500, 10 };
|
||||||
BlackMisc::Network::CTextMessageList m_textMessagesToConsolidate;
|
BlackMisc::Network::CTextMessageList m_textMessagesToConsolidate;
|
||||||
|
|
||||||
QTimer m_scheduledConfigUpdate;
|
QTimer m_scheduledConfigUpdate { this };
|
||||||
QTimer m_processingTimer;
|
QTimer m_processingTimer { this };
|
||||||
QTimer m_positionUpdateTimer;
|
QTimer m_positionUpdateTimer { this };
|
||||||
QTimer m_interimPositionUpdateTimer;
|
QTimer m_interimPositionUpdateTimer { this };
|
||||||
|
|
||||||
static int const c_processingIntervalMsec = 100; //!< interval for the processing timer
|
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)
|
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
|
#define BLACKGUI_SHOWHIDEBAR_H
|
||||||
|
|
||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
@@ -21,7 +20,6 @@
|
|||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
namespace Ui { class CShowHideBar; }
|
namespace Ui { class CShowHideBar; }
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
//! Show or hide (expand / collapse) another section
|
//! Show or hide (expand / collapse) another section
|
||||||
@@ -34,7 +32,7 @@ namespace BlackGui
|
|||||||
explicit CShowHideBar(QWidget *parent = nullptr);
|
explicit CShowHideBar(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~CShowHideBar();
|
virtual ~CShowHideBar();
|
||||||
|
|
||||||
//! Is shown?
|
//! Is shown?
|
||||||
bool isShown() const;
|
bool isShown() const;
|
||||||
|
|||||||
@@ -67,16 +67,15 @@ namespace BlackMisc
|
|||||||
case CAircraftSituation::NotOnGround: return notog;
|
case CAircraftSituation::NotOnGround: return notog;
|
||||||
case CAircraftSituation::OnGround: return og;
|
case CAircraftSituation::OnGround: return og;
|
||||||
case CAircraftSituation::OnGroundSituationUnknown:
|
case CAircraftSituation::OnGroundSituationUnknown:
|
||||||
default:
|
default: return unknown;
|
||||||
return unknown;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CAircraftSituation::onGroundReliabilityToString(CAircraftSituation::OnGroundReliability reliability)
|
const QString &CAircraftSituation::onGroundReliabilityToString(CAircraftSituation::OnGroundReliability reliability)
|
||||||
{
|
{
|
||||||
static const QString elv("by elevation");
|
static const QString elv("elevation");
|
||||||
static const QString elvCg("by elevation/CG");
|
static const QString elvCg("elevation/CG");
|
||||||
static const QString inter("by interpolation");
|
static const QString inter("interpolation");
|
||||||
static const QString guess("guessing");
|
static const QString guess("guessing");
|
||||||
static const QString unknown("unknown");
|
static const QString unknown("unknown");
|
||||||
|
|
||||||
|
|||||||
@@ -20,15 +20,15 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
QString CElevationPlane::convertToQString(bool i18n) const
|
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),
|
return s.arg(this->latitude().valueRoundedWithUnit(6, i18n),
|
||||||
this->longitude().valueRoundedWithUnit(6, i18n),
|
this->longitude().valueRoundedWithUnit(6, i18n),
|
||||||
this->geodeticHeight().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();
|
return (isWithinRange(coordinate)) ? geodeticHeight() : CAltitude::null();
|
||||||
}
|
}
|
||||||
@@ -67,10 +67,8 @@ namespace BlackMisc
|
|||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexRadius:
|
case IndexRadius: return m_radius.propertyByIndex(index.copyFrontRemoved());
|
||||||
return m_radius.propertyByIndex(index.copyFrontRemoved());
|
default: break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return CCoordinateGeodetic::propertyByIndex(index);
|
return CCoordinateGeodetic::propertyByIndex(index);
|
||||||
}
|
}
|
||||||
@@ -82,7 +80,7 @@ namespace BlackMisc
|
|||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexRadius:
|
case IndexRadius:
|
||||||
this->m_radius.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
m_radius.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CCoordinateGeodetic::setPropertyByIndex(index, variant);
|
CCoordinateGeodetic::setPropertyByIndex(index, variant);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
//! Hints for interpolator such as ground elevation
|
//! Hints for interpolator such as ground elevation
|
||||||
class BLACKMISC_EXPORT CInterpolationHints :
|
class BLACKMISC_EXPORT CInterpolationHints :
|
||||||
public BlackMisc::CValueObject<CInterpolationHints>
|
public CValueObject<CInterpolationHints>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Property indexes
|
//! Property indexes
|
||||||
@@ -44,29 +44,33 @@ namespace BlackMisc
|
|||||||
//! Constructor
|
//! Constructor
|
||||||
CInterpolationHints(bool isVtolAircraft, bool hasParts, bool log);
|
CInterpolationHints(bool isVtolAircraft, bool hasParts, bool log);
|
||||||
|
|
||||||
//! Get elevation
|
//! Get elevation plane
|
||||||
const BlackMisc::Geo::CElevationPlane &getElevationPlane() const { return m_elevationPlane;}
|
const Geo::CElevationPlane &getElevationPlane() const { return m_elevationPlane;}
|
||||||
|
|
||||||
//! Set elevation
|
//! 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
|
//! Elevation plane set to null
|
||||||
void resetElevationPlane();
|
void resetElevationPlane();
|
||||||
|
|
||||||
//! Get elevation from CInterpolationHints::getElevationProvider or CInterpolationHints::getElevation
|
//! 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
|
//! 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
|
//! 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
|
//! Has CG above ground
|
||||||
bool hasCGAboveGround() const { return m_cgAboveGround.isNull(); }
|
bool hasCGAboveGround() const { return m_cgAboveGround.isNull(); }
|
||||||
|
|
||||||
//! Set CG above ground
|
//! 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?
|
//! VTOL aircraft?
|
||||||
bool isVtolAircraft() const { return m_isVtol; }
|
bool isVtolAircraft() const { return m_isVtol; }
|
||||||
@@ -84,45 +88,44 @@ namespace BlackMisc
|
|||||||
bool hasAircraftParts() const { return m_hasParts; }
|
bool hasAircraftParts() const { return m_hasParts; }
|
||||||
|
|
||||||
//! Aircraft parts required for interpolation
|
//! 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
|
//! 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
|
//! \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
|
//! 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
|
//! Has elevation provider
|
||||||
bool hasElevationProvider() const;
|
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
|
//! 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; }
|
void setElevationProvider(const ElevationProvider &ep) { m_elevationProvider = ep; }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
//! \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
|
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
//! For debugging
|
//! For debugging
|
||||||
QString debugInfo(const BlackMisc::Geo::CElevationPlane &deltaElevation) const;
|
QString debugInfo(const Geo::CElevationPlane &deltaElevation) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_isVtol = false; //!< VTOL aircraft?
|
bool m_isVtol = false; //!< VTOL aircraft?
|
||||||
bool m_hasParts = false; //!< Has valid aircraft parts?
|
bool m_hasParts = false; //!< Has valid aircraft parts?
|
||||||
bool m_logInterpolation = false; //!< log interpolation
|
bool m_logInterpolation = false; //!< log interpolation
|
||||||
BlackMisc::Aviation::CAircraftParts m_aircraftParts; //!< Aircraft parts
|
Aviation::CAircraftParts m_aircraftParts; //!< Aircraft parts
|
||||||
BlackMisc::Geo::CElevationPlane m_elevationPlane; //!< aircraft's elevation if available
|
Geo::CElevationPlane m_elevationPlane; //!< aircraft's elevation if available
|
||||||
ElevationProvider m_elevationProvider; //!< Provider of ground elevation (lazy computation)
|
ElevationProvider m_elevationProvider; //!< Provider of ground elevation (lazy computation)
|
||||||
BlackMisc::PhysicalQuantities::CLength m_cgAboveGround { 0, nullptr }; //!< center of gravity above ground
|
PhysicalQuantities::CLength m_cgAboveGround { 0, nullptr }; //!< center of gravity above ground
|
||||||
|
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
CInterpolationHints,
|
CInterpolationHints,
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace BlackMisc
|
|||||||
Aviation::CAircraftSituationList m_aircraftSituations; //!< recent situations for one aircraft
|
Aviation::CAircraftSituationList m_aircraftSituations; //!< recent situations for one aircraft
|
||||||
Aviation::CAircraftPartsList m_aircraftParts; //!< recent parts for one aircraft
|
Aviation::CAircraftPartsList m_aircraftParts; //!< recent parts for one aircraft
|
||||||
Aviation::CCallsign m_callsign; //!< callsign
|
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
|
//! Constructor
|
||||||
CInterpolator(const QString &objectName, const Aviation::CCallsign &callsign, QObject *parent);
|
CInterpolator(const QString &objectName, const Aviation::CCallsign &callsign, QObject *parent);
|
||||||
|
|||||||
Reference in New Issue
Block a user