252 lines
4.3 KiB
C++
252 lines
4.3 KiB
C++
#ifndef Cockpit_H
|
|
#define Cockpit_H
|
|
|
|
#include <QWidget>
|
|
#include <QMouseEvent>
|
|
|
|
#include "leftladder.h"
|
|
|
|
#include "QTimer"
|
|
|
|
|
|
class QColor;
|
|
|
|
|
|
#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 = 0);
|
|
~Cockpit();
|
|
|
|
|
|
typedef struct {
|
|
quint8 fixtype;
|
|
quint8 svn;
|
|
double altitude;
|
|
double latitude;
|
|
double longitude;
|
|
float course;
|
|
float speed;
|
|
float vn;
|
|
float ve;
|
|
float vd;
|
|
}_gps;
|
|
|
|
typedef struct {
|
|
float ax;
|
|
float ay;
|
|
float az;
|
|
|
|
float gx;
|
|
float gy;
|
|
float gz;
|
|
|
|
float roll;
|
|
float pitch;
|
|
float yaw;
|
|
|
|
float pressurealtitude;
|
|
|
|
float airspeed;
|
|
float verticalspeed;
|
|
float horizontalspeed;
|
|
|
|
float distofly;
|
|
|
|
|
|
|
|
}_attitude;
|
|
|
|
typedef struct {
|
|
float voltage[10];
|
|
float current[10];
|
|
}_battery;
|
|
|
|
|
|
|
|
typedef struct{
|
|
float pitch;
|
|
float roll;
|
|
float yaw;
|
|
|
|
float height;
|
|
|
|
float airspeed_maximun;
|
|
float airspeed;
|
|
float airspeed_minimun;
|
|
|
|
float heading;//航线方向
|
|
float position;//侧偏距
|
|
float altitude;//海拔
|
|
|
|
float verticalspeed;//纵向速度
|
|
|
|
}_target;
|
|
|
|
|
|
_target m_Target;
|
|
_gps m_GPS;
|
|
_battery m_Battery;
|
|
_attitude m_Attitude;
|
|
|
|
Q_SIGNALS:
|
|
void errorSignal(int);
|
|
|
|
public Q_SLOTS:
|
|
void setPitch(double Pitch);
|
|
void setRoll(double Roll);
|
|
void setYaw(double Yaw);
|
|
void setAttitude(double Pitch,double Roll,double Yaw);
|
|
void setAttitudeSpeed(double PitchSpeed,double RollSpeed,double YawSpeed);
|
|
|
|
void setGPSCourse(double Course);
|
|
void setGPSSVN(int Number);
|
|
void setGPSAltitude(double Altitude);
|
|
void setGPSSpeed(double speed);
|
|
void setPressureAltitude(double Altitude);
|
|
void setAirSpeed(double speed);
|
|
void setVoltage(double Voltage);
|
|
|
|
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_WColor;
|
|
|
|
QPoint m_c;
|
|
|
|
|
|
|
|
|
|
|
|
LeftLadder *leftladder;
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // ALTITUDEPANEL_H
|