266 lines
4.4 KiB
C++
266 lines
4.4 KiB
C++
#ifndef Cockpit_H
|
|
#define Cockpit_H
|
|
|
|
#include <QWidget>
|
|
#include <QMouseEvent>
|
|
|
|
#include "leftladder.h"
|
|
|
|
#include "QTimer"
|
|
|
|
|
|
#ifdef QtCockpit
|
|
#include <cockpitglobal.h>
|
|
class COCKPITSHARED_EXPORT Cockpit: public QWidget {
|
|
#else
|
|
class Cockpit: public QWidget
|
|
{
|
|
#endif
|
|
|
|
Q_OBJECT
|
|
public:
|
|
enum ErrorCode {MaxValueError=1,MinValueError,ThresholdError,TargetError,PrecisionError,ColorError,UnitsEmpty,OutOfRange};
|
|
|
|
explicit Cockpit(QWidget *parent = nullptr);
|
|
~Cockpit();
|
|
|
|
|
|
typedef struct {
|
|
QColor CentreLineColor;
|
|
QColor ForeColor;
|
|
QColor CornerColor;
|
|
|
|
QColor GroundColor;//大地颜色
|
|
QColor SkyColor;//天空颜色
|
|
|
|
QColor LedColor;
|
|
|
|
QColor CurrentColor;
|
|
QColor TargetColor;
|
|
QColor StatusColor;
|
|
|
|
QColor NormalColor;
|
|
QColor NoticeColor;
|
|
QColor WarningColor;
|
|
|
|
QColor WColor;
|
|
|
|
}_color;
|
|
|
|
typedef struct {
|
|
qreal ax;
|
|
qreal ay;
|
|
qreal az;
|
|
|
|
qreal gx;
|
|
qreal gy;
|
|
qreal gz;
|
|
|
|
qreal roll;
|
|
qreal pitch;
|
|
qreal yaw;
|
|
|
|
qreal altitude;
|
|
qreal height;
|
|
|
|
qreal airspeed;
|
|
qreal verticalspeed;
|
|
qreal horizontalspeed;
|
|
|
|
qreal AOA;
|
|
|
|
|
|
|
|
qreal distofly;
|
|
|
|
quint8 AirspeedFlag;
|
|
|
|
bool isUpdate;
|
|
|
|
}_state;
|
|
|
|
typedef struct {
|
|
qreal voltage[10];
|
|
qreal current[10];
|
|
}_battery;
|
|
|
|
|
|
|
|
typedef struct{
|
|
qreal pitch;
|
|
qreal roll;
|
|
qreal yaw;
|
|
|
|
qreal height;
|
|
|
|
qreal airspeed_maximun;
|
|
qreal airspeed;
|
|
qreal airspeed_minimun;
|
|
|
|
qreal heading;//航线方向
|
|
qreal position;//侧偏距
|
|
qreal altitude;//海拔
|
|
|
|
qreal verticalspeed;//纵向速度
|
|
|
|
}_target;
|
|
|
|
|
|
_target m_Target;
|
|
_state m_State;
|
|
_color m_Color;
|
|
|
|
Q_SIGNALS:
|
|
void errorSignal(int);
|
|
|
|
public Q_SLOTS:
|
|
void setPitch(qreal Pitch);
|
|
void setRoll(qreal Roll);
|
|
void setYaw(qreal Yaw);
|
|
void setAttitude(qreal Pitch,qreal Roll,qreal Yaw);
|
|
void setAttitudeSpeed(qreal PitchSpeed,qreal RollSpeed,qreal YawSpeed);
|
|
|
|
void setAltitude(qreal Altitude);
|
|
void setAirSpeed(qreal speed);
|
|
|
|
void setLed(QColor LED);
|
|
|
|
|
|
protected:
|
|
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e);
|
|
void mousePressEvent(QMouseEvent *e);
|
|
void mouseDoubleClickEvent(QMouseEvent *e);
|
|
void wheelEvent(QWheelEvent *e);
|
|
|
|
|
|
void paintEvent(QPaintEvent *);
|
|
|
|
void drawLed(QPainter *painter);
|
|
|
|
void drawPitch(QPainter *painter);
|
|
void drawRoll(QPainter *painter);
|
|
void drawRollScale(QPainter *painter);
|
|
|
|
void drawVRate(QPainter *painter);
|
|
|
|
void drawYawScale(QPainter *painter);
|
|
void drawLeftScale(QPainter *painter);
|
|
void drawRightScale(QPainter *painter);
|
|
|
|
void drawTopStatuts(QPainter *painter);
|
|
|
|
private slots:
|
|
|
|
void UpdateTimeout(void);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
QTimer *UpdateTimer = nullptr;
|
|
|
|
QString m_mode;//显示模式
|
|
|
|
QString m_SPD_HOLD;
|
|
QString m_HDG_HOLD;
|
|
QString m_ALT_HOLD;
|
|
|
|
double m_PitchValue;
|
|
double m_RollValue;
|
|
double m_YawValue;
|
|
double m_CourseValue;
|
|
|
|
double m_BatteryValue;
|
|
|
|
|
|
double m_GPSAltitudeValue;
|
|
double m_PressureAltitudeValue;
|
|
|
|
int m_Max_Roll;
|
|
int m_Min_Roll;
|
|
|
|
int m_Max_Altitude;
|
|
int m_Min_Altitude;
|
|
|
|
double m_gps_altitude;
|
|
double m_pre_altitude;
|
|
|
|
double m_gps_speed;
|
|
double m_air_speed;
|
|
|
|
QString m_CtrlModeValue;
|
|
QString m_AirplaneModeValue;
|
|
QString m_CurrentStatusValue;
|
|
QString m_LockStatusValue;
|
|
QString m_TurningStatusValue;
|
|
|
|
int m_GPSStatusValue;
|
|
int m_GPSStarValue;
|
|
|
|
float m_Z_SpeedValue;
|
|
float m_Z_HightValue;
|
|
//float m_X_SpeedValue;
|
|
|
|
//保护
|
|
QString m_ProtectString;
|
|
quint8 m_Protect;
|
|
//数值的最大最小值
|
|
double m_Pitch_MinValue;
|
|
double m_Roll_MinValue;
|
|
double m_Yaw_MinValue;
|
|
double m_CourseMinValue;
|
|
|
|
double m_Pitch_MaxValue;
|
|
double m_Roll_MaxValue;
|
|
double m_Yaw_MaxValue;
|
|
double m_CourseMaxValue;
|
|
|
|
double m_BatteryMinValue;
|
|
double m_BatteryMaxValue;
|
|
|
|
/*
|
|
QColor m_CentreLineColor;
|
|
QColor m_ForeColor;
|
|
QColor m_CornerColor;
|
|
|
|
QColor m_GroundColor;//大地颜色
|
|
QColor m_SkyColor;//天空颜色
|
|
|
|
QColor m_LedColor;
|
|
|
|
QColor m_CurrentColor;
|
|
QColor m_TargetColor;
|
|
QColor m_StatusColor;
|
|
|
|
QColor m_NormalColor;
|
|
QColor m_NoticeColor;
|
|
QColor m_WarningColor;
|
|
|
|
|
|
|
|
QColor m_WColor;
|
|
*/
|
|
|
|
|
|
QPoint m_c;
|
|
|
|
|
|
|
|
|
|
|
|
LeftLadder *leftladder;
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // ALTITUDEPANEL_H
|