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.
123 lines
3.0 KiB
C++
123 lines
3.0 KiB
C++
|
|
#ifndef COLLISIONDETECTIONTHREAD_H
|
|
#define COLLISIONDETECTIONTHREAD_H
|
|
/*
|
|
* @cbwu
|
|
* @brief 基于地形的碰撞检测子线程
|
|
*/
|
|
|
|
//#if _MSC_VER >= 1600
|
|
//#pragma execution_character_set("utf-8")
|
|
//#endif
|
|
|
|
#include <QApplication>
|
|
#include <QObject>
|
|
#include <QIcon>
|
|
#include <QSystemTrayIcon>
|
|
#include <QList>
|
|
#include <QTimer>
|
|
#include <QThread>
|
|
#include "qmapcontrol.h"
|
|
#include "geocomputation.h"
|
|
#include "geospatialanalysis.h"
|
|
#include "routeglobalvariant.h"
|
|
|
|
class CollisionDetectionThread : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit CollisionDetectionThread(QMapControl* pMapControl,QObject *parent = nullptr);
|
|
~CollisionDetectionThread();
|
|
//执行子线程业务逻辑
|
|
void working(double lon,double lat,double relativeAlititude,double heading,double speed);
|
|
|
|
void start(int ms);
|
|
|
|
public slots:
|
|
//接收飞机状态信息
|
|
void receiveLocationData(QList<double> lon,QList<double> lat,QList<double> relativeAlititude,
|
|
QList<double> heading,QList<double> speed);
|
|
//停止检测
|
|
void closedCollisionDetection();
|
|
|
|
signals:
|
|
void requestPositionInfo(int ms);//请求接收数据
|
|
void stopSendData();//停止接收数据
|
|
void showNotify(QString title,QString body,QVariantMap data);
|
|
private:
|
|
//判断是否同一碰撞点
|
|
bool isIdenticalCollisionPoint(double collisionLon,double collisionLat);
|
|
|
|
//重置预警
|
|
void resetWarning();
|
|
|
|
//显示预警通知
|
|
void showWarningNotify(int collisionTime,int collisionDist,int collisionHeight);
|
|
|
|
private:
|
|
int ms; //探测时间间隔
|
|
|
|
// double currentLon1; //飞机当前经度
|
|
// double currentLat1; //飞机当前纬度
|
|
// double heading; //航向角
|
|
// double relativeAltitude; //相对高度
|
|
// double speed;//飞行速度(m/s)
|
|
// const double detectDist = 500; //探测距离
|
|
QMapControl* pMapControl;
|
|
GeoComputation geoComputation;
|
|
GeoSpatialAnalysis spatialAnalysis;
|
|
|
|
//历史碰撞点
|
|
int collisionX;
|
|
int collisionY;
|
|
//预警等级
|
|
bool highWarning;
|
|
bool middleWarning;
|
|
bool lowWarning;
|
|
|
|
// QSystemTrayIcon *trayIcon;
|
|
// QIcon icon;
|
|
|
|
//探测标志
|
|
bool detectFlag;
|
|
bool endFlag;
|
|
};
|
|
|
|
|
|
|
|
/********************发数据测试线程**************************/
|
|
class SendDataTestThread : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit SendDataTestThread(QObject *parent = nullptr);
|
|
// ~SendDataTestThread();
|
|
//执行子线程业务逻辑
|
|
void working();
|
|
|
|
public slots:
|
|
void stopGenerateData();
|
|
|
|
private:
|
|
void generateData();
|
|
|
|
signals:
|
|
void sendPositionData(QList<double> lon,QList<double> lat,QList<double> relativeAlititude,
|
|
QList<double> heading,QList<double> speed);
|
|
|
|
void sendPositionData1(QList<double> lon,QList<double> lat,QList<double> heading);
|
|
|
|
void sendTest(int i);
|
|
|
|
private:
|
|
QPointF pt;
|
|
QList<double> lon, lat, heading,speed,relativeAlititude;
|
|
QTimer* m_timer;
|
|
bool stopFlag = false;
|
|
GeoComputation geoComputation;
|
|
};
|
|
|
|
#endif // COLLISIONDETECTIONTHREAD_H
|
|
|
|
|