xiaojinchi_branch
xiao 2 years ago
parent ae4c3e160c
commit 7b56eb23f8

@ -0,0 +1,116 @@
#include <math.h>
#include <iostream>
#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; // 湿度(单位:%
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 KiB

@ -0,0 +1,179 @@
#include "Prediction.h"
#include <QJsonObject>
#include <QJsonDocument>
#include "FP.h"
#include <QUrlQuery>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QMessageBox>
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;
}

@ -0,0 +1,24 @@
#pragma once
#include <QMainWindow>
#include "ui_Prediction.h"
#include <QPixmap>
#include <QPainter>
#include <QTcpServer>
#include <QTcpSocket>
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);
};

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PredictionClass</class>
<widget class="QMainWindow" name="PredictionClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1130</width>
<height>644</height>
</rect>
</property>
<property name="windowTitle">
<string>Prediction</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>120</x>
<y>50</y>
<width>642</width>
<height>509</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="display">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="Pre_tag">
<property name="geometry">
<rect>
<x>130</x>
<y>30</y>
<width>81</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>火势状况</string>
</property>
</widget>
<widget class="QPushButton" name="north">
<property name="geometry">
<rect>
<x>830</x>
<y>60</y>
<width>93</width>
<height>29</height>
</rect>
</property>
<property name="text">
<string>北风</string>
</property>
</widget>
<widget class="QPushButton" name="south">
<property name="geometry">
<rect>
<x>830</x>
<y>110</y>
<width>93</width>
<height>29</height>
</rect>
</property>
<property name="text">
<string>南风</string>
</property>
</widget>
<widget class="QPushButton" name="east">
<property name="geometry">
<rect>
<x>830</x>
<y>160</y>
<width>93</width>
<height>29</height>
</rect>
</property>
<property name="text">
<string>东风</string>
</property>
</widget>
<widget class="QPushButton" name="west">
<property name="geometry">
<rect>
<x>830</x>
<y>210</y>
<width>93</width>
<height>29</height>
</rect>
</property>
<property name="text">
<string>西风</string>
</property>
</widget>
<widget class="QLineEdit" name="Tree_Type">
<property name="geometry">
<rect>
<x>830</x>
<y>260</y>
<width>91</width>
<height>31</height>
</rect>
</property>
<property name="placeholderText">
<string>1针叶林2落叶林3灌木林</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1130</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

@ -17,6 +17,11 @@ Setting::Setting(QWidget *parent)
tcpsocket = new QTcpSocket(this); tcpsocket = new QTcpSocket(this);
tcpsocket->connectToHost("192.168.8.100", 9090); tcpsocket->connectToHost("192.168.8.100", 9090);
connect(ui.finished, &QPushButton::clicked, this, &Setting::on_finished_button); 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() Setting::~Setting()

@ -17,8 +17,8 @@
<widget class="QWidget" name="gridLayoutWidget"> <widget class="QWidget" name="gridLayoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>200</x>
<y>20</y> <y>100</y>
<width>451</width> <width>451</width>
<height>241</height> <height>241</height>
</rect> </rect>
@ -166,8 +166,8 @@
<widget class="QPushButton" name="finished"> <widget class="QPushButton" name="finished">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>360</x>
<y>290</y> <y>370</y>
<width>93</width> <width>93</width>
<height>29</height> <height>29</height>
</rect> </rect>

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

