diff --git a/src/UAV_UI_new/FP.h b/src/UAV_UI_new/FP.h new file mode 100644 index 0000000..4f7bbba --- /dev/null +++ b/src/UAV_UI_new/FP.h @@ -0,0 +1,116 @@ +#include +#include +#include "levelToSpeed.h" + +using namespace std; +#define M_PI acos(-1) + + +class ForestFirePrediction { +public: + // 构造函数 + ForestFirePrediction(int wind_direction, double wind_level, double slope, double altitude, int cover_type, double fire_size, double temperature, double waterlevel) { + this->wind_direction = wind_direction; + this->wind_level = wind_level; + this->slope = slope; + this->altitude = altitude; + this->cover_type = cover_type; + this->fire_size = fire_size; + this->temperature = temperature; + this->waterlevel = waterlevel; + } + + // 计算受阻距离(单位:km) + double get_distance() { + double rad_slope = slope * M_PI / 180.0; // 将坡度转化为弧度 + double distance = sin(rad_slope) * altitude / 1000.0; // 计算受阻距离 + return distance; + } + + // 预测火灾蔓延范围 + void predict_range() { + double impact_factor; // 植被类型影响系数 + double correction_coef; // 风速补正系数 + double distance; // 受阻距离 + double composite_index; // 综合指数 + + // 根据植被类型获取影响系数 + switch (cover_type) { + case 1: // 针叶林 + impact_factor = 0.7; + break; + case 2: // 落叶林 + impact_factor = 0.5; + break; + case 3: // 灌木林 + impact_factor = 0.4; + break; + default: + cout << "植被类型输入错误!" << endl; + return; + } + + // 计算风速补正系数 + int angle = abs(wind_direction - 180); // 计算风向与火灾扩散方向之间的夹角 + if (angle <= 45 || angle >= 315) { // 如果夹角较小,则不需要进行风速补正 + correction_coef = 1; + } + else { + correction_coef = 0.65 + 0.35 * cos((angle - 45) * M_PI / 270.0); // 使用公式计算风速补正系数 + } + + // 计算受阻距离 + distance = get_distance(); + + // 计算综合指数 + composite_index = correction_coef * (1 + distance) * impact_factor; + + // 计算火灾蔓延半径 + double radius = sqrt(fire_size * 1000000 * composite_index) / M_PI; + double range = radius * pow(10, 1.5 * levelToSpeed(wind_level) / 30.0); + + // 输出预测结果 + cout << "火灾蔓延范围预测结果:" << endl; + cout << "火源最可能在" << radius << "米范围内发生。" << endl; + cout << "在风速为 " << wind_level << "级风的情况下,火源最可能的蔓延范围为 " << range << " 米。" << endl; + } + + // 预测火灾蔓延速度 + double predict_speed() { + double slope_factor; // 坡度影响因子 + double speed_factor; // 风速影响因子 + double size_factor; // 火源面积影响因子 + + // 计算坡度影响因子 + if (slope > 0) { + slope_factor = pow(3.33, sqrt(slope)); + } + else { + slope_factor = 1; + } + + // 计算风速影响因子 + double wind_speed = levelToSpeed(wind_level); + speed_factor = 5.15 * pow(wind_speed, 0.39) + 0.299 * temperature + 0.009 * (100 - waterlevel) - 0.304; + + // 计算火源面积影响因子 + size_factor = pow(fire_size, 0.77); + + // 计算火灾蔓延速度 + double speed = 0.348 * sqrt(size_factor * slope_factor * speed_factor); + + + // 输出预测结果 + return speed; + } + +private: + int wind_direction; // 风向(单位:度) + double wind_level; // 风力等级 + double slope; // 坡度(单位:度) + double altitude; // 海拔高度(单位:m) + int cover_type; // 植被类型(1:针叶林;2:落叶林;3:灌木林) + double fire_size; // 火源面积(单位:平方米) + double temperature; // 温度(单位:摄氏度) + double waterlevel; // 湿度(单位:%) +}; diff --git a/src/UAV_UI_new/Fire.png b/src/UAV_UI_new/Fire.png new file mode 100644 index 0000000..1fa4eeb Binary files /dev/null and b/src/UAV_UI_new/Fire.png differ diff --git a/src/UAV_UI_new/Prediction.cpp b/src/UAV_UI_new/Prediction.cpp new file mode 100644 index 0000000..7095053 --- /dev/null +++ b/src/UAV_UI_new/Prediction.cpp @@ -0,0 +1,179 @@ +#include "Prediction.h" +#include +#include +#include "FP.h" +#include +#include +#include +#include + +double Wind_direction, Wind_speed, Humidity, temp; +double fire_size; + +Prediction::Prediction(QPixmap image,double start_pos_x, double start_pos_y,double length,double width, double height, QWidget *parent) + : QMainWindow(parent) +{ + ui.setupUi(this); + double dis = distance_of_pix(height, length, width); + qDebug() << start_pos_x << " " << start_pos_y; + QRect rect1(start_pos_x, start_pos_y,length , width); + QPainter painter(&image); + painter.setCompositionMode(QPainter::CompositionMode_Clear); + painter.setCompositionMode(QPainter::CompositionMode_SourceOver); + painter.fillRect(rect1, QColor(255, 0, 0, 100)); + QString styleSheet = QString("background-image:url(:/background_2.png);\ + background-repeat:no-repeat;background-position:center;").arg(QCoreApplication::applicationDirPath()); + this->setStyleSheet(styleSheet); + this->resize(1080, 640); + getWeatherInfo("beijing"); + fire_size = dis * length * dis * width; + connect(ui.east, &QPushButton::clicked, this, [=] { + int type = 0; + int Tree_Type = ui.Tree_Type->text().toInt(); + QPixmap pixmap = ui.display->pixmap(); + int grow_pix = onclick_wind_button(dis, type, Tree_Type, start_pos_x, start_pos_y, length, width); + qDebug() << grow_pix << "?"; + QPainter painter_1(&pixmap); + QRect rect2(start_pos_x + length, start_pos_y, grow_pix, width); + if (painter_1.isActive()) { + painter_1.fillRect(rect2, QColor(0, 0, 255, 100)); + ui.display->setPixmap(pixmap); + } + else { + qDebug() << "painter is not initialized"; + return; + } + //painter_1.fillRect(rect2, QColor(0, 0, 255, 100)); + //ui.display->setPixmap(pixmap); + }); + connect(ui.west, &QPushButton::clicked, this, [=] { + int type = 1; + int Tree_Type = ui.Tree_Type->text().toInt(); + QPixmap pixmap = ui.display->pixmap(); + int grow_pix = onclick_wind_button(dis, type, Tree_Type, start_pos_x, start_pos_y, length, width); + QPainter painter_1(&pixmap); + QRect rect2(start_pos_x - grow_pix, start_pos_y, grow_pix, width); + if (painter_1.isActive()) { + painter_1.fillRect(rect2, QColor(0, 0, 255, 100)); + ui.display->setPixmap(pixmap); + } + else { + qDebug() << "painter is not initialized"; + return; + } + //painter_1.fillRect(rect2, QColor(0, 0, 255, 100)); + //ui.display->setPixmap(pixmap); + }); + connect(ui.north, &QPushButton::clicked, this, [=] { + int type = 2; + int Tree_Type = ui.Tree_Type->text().toInt(); + QPixmap pixmap = ui.display->pixmap(); + int grow_pix = onclick_wind_button(dis, type, Tree_Type, start_pos_x, start_pos_y, length, width); + QPainter painter_1(&pixmap); + QRect rect2(start_pos_x, start_pos_y - grow_pix, length, grow_pix); + if (painter_1.isActive()) { + painter_1.fillRect(rect2, QColor(0, 0, 255, 100)); + ui.display->setPixmap(pixmap); + } + else { + qDebug() << "painter is not initialized"; + return; + } + //painter_1.fillRect(rect2, QColor(0, 0, 255, 100)); + //ui.display->setPixmap(pixmap); + }); + connect(ui.south, &QPushButton::clicked, this, [=] { + int type = 3; + int Tree_Type = ui.Tree_Type->text().toInt(); + QPixmap pixmap = ui.display->pixmap(); + int grow_pix = onclick_wind_button(dis, type, Tree_Type, start_pos_x, start_pos_y, length, width); + QPainter painter_1(&pixmap); + QRect rect2(start_pos_x, start_pos_y + width, length, grow_pix); + if (painter_1.isActive()) { + painter_1.fillRect(rect2, QColor(0, 0, 255, 100)); + ui.display->setPixmap(pixmap); + } + else { + qDebug() << "painter is not initialized"; + return; + } + //painter_1.fillRect(rect2, QColor(0, 0, 255, 100)); + //ui.display->setPixmap(pixmap); + }); + ui.display->setPixmap(image); +} + +Prediction::~Prediction() +{ + +} +double Prediction::distance_of_pix(int height,int length, int width) { + // ˻߶Ϊ HͼһƬسΪ L + double f = 50.0; // ͷĽ࣬λΪ + double w = 60.0; // ͷˮƽҰλΪ + double A = (2.0 * atan(w / (2.0 * f))) * M_PI / 180.0; // ӽǣλΪ + double r = height / tan(A); // ʵʾͼıֵ + double D = (length * r) / f; // ʵʳȣλΪ + double res = D / length; + // + return res; +} +int Prediction::onclick_wind_button(double dis, int type, int Tree_Type, int start_pos_x, int start_pos_y, int length, int wid) { + //0 for east 1 for west 2 for north 3 for south + double wind_level = std::pow(Wind_speed / 0.836, 0.16); + if (type == 0) { + ForestFirePrediction ffp((int)Wind_direction, wind_level, 12, 200, Tree_Type, fire_size, temp, Humidity); + int speed = ffp.predict_speed(); + int grow_pix = (speed / 12) / dis; + return grow_pix; + if (type == 1) { + ForestFirePrediction ffp((int)Wind_direction, wind_level, 12, 200, Tree_Type, fire_size, temp, Humidity); + int speed = ffp.predict_speed(); + int grow_pix = (speed / 12) / dis; + return grow_pix; + } + if (type == 2) { + ForestFirePrediction ffp((int)Wind_direction, wind_level, 12, 200, Tree_Type, fire_size, temp, Humidity); + int speed = ffp.predict_speed(); + int grow_pix = (speed / 12) / dis; + return grow_pix; + qDebug() << speed << " " << grow_pix << "Grow"; + + } + if (type == 3) { + ForestFirePrediction ffp((int)Wind_direction, wind_level, 12, 200, Tree_Type, fire_size, temp, Humidity); + int speed = ffp.predict_speed(); + int grow_pix = (speed / 12) / dis; + return grow_pix; + } + } +} +void Prediction::getWeatherInfo(QString city) +{ + // Գƽ URL + QString encodedCity = QUrl::toPercentEncoding(city); + + // API URL ַ + QString url = "http://api.openweathermap.org/data/2.5/weather?q=" + encodedCity + "&appid=8a4595940d39d20fbb6f4f94ba813c65"; + + // ʹ + QNetworkAccessManager* nam = new QNetworkAccessManager(); + + // GET + QNetworkReply* reply = nam->get(QNetworkRequest(QUrl(url))); + + // ȴ + while (!reply->isFinished()) { + qApp->processEvents(); + } + + // ȡص JSON + QByteArray jsonData = reply->readAll(); + QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonData); + QJsonObject jsonObject = jsonDocument.object(); + Wind_direction = jsonObject["wind"].toObject()["deg"].toDouble(); + Wind_speed = jsonObject["wind"].toObject()["speed"].toDouble(); + Humidity = jsonObject["main"].toObject()["humidity"].toDouble(); + temp = jsonObject.value("main").toObject().value("temp").toDouble(); + qDebug() << Wind_direction << Wind_speed << Humidity; +} diff --git a/src/UAV_UI_new/Prediction.h b/src/UAV_UI_new/Prediction.h new file mode 100644 index 0000000..3842a39 --- /dev/null +++ b/src/UAV_UI_new/Prediction.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include "ui_Prediction.h" +#include +#include +#include +#include + +class Prediction : public QMainWindow +{ + Q_OBJECT + +public: + Prediction(QPixmap image, double start_pos_x, double start_pos_y, double length, double width, double height, QWidget *parent = nullptr); + ~Prediction(); + //QPainter *painter; + +private: + Ui::PredictionClass ui; + double distance_of_pix(int height,int length,int width); + int onclick_wind_button(double dis,int type,int Tree_Type,int start_pos_x,int start_pos_y,int length,int wid); + void getWeatherInfo(QString city); +}; diff --git a/src/UAV_UI_new/Prediction.ui b/src/UAV_UI_new/Prediction.ui new file mode 100644 index 0000000..34dc380 --- /dev/null +++ b/src/UAV_UI_new/Prediction.ui @@ -0,0 +1,159 @@ + + + PredictionClass + + + + 0 + 0 + 1130 + 644 + + + + Prediction + + + + + + 120 + 50 + 642 + 509 + + + + + 640 + 480 + + + + + + + true + + + + 640 + 480 + + + + + 640 + 480 + + + + + + + + + + + + + 130 + 30 + 81 + 31 + + + + 火势状况 + + + + + + 830 + 60 + 93 + 29 + + + + 北风 + + + + + + 830 + 110 + 93 + 29 + + + + 南风 + + + + + + 830 + 160 + 93 + 29 + + + + 东风 + + + + + + 830 + 210 + 93 + 29 + + + + 西风 + + + + + + 830 + 260 + 91 + 31 + + + + 1:针叶林;2:落叶林;3:灌木林 + + + + + + + 0 + 0 + 1130 + 26 + + + + + + TopToolBarArea + + + false + + + + + + + + diff --git a/src/UAV_UI_new/Setting.cpp b/src/UAV_UI_new/Setting.cpp new file mode 100644 index 0000000..d064b1c --- /dev/null +++ b/src/UAV_UI_new/Setting.cpp @@ -0,0 +1,56 @@ +#include "Setting.h" +#include +#include +#include +#include +#include + +Setting::Setting(QWidget *parent) + : QMainWindow(parent) +{ + ui.setupUi(this); + /*float longitude = ui.longitude->text().toFloat(); + float latitude = ui.latitude->text().toFloat(); + int hours = ui.hours->text().toInt(); + int minutes = ui.minutes->text().toInt(); + int seconds = ui.seconds->text().toInt();*/ + tcpsocket = new QTcpSocket(this); + tcpsocket->connectToHost("192.168.8.100", 9090); + connect(ui.finished, &QPushButton::clicked, this, &Setting::on_finished_button); + QString styleSheet = QString("background-image:url(:/background_1.png);\ + background-repeat:no-repeat;background-position:center;").arg(QCoreApplication::applicationDirPath()); + this->setStyleSheet(styleSheet); + this->resize(806, 453); + ui.finished->setStyleSheet("background-color: white;"); +} + +Setting::~Setting() +{ +} +void Setting::on_finished_button() { + float longitude = ui.longitude->text().toFloat(); + float latitude = ui.latitude->text().toFloat(); + int hours = ui.hours->text().toInt(); + int minutes = ui.minutes->text().toInt(); + int seconds = ui.seconds->text().toInt(); + int x = ui.x->text().toInt(); + int y = ui.y->text().toInt(); + int z = ui.z->text().toInt(); + QJsonObject msg; + msg.insert("type", "Set"); + msg.insert("lon", longitude); + msg.insert("lat", latitude); + msg.insert("hours", hours); + msg.insert("minutes", minutes); + msg.insert("seconds", seconds); + msg.insert("x", x); + msg.insert("y", y); + msg.insert("z", z); + QJsonDocument jsonDocument; + jsonDocument.setObject(msg); + QByteArray dataArray = jsonDocument.toJson(); + if (tcpsocket->write(dataArray) == -1) { + qDebug() << "send TCP data package failed!"; + } + qDebug() << "sent!"; +} diff --git a/src/UAV_UI_new/Setting.ui b/src/UAV_UI_new/Setting.ui new file mode 100644 index 0000000..df56753 --- /dev/null +++ b/src/UAV_UI_new/Setting.ui @@ -0,0 +1,203 @@ + + + SettingClass + + + + 0 + 0 + 871 + 571 + + + + Setting + + + + + + 200 + 100 + 451 + 241 + + + + + + + 出发时间: + + + + + + + + 150 + 16777215 + + + + + + + + + + + + 150 + 16777215 + + + + + + + + + + + + 150 + 16777215 + + + + 经度 + + + + + + + + 150 + 16777215 + + + + + + + + + + + + 150 + 16777215 + + + + 纬度 + + + + + + + + 80 + 16777215 + + + + 目的地 + + + + + + + + 16777215 + 20 + + + + x,y,z + + + + + + + + 150 + 16777215 + + + + 0 + + + + + + + + 150 + 16777215 + + + + 0 + + + + + + + + 150 + 16777215 + + + + 0 + + + + + + + + + 360 + 370 + 93 + 29 + + + + 完成 + + + + + + + 0 + 0 + 871 + 26 + + + + + + TopToolBarArea + + + false + + + + + + + + diff --git a/src/UAV_UI_new/Settings.jpg b/src/UAV_UI_new/Settings.jpg new file mode 100644 index 0000000..588aaa7 Binary files /dev/null and b/src/UAV_UI_new/Settings.jpg differ diff --git a/src/UAV_UI_new/Settings_2.jpg b/src/UAV_UI_new/Settings_2.jpg new file mode 100644 index 0000000..e515216 Binary files /dev/null and b/src/UAV_UI_new/Settings_2.jpg differ diff --git a/src/UAV_UI_new/UAV_UI_new.cpp b/src/UAV_UI_new/UAV_UI_new.cpp new file mode 100644 index 0000000..eeac212 --- /dev/null +++ b/src/UAV_UI_new/UAV_UI_new.cpp @@ -0,0 +1,104 @@ +#include "UAV_UI_new.h" +#include "Setting.h" +#include "tips.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace cv; +using namespace std; +VideoCapture cap; +Prediction* Predict_UI; +int length, wid, start_pos_x, start_pos_y, heig,slope,elevation; +const string VideoCaptureAdress = "http://admin:admin@192.168.8.126:8081"; +//const string VideoCaptureAdress = "rtsp://192.168.144.108:8000/375897"; //ȳ +//const string VideoCaptureAdress = "rtsp://192.168.144.108:8000/165506"; //nomal +//const string VideoCaptureAdress = "C:\\Users\\87334\\Videos\\Captures\\Fast_sent.mp4"; +UAV_UI_new::UAV_UI_new(QWidget* parent) + : QMainWindow(parent) +{ + ui.setupUi(this); + timer = new QTimer(this); + ui.display->setStyleSheet("border:1px solid black "); + ui.play_tag->setStyleSheet("background-color:white"); + connect(ui.Settings, &QPushButton::clicked, this, &UAV_UI_new::onclick_Setting_button); + connect(ui.connection, &QPushButton::clicked, this, &UAV_UI_new::on_connection_button); + connect(ui.stop, &QPushButton::clicked, this, &UAV_UI_new::on_stop_button); + connect(ui.Prediction, &QPushButton::clicked, this, &UAV_UI_new::on_predict_button); + connect(timer, SIGNAL(timeout()), this, SLOT(importImage())); + tcpsocket = new QTcpSocket(this); + tcpsocket->connectToHost("192.168.8.100", 9090); + connect(tcpsocket, &QTcpSocket::connected, [=]() { + QMessageBox *tip = new QMessageBox(this); + //QLabel *tip = new QLabel(this); + tip->setText("ӳɹ"); + tip->setInformativeText("connected successfully"); + tip->setStandardButtons(QMessageBox::Ok); + tip->show(); + }); + connect(tcpsocket, &QTcpSocket::readyRead, [=]() { + QByteArray jsonData = tcpsocket->readAll(); // JSON + QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonData); + QJsonObject jsonObject = jsonDocument.object(); + QString type = jsonObject.value("type").toString(); + if (type == "Alarming") { + QPixmap image_Pre(":/Fire.png"); + tips* tip = new tips(image_Pre); + tip->show(); + ui.Prediction->setStyleSheet("color:red"); + length = jsonObject.value("length").toDouble(); + wid = jsonObject.value("width").toDouble(); + qDebug() << jsonObject.value("center_x").toDouble() << jsonObject.value("length").toDouble() / 2; + start_pos_x = jsonObject.value("center_x").toDouble() - jsonObject.value("length").toDouble() / 2; + start_pos_y = jsonObject.value("center_y").toDouble() - jsonObject.value("width").toDouble() / 2; + qDebug() << start_pos_x << " " << start_pos_y << "mAIN"; + slope = jsonObject.value("slope").toDouble(); + elevation = jsonObject.value("slope").toDouble(); + } + if (type == "Set") { + heig = jsonObject.value("z").toInt(); + } + }); + QString styleSheet = QString("background-image:url(:/background_3.png);\ + background-repeat:no-repeat;background-position:center;").arg(QCoreApplication::applicationDirPath()); + this->setStyleSheet(styleSheet); + this->resize(1440, 720); +} + +UAV_UI_new::~UAV_UI_new() +{} +void UAV_UI_new::on_connection_button() { + cap.open(VideoCaptureAdress); + timer->start(100); +}; +void UAV_UI_new::onclick_Setting_button() { + Settings_UI.show(); +} +void UAV_UI_new::importImage() { + Mat image; + cap >> image; + cvtColor(image, image, COLOR_BGR2RGB); + cv::resize(image, image, Size(640, 480)); + QPixmap showimage = QPixmap::fromImage(QImage((const uchar*)(image.data), + image.cols, + image.rows, + image.step, + QImage::Format_RGB888)); + ui.display->setPixmap(showimage); + image_Pre = showimage; +} +void UAV_UI_new::on_stop_button() { + timer->stop(); + cap.release(); + ui.display->clear(); +} +void UAV_UI_new::on_predict_button() { + QPixmap image_Pre(":/Fire.png"); + Predict_UI = new Prediction(image_Pre, start_pos_x,start_pos_y,length,wid,100); + Predict_UI->show(); +} diff --git a/src/UAV_UI_new/UAV_UI_new.h b/src/UAV_UI_new/UAV_UI_new.h new file mode 100644 index 0000000..f33ade1 --- /dev/null +++ b/src/UAV_UI_new/UAV_UI_new.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include "ui_UAV_UI_new.h" +#include "Setting.h" +#include "Prediction.h" +#include +#include +#include +#include +#include +#include + +class UAV_UI_new : public QMainWindow +{ + Q_OBJECT + +public: + UAV_UI_new(QWidget *parent = nullptr); + ~UAV_UI_new(); + +private: + Ui::UAV_UI_newClass ui; + QTimer* timer; + double rate; + QTcpServer* tcpserver; + QTcpSocket* tcpsocket; + Setting Settings_UI; + QPixmap image_Pre; + +private slots: + void on_connection_button(); + void on_stop_button(); + void importImage(); + void onclick_Setting_button(); + void on_predict_button(); +}; diff --git a/src/UAV_UI_new/UAV_UI_new.qrc b/src/UAV_UI_new/UAV_UI_new.qrc new file mode 100644 index 0000000..1867e34 --- /dev/null +++ b/src/UAV_UI_new/UAV_UI_new.qrc @@ -0,0 +1,9 @@ + + + background_1.png + background_2.png + background_3.png + Fire.png + kill_fire.jpg + + diff --git a/src/UAV_UI_new/UAV_UI_new.ui b/src/UAV_UI_new/UAV_UI_new.ui new file mode 100644 index 0000000..3e5a82b --- /dev/null +++ b/src/UAV_UI_new/UAV_UI_new.ui @@ -0,0 +1,173 @@ + + + UAV_UI_newClass + + + + 0 + 0 + 1440 + 1000 + + + + + 0 + 0 + + + + + 1440 + 1200 + + + + UAV_UI_new + + + + + + 90 + 60 + 642 + 509 + + + + + 640 + 480 + + + + + + + true + + + + 640 + 480 + + + + + 640 + 480 + + + + + + + + + + + + + 820 + 140 + 93 + 29 + + + + 关闭图像 + + + + + + 820 + 70 + 93 + 29 + + + + 连接图像 + + + + + + 100 + 40 + 81 + 31 + + + + 实时图像 + + + + + + 1350 + 0 + 93 + 29 + + + + 设置 + + + + + + 820 + 200 + 93 + 29 + + + + 出警 + + + + + + 820 + 260 + 93 + 29 + + + + 预测 + + + + + + + 0 + 0 + 1440 + 26 + + + + + + TopToolBarArea + + + false + + + + + + + + + + diff --git a/src/UAV_UI_new/UAV_UI_new.vcxproj b/src/UAV_UI_new/UAV_UI_new.vcxproj new file mode 100644 index 0000000..21ea755 --- /dev/null +++ b/src/UAV_UI_new/UAV_UI_new.vcxproj @@ -0,0 +1,130 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {FB496CF3-A3CE-4A50-BAC4-A9F43A71A5F9} + QtVS_v304 + 10.0.22000.0 + 10.0.22000.0 + $(MSBuildProjectDirectory)\QtMsBuild + + + + Application + v143 + + + Application + v143 + + + + + + + 6.2.4 + core;gui;network;widgets + debug + + + 6.2.4 + core;gui;widgets + release + + + + + + + + + + + + + + + + + D:\OpenCV\opencv\build\include\opencv2;D:\OpenCV\opencv\build\include;$(IncludePath) + D:\OpenCV\opencv\build\x64\vc15\lib;$(LibraryPath) + + + + + + D:\OpenCV\opencv\build\x64\vc15\lib;%(AdditionalLibraryDirectories) + opencv_world455d.lib;%(AdditionalDependencies) + + + + + true + true + ProgramDatabase + Disabled + + + Windows + true + + + + + true + true + None + MaxSpeed + + + Windows + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/UAV_UI_new/UAV_UI_new.vcxproj.filters b/src/UAV_UI_new/UAV_UI_new.vcxproj.filters new file mode 100644 index 0000000..804e6e6 --- /dev/null +++ b/src/UAV_UI_new/UAV_UI_new.vcxproj.filters @@ -0,0 +1,102 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts + + + + + Resource Files + + + Form Files + + + Header Files + + + Source Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + + + Form Files + + + Form Files + + + Form Files + + + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + + + Resource Files + + + Resource Files + + + Resource Files + + + \ No newline at end of file diff --git a/src/UAV_UI_new/UAV_UI_new.vcxproj.user b/src/UAV_UI_new/UAV_UI_new.vcxproj.user new file mode 100644 index 0000000..9b3500c --- /dev/null +++ b/src/UAV_UI_new/UAV_UI_new.vcxproj.user @@ -0,0 +1,10 @@ + + + + + 2023-06-14T08:40:27.1306328Z + + + 2023-06-14T08:40:27.2066207Z + + \ No newline at end of file diff --git a/src/UAV_UI_new/background.jpg b/src/UAV_UI_new/background.jpg new file mode 100644 index 0000000..33817f7 Binary files /dev/null and b/src/UAV_UI_new/background.jpg differ diff --git a/src/UAV_UI_new/background_1.png b/src/UAV_UI_new/background_1.png new file mode 100644 index 0000000..f44c761 Binary files /dev/null and b/src/UAV_UI_new/background_1.png differ diff --git a/src/UAV_UI_new/background_2.png b/src/UAV_UI_new/background_2.png new file mode 100644 index 0000000..80f72e9 Binary files /dev/null and b/src/UAV_UI_new/background_2.png differ diff --git a/src/UAV_UI_new/background_3.png b/src/UAV_UI_new/background_3.png new file mode 100644 index 0000000..1c7742d Binary files /dev/null and b/src/UAV_UI_new/background_3.png differ diff --git a/src/UAV_UI_new/kill_fire.jpg b/src/UAV_UI_new/kill_fire.jpg new file mode 100644 index 0000000..41910a7 Binary files /dev/null and b/src/UAV_UI_new/kill_fire.jpg differ diff --git a/src/UAV_UI_new/levelToSpeed.h b/src/UAV_UI_new/levelToSpeed.h new file mode 100644 index 0000000..7098b2f --- /dev/null +++ b/src/UAV_UI_new/levelToSpeed.h @@ -0,0 +1,62 @@ +#include +using namespace std; + +double levelToSpeed(int level) { + double speed = 0; + if (level >= 0 && level <= 12) { + double speed = 0; + switch (level) { + case 1: + speed = 0.3; + break; + case 2: + speed = 1.6; + break; + case 3: + speed = 3.4; + break; + case 4: + speed = 5.5; + break; + case 5: + speed = 8.0; + break; + case 6: + speed = 10.8; + break; + case 7: + speed = 13.9; + break; + case 8: + speed = 17.2; + break; + case 9: + speed = 20.8; + break; + case 10: + speed = 24.5; + break; + case 11: + speed = 28.5; + break; + case 12: + speed = 32.7; + break; + + } + + } + else if (level == 13) { + speed = 35.8; + } + else if (level == 14) { + speed = 41.5; + } + else if (level == 15) { + speed = 48.2; + } + else { + cout << "无效的风力等级!" << endl; + } + return speed; +} \ No newline at end of file diff --git a/src/UAV_UI_new/main.cpp b/src/UAV_UI_new/main.cpp new file mode 100644 index 0000000..ae8b72b --- /dev/null +++ b/src/UAV_UI_new/main.cpp @@ -0,0 +1,14 @@ +#include "UAV_UI_new.h" +#include +#include +#include +using namespace std; +using namespace cv; + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + UAV_UI_new w; + w.show(); + return a.exec(); +} diff --git a/src/UAV_UI_new/tips.cpp b/src/UAV_UI_new/tips.cpp new file mode 100644 index 0000000..e878542 --- /dev/null +++ b/src/UAV_UI_new/tips.cpp @@ -0,0 +1,20 @@ +#include "tips.h" + +tips::tips(QPixmap image,QWidget *parent) + : QMainWindow(parent) +{ + ui.setupUi(this); + ui.display->setPixmap(image); + connect(ui.action, &QPushButton::clicked, this, &tips::on_action_button); + ui.action->setStyleSheet("background-color:red;"); + QString styleSheet = QString("background-image:url(:/kill_fire.jpg);\ + background-repeat:no-repeat;background-position:center;").arg(QCoreApplication::applicationDirPath()); + this->setStyleSheet(styleSheet); +} + +tips::~tips() +{ +} +void tips::on_action_button() { + //ž +} diff --git a/src/UAV_UI_new/tips.h b/src/UAV_UI_new/tips.h new file mode 100644 index 0000000..be5b454 --- /dev/null +++ b/src/UAV_UI_new/tips.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include "ui_tips.h" + +class tips : public QMainWindow +{ + Q_OBJECT + +public: + tips(QPixmap image, QWidget *parent = nullptr); + ~tips(); + +private: + Ui::tipsClass ui; + void on_action_button(); +}; diff --git a/src/UAV_UI_new/tips.ui b/src/UAV_UI_new/tips.ui new file mode 100644 index 0000000..da25089 --- /dev/null +++ b/src/UAV_UI_new/tips.ui @@ -0,0 +1,107 @@ + + + tipsClass + + + + 0 + 0 + 1130 + 644 + + + + + 1130 + 644 + + + + + 1130 + 644 + + + + tips + + + + + + 19 + 6 + 81 + 31 + + + + 火势状况 + + + + + true + + + + 20 + 30 + 640 + 480 + + + + + 640 + 480 + + + + + 640 + 480 + + + + + + + + + + 830 + 40 + 93 + 29 + + + + 出警 + + + + + + + 0 + 0 + 1130 + 26 + + + + + + TopToolBarArea + + + false + + + + + + + +