You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.1 KiB
C++
71 lines
2.1 KiB
C++
#ifndef REALTIMEPOSITIONINFOTHREAD_H
|
|
#define REALTIMEPOSITIONINFOTHREAD_H
|
|
/*
|
|
* @brief 实时接收飞机位置信息子线程
|
|
*/
|
|
|
|
#include <QObject>
|
|
#include <QVector>
|
|
#include <QList>
|
|
#include <QMap>
|
|
#include <QTimer>
|
|
#include <QMutex>
|
|
#include <QThread>
|
|
|
|
class RealTimePositionInfoThread : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit RealTimePositionInfoThread(QObject *parent = nullptr);
|
|
//执行子线程业务逻辑
|
|
void working();
|
|
|
|
void startSendCollisionDetectionPosInfo(int ms);
|
|
|
|
public slots:
|
|
void receiveRealTimePositionInfo(QList<double> lon,QList<double> lat,QList<double> relativeAlititude,
|
|
QList<double> heading,QList<double> speed);
|
|
|
|
//发送位置信息用于实时显示飞机位置
|
|
void startSendDisplayInfo(int ms);
|
|
//停止发送数据给碰撞探测子线程
|
|
void stopSendCollisionDetectionPosInfo();
|
|
|
|
/***********************Test***********************/
|
|
void receiveTest(int i);
|
|
|
|
signals:
|
|
void sendDisplayInfo(QMap<int,QList<double>>& qmapLon,QMap<int,QList<double>>& qmapLat,QMap<int,QList<double>>& qmapHeading);
|
|
void sendCollisionDetectPosInfo(QList<double> lon,QList<double> lat,QList<double> relativeAlititude,
|
|
QList<double> heading,QList<double> speed);
|
|
|
|
void sendPos(QList<double> lon,QList<double> lat,QList<double> heading);
|
|
|
|
private:
|
|
QMutex mutex;
|
|
|
|
//存储飞机的位置信息的列表
|
|
QMap<int,QList<double>> qmapLon; //经度
|
|
QMap<int,QList<double>> qmapLat; //纬度
|
|
QMap<int,QList<double>> qmapRelativeAlititude; //相对高度
|
|
QMap<int,QList<double>> qmapHeading; //航向
|
|
QMap<int,QList<double>> qmapSpeed; //速度
|
|
|
|
//容量最大值
|
|
const int MAX_CONTAINER = 100;
|
|
|
|
//数据转发定时器
|
|
QTimer* showPos_timer; //用于实时位置显示
|
|
QTimer* collisionDetect_timer;//用于地形碰撞检测
|
|
|
|
|
|
private:
|
|
//清除部分容器值
|
|
void removePositionContainer(int count);
|
|
|
|
void collisionDetectTimeout();
|
|
|
|
};
|
|
|
|
#endif // REALTIMEPOSITIONINFOTHREAD_H
|