@ -1,5 +1,6 @@
#include "UAV_UI_new.h" #include "UAV_UI_new.h"
#include "Setting.h" #include "Setting.h"
#include "tips.h"
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
#include <string.h> #include <string.h>
#include <qlabel.h> #include <qlabel.h>
@ -12,8 +13,10 @@
using namespace cv; using namespace cv;
using namespace std; using namespace std;
VideoCapture cap; VideoCapture cap;
//const string VideoCaptureAdress = "http://admin:admin@192.168.8.126:8081"; Prediction* Predict_UI;
const string VideoCaptureAdress = "rtsp://192.168.144.108:8000/375897"; //热成像 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 = "rtsp://192.168.144.108:8000/165506"; //nomal
//const string VideoCaptureAdress = "C:\\Users\\87334\\Videos\\Captures\\Fast_sent.mp4"; //const string VideoCaptureAdress = "C:\\Users\\87334\\Videos\\Captures\\Fast_sent.mp4";
UAV_UI_new::UAV_UI_new(QWidget* parent) UAV_UI_new::UAV_UI_new(QWidget* parent)
@ -26,7 +29,7 @@ UAV_UI_new::UAV_UI_new(QWidget* parent)
connect(ui.Settings, &QPushButton::clicked, this, &UAV_UI_new::onclick_Setting_button); 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.connection, &QPushButton::clicked, this, &UAV_UI_new::on_connection_button);
connect(ui.stop, &QPushButton::clicked, this, &UAV_UI_new::on_stop_button); connect(ui.stop, &QPushButton::clicked, this, &UAV_UI_new::on_stop_button);
connect(ui.action, &QPushButton::clicked, this, &UAV_UI_new::on_action_button); connect(ui.Prediction, &QPushButton::clicked, this, &UAV_UI_new::on_predict_button);
connect(timer, SIGNAL(timeout()), this, SLOT(importImage())); connect(timer, SIGNAL(timeout()), this, SLOT(importImage()));
tcpsocket = new QTcpSocket(this); tcpsocket = new QTcpSocket(this);
tcpsocket->connectToHost("192.168.8.100", 9090); tcpsocket->connectToHost("192.168.8.100", 9090);
@ -42,14 +45,29 @@ UAV_UI_new::UAV_UI_new(QWidget* parent)
QByteArray jsonData = tcpsocket->readAll(); // ½ÓÊÕ JSON Êý¾Ý QByteArray jsonData = tcpsocket->readAll(); // ½ÓÊÕ JSON Êý¾Ý
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonData); QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonData);
QJsonObject jsonObject = jsonDocument.object(); QJsonObject jsonObject = jsonDocument.object();
QString type = jsonObject.value("type").toString(); QString type = jsonObject.value("type").toString();
if (type == "Alarming") { if (type == "Alarming") {
QMessageBox msgBox; QPixmap image_Pre(":/Fire.png");
msgBox.setWindowTitle("Alarming"); tips* tip = new tips(image_Pre);
msgBox.setText("Fire and Fire"); tip->show();
msgBox.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() UAV_UI_new::~UAV_UI_new()
@ -72,12 +90,15 @@ void UAV_UI_new::importImage() {
image.step, image.step,
QImage::Format_RGB888)); QImage::Format_RGB888));
ui.display->setPixmap(showimage); ui.display->setPixmap(showimage);
image_Pre = showimage;
} }
void UAV_UI_new::on_stop_button() { void UAV_UI_new::on_stop_button() {
timer->stop(); timer->stop();
cap.release(); cap.release();
ui.display->clear(); ui.display->clear();
} }
void UAV_UI_new::on_action_button() { 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();
} }

@ -3,6 +3,7 @@
#include <QtWidgets/QMainWindow> #include <QtWidgets/QMainWindow>
#include "ui_UAV_UI_new.h" #include "ui_UAV_UI_new.h"
#include "Setting.h" #include "Setting.h"
#include "Prediction.h"
#include <QTimer> #include <QTimer>
#include <qpushbutton.h> #include <qpushbutton.h>
#include <QPushbutton> #include <QPushbutton>
@ -25,11 +26,12 @@ private:
QTcpServer* tcpserver; QTcpServer* tcpserver;
QTcpSocket* tcpsocket; QTcpSocket* tcpsocket;
Setting Settings_UI; Setting Settings_UI;
QPixmap image_Pre;
private slots: private slots:
void on_connection_button(); void on_connection_button();
void on_stop_button(); void on_stop_button();
void importImage(); void importImage();
void onclick_Setting_button(); void onclick_Setting_button();
void on_action_button(); void on_predict_button();
}; };

@ -1,4 +1,9 @@
<RCC> <RCC>
<qresource prefix="UAV_UI_new"> <qresource prefix="/">
<file>background_1.png</file>
<file>background_2.png</file>
<file>background_3.png</file>
<file>Fire.png</file>
<file>kill_fire.jpg</file>
</qresource> </qresource>
</RCC> </RCC>

@ -6,10 +6,22 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1159</width> <width>1440</width>
<height>682</height> <height>1000</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1440</width>
<height>1200</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>UAV_UI_new</string> <string>UAV_UI_new</string>
</property> </property>
@ -64,7 +76,7 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>stop</string> <string>关闭图像</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="connection"> <widget class="QPushButton" name="connection">
@ -77,7 +89,7 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>connection</string> <string>连接图像</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="play_tag"> <widget class="QLabel" name="play_tag">
@ -90,20 +102,20 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>图像播放处</string> <string>实时图像</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="Settings"> <widget class="QPushButton" name="Settings">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1060</x> <x>1350</x>
<y>0</y> <y>0</y>
<width>93</width> <width>93</width>
<height>29</height> <height>29</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Settings</string> <string>设置</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="action"> <widget class="QPushButton" name="action">
@ -119,13 +131,26 @@
<string>出警</string> <string>出警</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="Prediction">
<property name="geometry">
<rect>
<x>820</x>
<y>260</y>
<width>93</width>
<height>29</height>
</rect>
</property>
<property name="text">
<string>预测</string>
</property>
</widget>
</widget> </widget>
<widget class="QMenuBar" name="menuBar"> <widget class="QMenuBar" name="menuBar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1159</width> <width>1440</width>
<height>26</height> <height>26</height>
</rect> </rect>
</property> </property>

@ -92,10 +92,12 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<QtRcc Include="UAV_UI_new.qrc" /> <QtRcc Include="UAV_UI_new.qrc" />
<QtUic Include="Prediction.ui" />
<QtUic Include="Setting.ui" /> <QtUic Include="Setting.ui" />
<QtUic Include="tips.ui" /> <QtUic Include="tips.ui" />
<QtUic Include="UAV_UI_new.ui" /> <QtUic Include="UAV_UI_new.ui" />
<QtMoc Include="UAV_UI_new.h" /> <QtMoc Include="UAV_UI_new.h" />
<ClCompile Include="Prediction.cpp" />
<ClCompile Include="Setting.cpp" /> <ClCompile Include="Setting.cpp" />
<ClCompile Include="tips.cpp" /> <ClCompile Include="tips.cpp" />
<ClCompile Include="UAV_UI_new.cpp" /> <ClCompile Include="UAV_UI_new.cpp" />
@ -105,12 +107,20 @@
<QtMoc Include="tips.h" /> <QtMoc Include="tips.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtMoc Include="Prediction.h" />
<ClInclude Include="FP.h" />
<ClInclude Include="levelToSpeed.h" />
<ClInclude Include="resource1.h" /> <ClInclude Include="resource1.h" />
<QtMoc Include="Setting.h" /> <QtMoc Include="Setting.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="UAV_UI_new1.rc" /> <ResourceCompile Include="UAV_UI_new1.rc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Image Include="background.jpg" />
<Image Include="Settings.jpg" />
<Image Include="Settings_2.jpg" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')"> <ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" /> <Import Project="$(QtMsBuild)\qt.targets" />

@ -46,6 +46,9 @@
<ClCompile Include="Setting.cpp"> <ClCompile Include="Setting.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Prediction.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtMoc Include="tips.h"> <QtMoc Include="tips.h">
@ -54,6 +57,9 @@
<QtMoc Include="Setting.h"> <QtMoc Include="Setting.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</QtMoc> </QtMoc>
<QtMoc Include="Prediction.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtUic Include="tips.ui"> <QtUic Include="tips.ui">
@ -62,15 +68,35 @@
<QtUic Include="Setting.ui"> <QtUic Include="Setting.ui">
<Filter>Form Files</Filter> <Filter>Form Files</Filter>
</QtUic> </QtUic>
<QtUic Include="Prediction.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="resource1.h"> <ClInclude Include="resource1.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="levelToSpeed.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FP.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="UAV_UI_new1.rc"> <ResourceCompile Include="UAV_UI_new1.rc">
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</ResourceCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Image Include="background.jpg">
<Filter>Resource Files</Filter>
</Image>
<Image Include="Settings.jpg">
<Filter>Resource Files</Filter>
</Image>
<Image Include="Settings_2.jpg">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project> </Project>

@ -2,9 +2,9 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup /> <PropertyGroup />
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2023-05-21T16:36:10.6302989Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2023-06-14T08:40:27.1306328Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2023-05-21T16:36:10.6837787Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2023-06-14T08:40:27.2066207Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 687 KiB

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 KiB

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 661 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

@ -0,0 +1,62 @@
#include<iostream>
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;
}

@ -10,8 +10,5 @@ int main(int argc, char *argv[])
QApplication a(argc, argv); QApplication a(argc, argv);
UAV_UI_new w; UAV_UI_new w;
w.show(); w.show();
/*VideoCapture cap;
const string VideoCaptureAdress = "rtsp://192.168.144.108:8000/165506";
cap.open(VideoCaptureAdress);*/
return a.exec(); return a.exec();
} }

@ -1,10 +1,20 @@
#include "tips.h" #include "tips.h"
tips::tips(QWidget *parent) tips::tips(QPixmap image,QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
{ {
ui.setupUi(this); 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() tips::~tips()
{} {
}
void tips::on_action_button() {
//·Å¾¯±¨
}

@ -8,9 +8,10 @@ class tips : public QMainWindow
Q_OBJECT Q_OBJECT
public: public:
tips(QWidget *parent = nullptr); tips(QPixmap image, QWidget *parent = nullptr);
~tips(); ~tips();
private: private:
Ui::tipsClass ui; Ui::tipsClass ui;
void on_action_button();
}; };

@ -1,22 +1,107 @@
<UI version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>tipsClass</class> <class>tipsClass</class>
<widget class="QMainWindow" name="tipsClass" > <widget class="QMainWindow" name="tipsClass">
<property name="objectName" > <property name="geometry">
<string notr="true">tipsClass</string>
</property>
<property name="geometry" >
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>600</width> <width>1130</width>
<height>400</height> <height>644</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="minimumSize">
<size>
<width>1130</width>
<height>644</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1130</width>
<height>644</height>
</size>
</property>
<property name="windowTitle">
<string>tips</string> <string>tips</string>
</property> <widget class="QMenuBar" name="menuBar" /> <widget class="QToolBar" name="mainToolBar" /> <widget class="QWidget" name="centralWidget" /> <widget class="QStatusBar" name="statusBar" /> </property>
<widget class="QWidget" name="centralWidget">
<widget class="QLabel" name="Pre_tag">
<property name="geometry">
<rect>
<x>19</x>
<y>6</y>
<width>81</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>火势状况</string>
</property>
</widget>
<widget class="QLabel" name="display">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="action">
<property name="geometry">
<rect>
<x>830</x>
<y>40</y>
<width>93</width>
<height>29</height>
</rect>
</property>
<property name="text">
<string>出警</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1130</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget> </widget>
<layoutDefault spacing="6" margin="11" /> <layoutdefault spacing="6" margin="11"/>
<pixmapfunction></pixmapfunction> <resources/>
<connections/> <connections/>
</UI> </ui>

Loading…
Cancel
Save