上一篇文章只讲了基本的东西,这一篇要完成qt的安装,构建项目,并且将上一篇的代码导入进去。
某比利比例搜qt安装,看到qt5.14.2的下载安装,跟着做
1、创建项目
创建新项目,选择Qt widgets Application,然后选路径,然后就选mainwindow的就可以了。
2、导入代码
将上一篇的那些什么city.h,city.cpp等创建了,复制进去。
然后,下面将放出mainwindow.h和cpp的全部代码,请copy
h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtCharts> // 导入QtCharts所有的头文件
QT_CHARTS_USE_NAMESPACE
#include <QMainWindow>
#include<QWidget>
#include"satellite.h"
#include"city.h"
#include"timeslot.h"
#include"square.h"
#include"QVector"
#include<vector>
#include<stack>
using namespace std;
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void paintEvent(QPaintEvent *event);
private slots:
void on_pushButton_clicked();
void on_theOne_clicked();
void on_theTwo_clicked();
void on_theThree_clicked();
void on_theFour_clicked();
void on_pushButton_2_clicked();
void on_pushButton_3_clicked();
void on_pushButton_4_clicked();
private:
Ui::MainWindow *ui;
public:
//经度75 - 135,设置24个格子,每格长度为2.5
//对于纬度0-55,设置22个个子,每个长度2.5
Square map1[22][24];
//stack<Square> waitDraw;
Square* waitDraw;
int waitSize;
int setDraw = 0;
double *Coverage;
CityList theCityList;//城市列表
Satellite satellite[9];//卫星列表
double radius = 7.0068;//每个卫星的半径都是这个。
void sInit();//卫星的信息初始化函数
void ReadFile(int number);//和sInit配套使用
Square* us;
Square* waitDraw2;
int waitSize2;
void readUs();
};
#endif // MAINWINDOW_H
cpp
#include <QtCharts> // 导入QtCharts所有的头文件
QT_CHARTS_USE_NAMESPACE
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<fstream>
#include<QMessageBox>
#include<QPainter>
#include<QRect>
#include<QColor>
#include<QString>
#include"square.h"
#include<QBrush>
using namespace std;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
us = new Square[1540];
readUs();
for(int i = 0; i < 22; i++)
{
for(int j = 0; j < 24; j++)
{
//y对应纬度,x对应经度
map1[i][j].y = 180 + 24 * i;
map1[i][j].x = 24 + 24 * j;
map1[i][j].latitude = 2.5*i;
map1[i][j].longitude = 75 + 2.5*j;
map1[i][j].state = 0;
map1[i][j].length = 24;
map1[i][j].realSize = 2.5;//每个方格的边都为2.5个经纬
}
}
waitDraw = new Square[200];
waitDraw2 = new Square[1000];
waitSize2 = 0;
waitSize = 0;
ui->stackedWidget->setCurrentWidget(ui->page);//切换到页面1
//point = new Point[3369];
sInit();//调用初始化函数
}
MainWindow::~MainWindow()
{
delete ui;
}
//读取卫星信息
void MainWindow::ReadFile(int number)
{
ifstream ifs;
switch (number)
{
case 0:
{
ifs.open("D:/vc/z/myEarth/Position_0.txt");
break;
}
case 1:
{
ifs.open("D:/vc/z/myEarth/Position_1.txt");
break;
}
case 2:
{
ifs.open("D:/vc/z/myEarth/Position_2.txt");
break;
}
case 3:
{
ifs.open("D:/vc/z/myEarth/Position_3.txt");
break;
}
case 4:
{
ifs.open("D:/vc/z/myEarth/Position_4.txt");
break;
}
case 5:
{
ifs.open("D:/vc/z/myEarth/Position_5.txt");
break;
}
case 6:
{
ifs.open("D:/vc/z/myEarth/Position_6.txt");
break;
}
case 7:
{
ifs.open("D:/vc/z/myEarth/Position_7.txt");
break;
}
case 8:
{
ifs.open("D:/vc/z/myEarth/Position_8.txt");
break;
}
default:
{
return;
}
}
//将每一秒的信息读入
for(int i = 0; i < 86400; i++)
{
ifs>>satellite[number].x[i]>>satellite[number].y[i];//读入第number个卫星的第i时刻的位置信息
}
ifs.close();
}
//求平方
double culSquare(double a)
{
return a*a;
}
void MainWindow::sInit()
{
//其实半径甚至就是一样
/*
satellite[0].radius = 7.00681;
satellite[1].radius = 7.00679;
satellite[2].radius = 7.00681;
satellite[3].radius = 7.0068;
satellite[4].radius = 7.0068;
satellite[5].radius = 7.00682;
satellite[6].radius = 7.00679;
satellite[7].radius = 7.0068;
satellite[8].radius = 7.00682;
*/
//一个循环 每个卫星每秒钟对应的x ,y读进来
for(int i = 0; i < 9; i++)
{
ReadFile(i);
}
int start = 0;
//将各城市的时间窗口计算出来,外循环遍历城市
for(int i = 0; i < 19; i++)
{
bool flag = false;//记录城市是否被卫星星座覆盖
//中间循环遍历时间
for(int j = 0; j < 86400; j++)
{
//内层循环遍历卫星,时间复杂度较高。
int number =0;//当前时间段未提供服务的卫星个数
for(int k = 0; k < 9; k++)
{
//判断城市是否在该卫星的搜索范围内,看方程(x-x0)*(x-x0) + (y-y0)*(y-y0)是否小于等于radius
//第i个城市的x-该卫星的x,即经度longitude,y即纬度latitude
//第k个卫星在第j秒的数值
if((culSquare(theCityList.city[i].longitude - satellite[k].x[j]) + culSquare(theCityList.city[i].latitude - satellite[k].y[j])) <= culSquare(radius))
{
//如果该时间段处在星座范围内,且flag标记false,说明此时刻开始进入星座的范围
if(!flag)
{
start = j;//j就是当前时间
flag = true;//标记被覆盖
}
break;//退出当前卫星循环,因为只要有一个卫星提供就算星座在提供
}
//执行到这一步,说明此卫星没有提供服务,Number++
number++;
//若9个
if(flag && number == 9)
{
//此时不再星座内,但是flag却为true,说明有了一个时间窗口出现
//传入start,和结束时间j - 1
TimeSlot t(start, j - 1);
//把tpush给该城市的时间窗口VEctor
theCityList.city[i].slot.push_back(t);
//然后把flag置为false
flag = false;
}
}
}
}
/*
ifstream ifs1;
ifs1.open("D:/vc/z/myEarth/us.txt");
for(int i = 0; i < 3369; i++)
{
ifs1>>point[i].longitude>>point[i].latitude;
}
ifs1.close();
*/
}
void MainWindow::readUs()
{
ifstream ifs1;
ifs1.open("D:/vc/z/myEarth/fangGe.txt");
for(int i = 0; i < 288; i++)
{
ifs1 >> us[i].longitude >> us[i].latitude >> us[i].realSize;
}
ifs1.close();
ifs1.open("D:/vc/z/myEarth/fangGe2.txt");
for(int i = 288; i < 1540; i++)
{
ifs1 >> us[i].longitude >> us[i].latitude >> us[i].realSize;
}
ifs1.close();
for(int i = 0; i < 1540; i++)
{
us[i].x = (double)20*us[i].longitude - 4500;
us[i].y = (double)(-20)*us[i].latitude + 1200 ;
us[i].length = (double)20*us[i].realSize;
}
}
void MainWindow::on_theOne_clicked()
{
setDraw = 0;
ui->stackedWidget->setCurrentWidget(ui->page);//切换到页面1
}
void MainWindow::on_theTwo_clicked()
{
setDraw = 0;
ui->stackedWidget->setCurrentWidget(ui->page_2);//切换到页面2
}
void MainWindow::on_theThree_clicked()
{
//切换页面
setDraw = 1;
ui->stackedWidget->setCurrentWidget(ui->page_3);
}
void MainWindow::on_theFour_clicked()
{
setDraw = 2;
ui->stackedWidget->setCurrentWidget(ui->page_4);
}
//输入城市名字,查看该城市的时间窗口信息
void MainWindow::on_pushButton_clicked()
{
QString QStr=ui->lineEdit->text();//获取字符串
int locate = theCityList.location(QStr);//获取城市坐标
//ui->textBrowser->append(a);
//将各城市的信息输出就行了
//外循环遍历城市
/*
for(int i = 0; i < 19; i++)
{
//内循环遍历城市的时间窗口
unsigned size = theCityList.city[i].slot.size();
ui->textBrowser->append("城市" + theCityList.city[i].name + "的时间窗口如下:");
for(unsigned j = 0; j < size; j++)
{
int h = theCityList.city[i].slot[j].startTime / 3600;//时
int m = (theCityList.city[i].slot[j].startTime % 3600) / 60;//分
int s = (theCityList.city[i].slot[j].startTime % 3600) % 60;//秒
QString a("时间窗口" + QString::number(j) + " [" + QString::number(h) + ":" + QString::number(m) + ":" +QString::number(s) + "]");
ui->textBrowser->append(a);
}
}
*/
if(locate != -1)
{
ui->textBrowser->clear();
unsigned size = theCityList.city[locate].slot.size();
if(size == 0)
{
QString qs = "该城市没有被卫星星座服务过";
ui->textBrowser->append(qs);
return;
}
//要算最大值和最小值,其实有个思路是自己写一个 机制类似优先队列的动态数组MyVector,每次push_back都会进行维护,自动排序,维护时间参考二叉堆。
int maxTimeLength = 0;//记录最大长度
int maxLocate = 0;
int minTimeLength = 86400;//记录最小长度
int minLocate = 0;
int accumulate =0;//累计
ui->textBrowser->append("城市" + theCityList.city[locate].name + "的时间窗口如下:");
for(unsigned j = 0; j < size; j++)
{
accumulate += theCityList.city[locate].slot[j].length;//累计值啊
//最新最大
if(theCityList.city[locate].slot[j].length > maxTimeLength)
{
maxTimeLength = theCityList.city[locate].slot[j].length;
maxLocate = j;//更新位置
}
if(theCityList.city[locate].slot[j].length < minTimeLength)
{
minTimeLength = theCityList.city[locate].slot[j].length;
minLocate = j;//更新位置
}
int h0 = theCityList.city[locate].slot[j].startTime / 3600;//时
int m0 = (theCityList.city[locate].slot[j].startTime % 3600) / 60;//分
int s0 = (theCityList.city[locate].slot[j].startTime % 3600) % 60;//秒
int h1 = theCityList.city[locate].slot[j].overTime / 3600;//时
int m1 = (theCityList.city[locate].slot[j].overTime % 3600) / 60;//分
int s1 = (theCityList.city[locate].slot[j].overTime % 3600) % 60;//秒
QString a("时间窗口" + QString::number(j) + " [" + QString::number(h0) + ":" + QString::number(m0) + ":" +QString::number(s0) + ", " + QString::number(h1) + ":" + QString::number(m1) + ":" +QString::number(s1) + "]");
ui->textBrowser->append(a);
}
//到这里了,把最大最小和累计进行输出。
int h0 = theCityList.city[locate].slot[maxLocate].startTime / 3600;//时
int m0 = (theCityList.city[locate].slot[maxLocate].startTime % 3600) / 60;//分
int s0 = (theCityList.city[locate].slot[maxLocate].startTime % 3600) % 60;//秒
int h1 = theCityList.city[locate].slot[maxLocate].overTime / 3600;//时
int m1 = (theCityList.city[locate].slot[maxLocate].overTime % 3600) / 60;//分
int s1 = (theCityList.city[locate].slot[maxLocate].overTime % 3600) % 60;//秒
QString qstr("时间窗口最大值为:"+ QString::number(maxTimeLength) + " 对应时间窗口: [" + QString::number(h0) + ":" + QString::number(m0) + ":" +QString::number(s0) + ", " + QString::number(h1) + ":" + QString::number(m1) + ":" +QString::number(s1) + "]");
h0 = theCityList.city[locate].slot[minLocate].startTime / 3600;//时
m0 = (theCityList.city[locate].slot[minLocate].startTime % 3600) / 60;//分
s0 = (theCityList.city[locate].slot[minLocate].startTime % 3600) % 60;//秒
h1 = theCityList.city[locate].slot[minLocate].overTime / 3600;//时
m1 = (theCityList.city[locate].slot[minLocate].overTime % 3600) / 60;//分
s1 = (theCityList.city[locate].slot[minLocate].overTime % 3600) % 60;//秒
QString qstr2("时间窗口最小值为:"+ QString::number(minTimeLength) + " 对应时间窗口: [" + QString::number(h0) + ":" + QString::number(m0) + ":" +QString::number(s0) + ", " + QString::number(h1) + ":" + QString::number(m1) + ":" +QString::number(s1) + "]");
ui->textBrowser->append(qstr);
ui->textBrowser->append(qstr2);
//输出累计值
ui->textBrowser->append("时间窗口累计值:"+QString::number(accumulate));
//接下来求解时间间隙,我个人理解是相邻两个时间窗口之间产生一个时间间隙,不知道对不对,自己看吧
int maxGap = 0;
int maxGapLocate[2] = {0, 0};//二维数组
accumulate = 0;//用于计算累积的
//终究就是一个遍历数组的问题,把数组遍历一遍即可
int temp = theCityList.city[locate].slot[0].overTime + 1;
for(unsigned i = 1; i < size; i++)
{
int tmp = theCityList.city[locate].slot[i].startTime - temp;//间隙长度
int timeGapOver = theCityList.city[locate].slot[i].startTime - 1;
h0 = temp / 3600;//时
m0 = (temp % 3600) / 60;//分
s0 = (temp % 3600) % 60;//秒
h1 = timeGapOver / 3600;//时
m1 = (timeGapOver % 3600) / 60;//分
s1 = (timeGapOver % 3600) % 60;//秒
QString strTmp("时间间隙: ["+ QString::number(h0) + ":" + QString::number(m0) + ":" +QString::number(s0) + ", " + QString::number(h1) + ":" + QString::number(m1) + ":" +QString::number(s1) + "]");
ui->textBrowser->append(strTmp);
accumulate += tmp;
if(maxGap < tmp)
{
maxGap = tmp;
maxGapLocate[0] = theCityList.city[locate].slot[i].startTime - 1;
maxGapLocate[1] = temp;
}
//然后temp跳转到下一个点
temp = theCityList.city[locate].slot[i].overTime + 1;//记得+1
}
qstr = "最长时间间隙为:" + QString::number(maxGap);
h0 = maxGapLocate[1] / 3600;//时
m0 = (maxGapLocate[1] % 3600) / 60;//分
s0 = (maxGapLocate[1] % 3600) % 60;//秒
h1 = maxGapLocate[0] / 3600;//时
m1 = (maxGapLocate[0] % 3600) / 60;//分
s1 = (maxGapLocate[0] % 3600) % 60;//秒
QString qq("最长时间间隙对应时间段为: ["+ QString::number(h0) + ":" + QString::number(m0) + ":" +QString::number(s0) + ", " + QString::number(h1) + ":" + QString::number(m1) + ":" +QString::number(s1) + "]");
qstr2 = "累计时间间隙为:" + QString::number(accumulate);
ui->textBrowser->append(qstr);
ui->textBrowser->append(qq);
ui->textBrowser->append(qstr2);
}
/*
QString a,b;
for(int i = 0; i < 86400; i++)
{
a = QString::number(satellite[3].x[i]);
b = QString::number(satellite[3].y[i]);
ui->textBrowser->append(a + " " + b);
}
*/
}
void MainWindow::on_pushButton_2_clicked()
{
if(ui->lineEdit_2->text().isEmpty() || ui->lineEdit_3->text().isEmpty())
{
QMessageBox::information(nullptr, "提示", "不可输入空串", QMessageBox::Yes);
return;
}
QString log = ui->lineEdit_2->text();
QString lat = ui->lineEdit_3->text();
double longitude = log.toDouble();
double latitude = lat.toDouble();
if(longitude < 75||longitude > 135 ||latitude < 0 || latitude > 55)
{
QMessageBox::information(nullptr, "提示", "非法输入,注意输入的经纬度是否有错误", QMessageBox::Yes);
return;
}
ui->textBrowser_2->clear();
City c;
c.longitude = longitude;
c.latitude = latitude;
int start = 0;
//将各城市的时间窗口计算出来,外循环遍历城市
bool flag = false;//记录城市是否被卫星星座覆盖
//遍历时间
for(int j = 0; j < 86400; j++)
{
//遍历卫星
int number =0;//当前时间段未提供服务的卫星个数
for(int k = 0; k < 9; k++)
{
//判断城市是否在该卫星的搜索范围内,看方程(x-x0)*(x-x0) + (y-y0)*(y-y0)是否小于等于radius
//第i个城市的x-该卫星的x,即经度longitude,y即纬度latitude
//第k个卫星在第j秒的数值
if((culSquare(c.longitude - satellite[k].x[j]) + culSquare(c.latitude - satellite[k].y[j])) <= culSquare(radius))
{
//如果该时间段处在星座范围内,且flag标记false,说明此时刻开始进入星座的范围
if(!flag)
{
start = j;//j就是当前时间
flag = true;//标记被覆盖
}
break;//退出当前卫星循环,因为只要有一个卫星提供就算星座在提供
}
//执行到这一步,说明此卫星没有提供服务,Number++
number++;
//若9个
if(flag && number == 9)
{
//此时不再星座内,但是flag却为true,说明有了一个时间窗口出现
//传入start,和结束时间j - 1
TimeSlot t(start, j - 1);
//把tpush给该城市的时间窗口VEctor
c.slot.push_back(t);
//然后把flag置为false
flag = false;
}
}
}
unsigned size = c.slot.size();
if(size == 0)
{
QString qs = "该城市没有被卫星星座服务过";
ui->textBrowser_2->append(qs);
return;
}
//第一题第二问求的是时间间隙,由于我懒的再写一个TimeGap了,直接沿用TimeSlot,然后进行计算
//题目要求在75 - 135 ,0 - 55 内,但是这个点最小离散到0.1精度就有600 * 550个点
//要求出这么多个点的信息,我不知道有什么合适的方法,目前采用的是查询某一点的方式
int h0;
int m0;//分
int s0;//秒
int h1;//时
int m1;//分
int s1;//秒
double *isTime = new double[86400];
int maxGap = 0;
int maxGapLocate[2] = {0, 0};//二维数组
int gapSquare = 0;//平方和
int accumulate = 0;//用于计算累积的
//终究就是一个遍历数组的问题,把数组遍历一遍即可
int temp = c.slot[0].overTime + 1;
for(unsigned i = 1; i < size; i++)
{
int tmp = c.slot[i].startTime - temp;//间隙长度
int timeGapOver = c.slot[i].startTime - 1;
h0 = temp / 3600;//时
m0 = (temp % 3600) / 60;//分
s0 = (temp % 3600) % 60;//秒
h1 = timeGapOver / 3600;//时
m1 = (timeGapOver % 3600) / 60;//分
s1 = (timeGapOver % 3600) % 60;//秒
QString strTmp("时间间隙: ["+ QString::number(h0) + ":" + QString::number(m0) + ":" +QString::number(s0) + ", " + QString::number(h1) + ":" + QString::number(m1) + ":" +QString::number(s1) + "]");
ui->textBrowser_2->append(strTmp);
for(int k = temp; k < c.slot[i].startTime; k++)
{
isTime[k] = 1;
}
accumulate += tmp;
gapSquare += tmp * tmp;
if(maxGap < tmp)
{
maxGap = tmp;
maxGapLocate[0] = c.slot[i].startTime - 1;
maxGapLocate[1] = temp;
}
//然后temp跳转到下一个点
temp = c.slot[i].overTime + 1;//记得+1
}
QString qstr = "最长时间间隙为:" + QString::number(maxGap);
h0 = maxGapLocate[1] / 3600;//时
m0 = (maxGapLocate[1] % 3600) / 60;//分
s0 = (maxGapLocate[1] % 3600) % 60;//秒
h1 = maxGapLocate[0] / 3600;//时
m1 = (maxGapLocate[0] % 3600) / 60;//分
s1 = (maxGapLocate[0] % 3600) % 60;//秒
QString qq("对应时间段为: ["+ QString::number(h0) + ":" + QString::number(m0) + ":" +QString::number(s0) + ", " + QString::number(h1) + ":" + QString::number(m1) + ":" +QString::number(s1) + "]");
QString qstr2 = "累计时间间隙为:" + QString::number(accumulate);
ui->textBrowser_2->append(qstr);
ui->textBrowser_2->append(qq);
ui->textBrowser_2->append(qstr2);
qstr2 = "时间间隙平方和为:" + QString::number(gapSquare);
ui->textBrowser_2->append(qstr2);
double *isTime1 = new double[86400];
QSplineSeries* series = new QSplineSeries(); // 创建一个样条曲线对象
series->setName("时间窗口");
for(unsigned k = 0; k < size; k++)
{
for(int i = c.slot[k].startTime; i <= c.slot[k].overTime; i++)
{
isTime1[i] = 1;
}
}
for(int i = 0; i < 86400; i++)
{
series->append(i, isTime1[i]);
}
QChart* chart = ui->graphicsView_2->chart(); // 获取一个chart用于管理不同类型的series和其他图表相关对象
chart->legend()->hide(); // 隐藏图例
chart->addSeries(series); // 添加创建好的曲线图对象
chart->setTitle("时间窗口可视化"); // 设置标题
chart->createDefaultAxes(); // 基于已添加到图表中的series为图表创建轴。以前添加到图表中的任何轴都将被删除。
chart->axes(Qt::Vertical).first()->setRange(0, 1.2); // 设置Y轴的范围
//ui->graphicsView_2->setRenderHint(QPainter::Antialiasing); // 设置抗锯齿
QSplineSeries* series2 = new QSplineSeries(); // 创建一个样条曲线对象
series2->setName("时间间隙");
for(int i = 0; i < 86400; i++)
{
series2->append(i, isTime[i]);
}
QChart* chart2 = ui->graphicsView_3->chart(); // 获取一个chart用于管理不同类型的series和其他图表相关对象
chart2->legend()->hide(); // 隐藏图例
chart2->addSeries(series2); // 添加创建好的曲线图对象
chart2->setTitle("时间间隙可视化"); // 设置标题
chart2->createDefaultAxes(); // 基于已添加到图表中的series为图表创建轴。以前添加到图表中的任何轴都将被删除。
chart2->axes(Qt::Vertical).first()->setRange(0, 1.2); // 设置Y轴的范围
}
double PI = 3.141592654;
//积分公式,x0 - x1为经度,,y0 - y1是纬度
double integral(double x0, double y0, double x1, double y1)
{
double S = (cos(y0*PI/180) - cos(y1 * PI / 180)) * ((x1 * PI / 180) - (x0 * PI / 180));
return S;
}
//75° - 135°区域的覆盖率问题
void MainWindow::on_pushButton_3_clicked()
{
//格式00:00:00,有bug,目前不采用了
//QString a = ui->lineEdit_4->text();
//QString b = ui->lineEdit_5->text();
//int start = a.mid(0, 2).toInt()*3600 + a.mid(3, 2).toInt()*60 + a.mid(6, 2).toInt();
//int over = b.mid(0, 2).toInt()*3600 + b.mid(3, 2).toInt()*60 + b.mid(6, 2).toInt();
int start = ui->lineEdit_4->text().toInt();
int over = ui->lineEdit_5->text().toInt();
int timeLength = over - start + 1;
if(start>over||start<0||start>86400||over<0||over>86400)
{
QMessageBox::information(nullptr, "提示", "输入的时间有误!", QMessageBox::Yes);
return;
}
Coverage = new double[timeLength];//动态空间
//计算方格内个点是否在里面
stack<Square> st;
//遍历,查找有哪些点直接被覆盖和不被覆盖,对于未确定的点,传入stack中
//外层循环,遍历时间
/*
for(int i = start;i <= over; i++)
{
simulation(i);
repaint();
}
*/
//st用于保存那些待分割的点
double cul;
double leftTop1,leftTop2;
double leftBotton1, leftBotton2;
double rightTop1, rightTop2;
double rightBotton1, rightBotton2;
double temp1;
double temp2;
double temp3;
double temp4;
double tmp = culSquare(radius);
double length_2;
double real_2;
double acuCover = 0;
for(int i = start; i <= over; i++)
{
cul = 0;
for(int j = 0; j < 22; j++)
{
for(int k = 0; k < 24; k++)
{
//遍历卫星
int number = 0;
for(int t = 0; t < 9; t++)
{
//保存每个格子的4个点,
leftTop1 = map1[j][k].longitude; leftTop2 = map1[j][k].latitude;
leftBotton1 = leftTop1; leftBotton2 = leftTop2 + 2.5;
rightTop1 = leftTop1 + 2.5; rightTop2 = leftTop2;
rightBotton1 = rightTop1; rightBotton2 = leftBotton2;
temp1 = culSquare(leftTop1 - satellite[t].x[i]) + culSquare(leftTop2 - satellite[t].y[i]);
temp2 = culSquare(leftBotton1 - satellite[t].x[i]) + culSquare(leftBotton2 - satellite[t].y[i]);
temp3 = culSquare(rightTop1 - satellite[t].x[i]) + culSquare(rightTop2 - satellite[t].y[i]);
temp4 = culSquare(rightBotton1 - satellite[t].x[i]) + culSquare(rightBotton2 - satellite[t].y[i]);
//如果全部小于等于,说明应该填充
if(temp1 <= tmp&&temp2 <= tmp&&temp3 <= tmp&&temp4 <= tmp)
{
map1[j][k].state = 1;//beifugai
//计算该面的面积
cul += integral(leftTop1, leftTop2, rightBotton1, rightBotton2);
if(map1[j][k].isCover == false)
{
map1[j][k].isCover = true;
acuCover += integral(leftTop1, leftTop2, rightBotton1, rightBotton2);
//ui->textBrowser_3->append(QString::number(j) + " " + QString::number(k)); 测试使用
}
break;
}
//全都在外边,不处理
if(temp1 > tmp&&temp2 > tmp&&temp3 > tmp&&temp4 > tmp)
{
number++;//不在卫星里的数量+1
}
//如果已经遍历到最后一个卫星,还没有退出,而且number没有加到 9 ,说明是待判断。
if(number < 9&&t == 8)
{
length_2 = map1[j][k].length/(double)2;
real_2 = map1[j][k].realSize/(double)2;
//待定的点,进行分割,一割为4
//构造函数:Square(double _x, double _y, double log, double lat, double realSize, double _length, int _state);
Square s1(map1[j][k].x, map1[j][k].y, map1[j][k].longitude, map1[j][k].latitude, real_2, length_2, 0);
Square s2(map1[j][k].x + length_2, map1[j][k].y, map1[j][k].longitude + real_2, map1[j][k].latitude, real_2, length_2, 0);
Square s3(map1[j][k].x, map1[j][k].y + length_2, map1[j][k].longitude, map1[j][k].latitude + real_2, real_2, length_2, 0);
Square s4(map1[j][k].x + length_2, map1[j][k].y + length_2, map1[j][k].longitude + real_2, map1[j][k].latitude + real_2, real_2, length_2, 0);
st.push(s1);st.push(s2);st.push(s3);st.push(s4);
}
}
}
}
while(!st.empty())
{
Square squa = st.top();//取栈顶
st.pop();//弹出栈顶
length_2 = squa.length/(double)2;
real_2 = squa.realSize/(double)2;
//分割
leftTop1 = squa.longitude; leftTop2 = squa.latitude;
leftBotton1 = leftTop1; leftBotton2 = leftTop2 + squa.realSize;
rightTop1 = leftTop1 + squa.realSize; rightTop2 = leftTop2;
rightBotton1 = rightTop1; rightBotton2 = leftBotton2;
int num = 0;
for(int t = 0; t < 9; t++)
{
temp1 = culSquare(leftTop1 - satellite[t].x[i]) + culSquare(leftTop2 - satellite[t].y[i]);
temp2 = culSquare(leftBotton1 - satellite[t].x[i]) + culSquare(leftBotton2 - satellite[t].y[i]);
temp3 = culSquare(rightTop1 - satellite[t].x[i]) + culSquare(rightTop2 - satellite[t].y[i]);
temp4 = culSquare(rightBotton1 - satellite[t].x[i]) + culSquare(rightBotton2 - satellite[t].y[i]);
if(temp1 <= tmp&&temp2 <= tmp&&temp3 <= tmp&&temp4 <= tmp)
{
squa.state = 1;
cul += integral(leftTop1, leftTop2, rightBotton1, rightBotton2);
waitDraw[waitSize++] = squa;
break;
}
//全都在外边,不处理
if(temp1 > tmp&&temp2 > tmp&&temp3 > tmp&&temp4 > tmp)
{
num++;//不被覆盖数量+1
}
//如果已经到最后一个卫星,而且num还不到9,说明要待判断
if(num < 9&&t == 8)
{
//限制分割,这种情况还能分
if(squa.realSize > 0.625)
{
Square s1(squa.x, squa.y, squa.longitude, squa.latitude, real_2, length_2, 0);
Square s2(squa.x + length_2, squa.y, squa.longitude + real_2, squa.latitude, real_2, length_2, 0);
Square s3(squa.x, squa.y + length_2, squa.longitude, squa.latitude + real_2, real_2, length_2, 0);
Square s4(squa.x + length_2, squa.y + length_2, squa.longitude + real_2, squa.latitude + real_2, real_2, length_2, 0);
st.push(s1);st.push(s2);st.push(s3);st.push(s4);
}
else//这种情况就是不可再分了,这个点就是待判断,标蓝即可,没什么好说的
{
squa.state = 2;
//waitDraw.push_back(squa);//加入
waitDraw[waitSize++] = squa;
}
}
}
}
ui->textBrowser_3->append(QString::number(cul/0.44655));
ui->textBrowser_4->clear();
ui->textBrowser_4->append(QString::number(acuCover/0.44655));
Coverage[i - start] = cul/0.44655;//记录
repaint();//每秒重新绘制,
delete []waitDraw;
waitDraw = new Square[200];
waitSize = 0;
//初始化,全部点都不在里面
for(int i = 0; i < 22; i++)
{
for(int j = 0; j < 24; j++)
{
map1[i][j].state = 0;
}
}
}
acuCover = acuCover / 0.44655;
QSplineSeries* series = new QSplineSeries(); // 创建一个样条曲线对象
series->setName("曲线");
for(int i = start;i <= over; i++)
{
series->append(i, Coverage[i - start]);
}
QChart* chart = ui->graphicsView->chart(); // 获取一个chart用于管理不同类型的series和其他图表相关对象
chart->legend()->hide(); // 隐藏图例
chart->addSeries(series); // 添加创建好的曲线图对象
chart->setTitle("覆盖率曲线"); // 设置标题
chart->createDefaultAxes(); // 基于已添加到图表中的series为图表创建轴。以前添加到图表中的任何轴都将被删除。
chart->axes(Qt::Vertical).first()->setRange(0, 0.15); // 设置Y轴的范围
ui->graphicsView->setRenderHint(QPainter::Antialiasing); // 设置抗锯齿
//ui->textBrowser_4->append("累计覆盖率为:" + QString::number(acuCover));
QMessageBox::information(nullptr, "提示", "已经模拟完", QMessageBox::Yes);
delete []Coverage;
Coverage = nullptr;
}
//QFont font; //颜色
//QColor color(255, 255, 255); //字体
//QPen pen; //画笔
//绘图事件
void MainWindow::paintEvent(QPaintEvent *event)
{
QPainter painter;
QBrush qb;
qb.setColor(QColor(255, 0, 0));
painter.begin(this);//设置窗口画布
//第3题画图,75 - 135,,0 - 55
if(setDraw == 1)
{
for(int i = 0; i < 22; i++)
{
for(int j = 0; j < 24; j++)
{
if(map1[i][j].state == 1)
{
//painter.drawRect(map1[i][j].x, map1[i][j].y, map1[i][j].length, map1[i][j].length);
painter.fillRect(QRect(map1[i][j].x, map1[i][j].y, map1[i][j].length, map1[i][j].length), QBrush(Qt::red));
}
// else if(map1[i][j].state == 2)
//{
// painter.fillRect(QRect(map1[i][j].x, map1[i][j].y, map1[i][j].length, map1[i][j].length), QBrush(Qt::blue));
// }
}
}
for(int i = 0; i < waitSize; i++)
{
if(waitDraw[i].state == 1)
{
painter.fillRect(QRect(waitDraw[i].x, waitDraw[i].y, waitDraw[i].length, waitDraw[i].length), QBrush(Qt::red));
}
else if(waitDraw[i].state == 2)
{
painter.fillRect(QRect(waitDraw[i].x, waitDraw[i].y, waitDraw[i].length, waitDraw[i].length), QBrush(Qt::blue));
}
}
for(int i = 0; i < 22; i++)
{
for(int j = 0; j < 24; j++)
{
painter.drawRect(map1[i][j].x, map1[i][j].y, map1[i][j].length, map1[i][j].length);
}
if(i % 4 == 0)
{
double temp = 75 +2.5*i;//经
QString qs = QString::number(temp);
painter.drawText(i*24 + 24, 170, qs + "°");
temp = 2.5 * i;// 纬度
qs =QString::number(temp);
painter.drawText(610, 180 + i * 24, qs + "°");
}
else if(i == 21)
{
QString qs = QString::number(135);
painter.drawText(588, 170, qs + "°");
qs = QString::number(55);
painter.drawText(610, 710, qs + "°");
}
}
}
else if(setDraw == 2)
{
//painter.drawRect(100,100,500,500);
for(int i = 0; i < 1540; i++)
{
if(us[i].state == 1)
{
painter.fillRect(QRect(us[i].x, us[i].y, us[i].length, -(us[i].length)), QBrush(Qt::red));
}
else if(us[i].state == 2)
{
painter.fillRect(QRect(us[i].x, us[i].y, us[i].length, -(us[i].length)), QBrush(Qt::blue));
}
}
for(int i = 0; i < waitSize2; i++)
{
if(waitDraw2[i].state == 1)
{
painter.fillRect(QRect(waitDraw2[i].x, waitDraw2[i].y, waitDraw2[i].length, -(waitDraw2[i].length)), QBrush(Qt::red));
}
}
for(int i = 0; i < waitSize2; i++)
{
if(waitDraw2[i].state == 2)
{
painter.fillRect(QRect(waitDraw2[i].x, waitDraw2[i].y, waitDraw2[i].length, -(waitDraw2[i].length)), QBrush(Qt::blue));
}
}
for(int i = 0; i < 1540; i++)
{
painter.drawRect(us[i].x, us[i].y, us[i].length, -(us[i].length));
}
}
/*
for(int i = 0; i < 22; i++)
{
for(int j = 0; j < 24; j++)
{
if(map1[i][j].state == 1)
{
//painter.drawRect(map1[i][j].x, map1[i][j].y, map1[i][j].length, map1[i][j].length);
painter.fillRect(QRect(map1[i][j].x, map1[i][j].y, map1[i][j].length, map1[i][j].length), QBrush(Qt::red));
}
// else if(map1[i][j].state == 2)
//{
// painter.fillRect(QRect(map1[i][j].x, map1[i][j].y, map1[i][j].length, map1[i][j].length), QBrush(Qt::blue));
// }
}
}
for(int i = 0; i < waitSize; i++)
{
if(waitDraw[i].state == 1)
{
painter.fillRect(QRect(waitDraw[i].x, waitDraw[i].y, waitDraw[i].length, waitDraw[i].length), QBrush(Qt::red));
}
else if(waitDraw[i].state == 2)
{
painter.fillRect(QRect(waitDraw[i].x, waitDraw[i].y, waitDraw[i].length, waitDraw[i].length), QBrush(Qt::blue));
}
}
for(int i = 0; i < 22; i++)
{
for(int j = 0; j < 24; j++)
{
painter.drawRect(map1[i][j].x, map1[i][j].y, map1[i][j].length, map1[i][j].length);
}
if(i % 4 == 0)
{
double temp = 75 +2.5*i;//经
QString qs = QString::number(temp);
painter.drawText(i*24 + 24, 170, qs + "°");
temp = 2.5 * i;// 纬度
qs =QString::number(temp);
painter.drawText(610, 180 + i * 24, qs + "°");
}
else if(i == 21)
{
QString qs = QString::number(135);
painter.drawText(588, 170, qs + "°");
qs = QString::number(55);
painter.drawText(610, 710, qs + "°");
}
}
*/
painter.end();
}
//美国多边形区域覆盖率问题
void MainWindow::on_pushButton_4_clicked()
{
//for(int i = 0; i < 3369; i++)
// {
// ui->textBrowser_5->append(QString::number(point[i].longitude) + " " + QString::number(point[i].latitude));
//}
//格式00:00:00,有bug,目前不采用了
//QString a = ui->lineEdit_4->text();
//QString b = ui->lineEdit_5->text();
//int start = a.mid(0, 2).toInt()*3600 + a.mid(3, 2).toInt()*60 + a.mid(6, 2).toInt();
//int over = b.mid(0, 2).toInt()*3600 + b.mid(3, 2).toInt()*60 + b.mid(6, 2).toInt();
int start = ui->lineEdit_6->text().toInt();
int over = ui->lineEdit_7->text().toInt();
int timeLength = over - start + 1;
if(start>over||start<0||start>86400||over<0||over>86400)
{
QMessageBox::information(nullptr, "提示", "输入的时间有误!", QMessageBox::Yes);
return;
}
Coverage = new double[timeLength];//动态空间
//计算方格内个点是否在里面
stack<Square> st1;
//遍历,查找有哪些点直接被覆盖和不被覆盖,对于未确定的点,传入stack中
//外层循环,遍历时间
/*
for(int i = start;i <= over; i++)
{
simulation(i);
repaint();
}
*/
//st用于保存那些待分割的点
double cul;//用于计算每秒的覆盖率
double leftTop1,leftTop2;//左上点
double leftBotton1, leftBotton2;//左下点
double rightTop1, rightTop2;//右上点
double rightBotton1, rightBotton2;//右下点
double temp1;//(左上点的x - 卫星x)² + (左上点的y - 卫星y)²
double temp2;
double temp3;
double temp4;
double tmp = culSquare(radius);//对应temp,先保存着radius的平方,避免重复计算了,降低性能
double length_2;//若出现方格分割,length_2 = 被分割方格.length/2
double real_2;//若出现方格分割,length_2 = 被分割方格.length/2
double acuCover = 0;//accumulateCover,直接翻译,累计覆盖率,
for(int i = start; i <= over; i++)
{
cul = 0;
for(int j = 0; j < 1540; j++)
{
//遍历卫星
int number = 0;
for(int t = 0; t < 9; t++)
{
//保存每个格子的4个点,
leftTop1 = us[j].longitude; leftTop2 = us[j].latitude;
leftBotton1 = leftTop1; leftBotton2 = leftTop2 + us[j].realSize;
rightTop1 = leftTop1 + us[j].realSize; rightTop2 = leftTop2;
rightBotton1 = rightTop1; rightBotton2 = leftBotton2;
temp1 = culSquare(leftTop1 - satellite[t].x[i]) + culSquare(leftTop2 - satellite[t].y[i]);
temp2 = culSquare(leftBotton1 - satellite[t].x[i]) + culSquare(leftBotton2 - satellite[t].y[i]);
temp3 = culSquare(rightTop1 - satellite[t].x[i]) + culSquare(rightTop2 - satellite[t].y[i]);
temp4 = culSquare(rightBotton1 - satellite[t].x[i]) + culSquare(rightBotton2 - satellite[t].y[i]);
//如果全部小于等于,说明应该填充
if(temp1 <= tmp&&temp2 <= tmp&&temp3 <= tmp&&temp4 <= tmp)
{
us[j].state = 1;//beifugai
//计算该面的面积
cul += integral(leftTop1, leftTop2, rightBotton1, rightBotton2);
//若是第一次被覆盖,加入累计覆盖中,并且标记被覆盖过了。
if(us[j].isCover == false)
{
us[j].isCover = true;//标记被覆盖过
acuCover += integral(leftTop1, leftTop2, rightBotton1, rightBotton2);//累计覆盖的累加
//ui->textBrowser_3->append(QString::number(j) + " " + QString::number(k)); 测试使用
}
break;
}
//全都在外边,不处理
if(temp1 > tmp&&temp2 > tmp&&temp3 > tmp&&temp4 > tmp)
{
number++;//不在卫星里的数量+1
}
//如果已经遍历到最后一个卫星,还没有退出,而且number没有加到 9 ,说明是待判断。
if(number < 9&&t == 8)
{
if(us[j].realSize >0.3125)
{
//ui->textBrowser_5->append("加入栈");
length_2 = us[j].length/(double)2;
real_2 = us[j].realSize/(double)2;
//待定的点,进行分割,一割为4
//构造函数:Square(double _x, double _y, double log, double lat, double realSize, double _length, int _state);
Square s1(us[j].x, us[j].y, us[j].longitude, us[j].latitude, real_2, length_2, 0);
Square s2(us[j].x + length_2, us[j].y, us[j].longitude + real_2, us[j].latitude, real_2, length_2, 0);
Square s3(us[j].x, us[j].y - length_2, us[j].longitude, us[j].latitude + real_2, real_2, length_2, 0);
Square s4(us[j].x + length_2, us[j].y - length_2, us[j].longitude + real_2, us[j].latitude + real_2, real_2, length_2, 0);
st1.push(s1);st1.push(s2);st1.push(s3);st1.push(s4);
}
else
{
//如果已经太小了,那就别tm分了,直接标记为2,加入等待绘画队列,化成蓝色
us[j].state = 2;
///ui->textBrowser_5->append("被标记为蓝");
waitDraw2[waitSize2++] = us[j];
}
}
}
}
//这里和上面一毛一样,我担心你看不懂,注释打到我手麻麻
while(!st1.empty())
{
Square squa = st1.top();//取栈顶
st1.pop();//弹出栈顶
length_2 = squa.length/(double)2;
real_2 = squa.realSize/(double)2;
//分割
leftTop1 = squa.longitude; leftTop2 = squa.latitude;
leftBotton1 = leftTop1; leftBotton2 = leftTop2 + squa.realSize;
rightTop1 = leftTop1 + squa.realSize; rightTop2 = leftTop2;
rightBotton1 = rightTop1; rightBotton2 = leftBotton2;
int num = 0;
for(int t = 0; t < 9; t++)
{
temp1 = culSquare(leftTop1 - satellite[t].x[i]) + culSquare(leftTop2 - satellite[t].y[i]);
temp2 = culSquare(leftBotton1 - satellite[t].x[i]) + culSquare(leftBotton2 - satellite[t].y[i]);
temp3 = culSquare(rightTop1 - satellite[t].x[i]) + culSquare(rightTop2 - satellite[t].y[i]);
temp4 = culSquare(rightBotton1 - satellite[t].x[i]) + culSquare(rightBotton2 - satellite[t].y[i]);
if(temp1 <= tmp&&temp2 <= tmp&&temp3 <= tmp&&temp4 <= tmp)
{
squa.state = 1;
cul += integral(leftTop1, leftTop2, rightBotton1, rightBotton2);
waitDraw2[waitSize2++] = squa;
break;
}
//全都在外边,不处理
if(temp1 > tmp&&temp2 > tmp&&temp3 > tmp&&temp4 > tmp)
{
num++;//不被覆盖数量+1
}
//如果已经到最后一个卫星,而且num还不到9,说明要待判断
if(num < 9&&t == 8)
{
//限制分割,这种情况还能分
if(squa.realSize > 0.3125)
{
Square s1(squa.x, squa.y, squa.longitude, squa.latitude, real_2, length_2, 0);
Square s2(squa.x + length_2, squa.y, squa.longitude + real_2, squa.latitude, real_2, length_2, 0);
Square s3(squa.x, squa.y - length_2, squa.longitude, squa.latitude + real_2, real_2, length_2, 0);
Square s4(squa.x + length_2, squa.y - length_2, squa.longitude + real_2, squa.latitude + real_2, real_2, length_2, 0);
st1.push(s1);st1.push(s2);st1.push(s3);st1.push(s4);
}
else//这种情况就是不可再分了,这个点就是待判断,标蓝加入等待绘画队列即可,没什么好说的
{
squa.state = 2;
//waitDraw.push_back(squa);//加入
waitDraw2[waitSize2++] = squa;
}
}
}
}
//每秒的计算基本结束,接下来就是在进入下一秒之前先更新的一下绘图和输出
ui->textBrowser_5->append(QString::number(cul/0.15656340035));
ui->textBrowser_6->clear();
ui->textBrowser_6->append(QString::number(acuCover/0.15656340035));
Coverage[i - start] = cul/0.15656340035;//记录
repaint();//每秒重新绘制,
delete []waitDraw2;
waitDraw2 = new Square[1000];
waitSize2 = 0;
//初始化,全部点都不在里面
for(int i = 0; i < 1540; i++)
{
us[i].state = 0;
}
}
//结束,需要把累计覆盖率输出,
acuCover = acuCover / 0.15656340035;
ui->textBrowser_6->append("累计覆盖率为:" + QString::number(acuCover));
QSplineSeries* seriesUs = new QSplineSeries(); // 创建一个样条曲线对象
seriesUs->setName("美国覆盖率曲线");
for(int i = start;i <= over; i++)
{
seriesUs->append(i, Coverage[i - start]);
}
QChart* chart = ui->graphicsView_4->chart(); // 获取一个chart用于管理不同类型的series和其他图表相关对象
chart->legend()->hide(); // 隐藏图例
chart->addSeries(seriesUs); // 添加创建好的曲线图对象
chart->setTitle("美国覆盖率曲线"); // 设置标题
chart->createDefaultAxes(); // 基于已添加到图表中的series为图表创建轴。以前添加到图表中的任何轴都将被删除。
chart->axes(Qt::Vertical).first()->setRange(0, 0.4); // 设置Y轴的范围
ui->graphicsView_4->setRenderHint(QPainter::Antialiasing); // 设置抗锯齿
QMessageBox::information(nullptr, "提示", "模拟结束", QMessageBox::Yes);
delete []Coverage;
Coverage = nullptr;
}
复制进去后,
下面放出mainwindow.ui的代码,复制进去,里面具体用到哪些我会讲,但可能讲不清楚
ui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1895</width>
<height>1060</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QStackedWidget" name="stackedWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>1861</width>
<height>971</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>50</x>
<y>30</y>
<width>401</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>请在右边输入城市名字,查看城市与卫星服务的相关信息</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>470</x>
<y>30</y>
<width>511</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser">
<property name="geometry">
<rect>
<x>30</x>
<y>90</y>
<width>1001</width>
<height>361</height>
</rect>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_2">
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>250</x>
<y>10</y>
<width>511</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>输入经度纬度查询,查询该点信息</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_2">
<property name="geometry">
<rect>
<x>250</x>
<y>70</y>
<width>201</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_3">
<property name="geometry">
<rect>
<x>510</x>
<y>70</y>
<width>251</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>250</x>
<y>50</y>
<width>72</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>longitude</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>510</x>
<y>50</y>
<width>72</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>latitude</string>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser_2">
<property name="geometry">
<rect>
<x>30</x>
<y>100</y>
<width>961</width>
<height>121</height>
</rect>
</property>
</widget>
<widget class="QChartView" name="graphicsView_2">
<property name="geometry">
<rect>
<x>30</x>
<y>250</y>
<width>1291</width>
<height>192</height>
</rect>
</property>
</widget>
<widget class="QChartView" name="graphicsView_3">
<property name="geometry">
<rect>
<x>30</x>
<y>490</y>
<width>1291</width>
<height>192</height>
</rect>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_3">
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>810</x>
<y>10</y>
<width>261</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>输入仿真时间,然后开始计算</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_4">
<property name="geometry">
<rect>
<x>820</x>
<y>80</y>
<width>113</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_5">
<property name="geometry">
<rect>
<x>950</x>
<y>80</y>
<width>113</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>820</x>
<y>50</y>
<width>72</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>startTime</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>950</x>
<y>50</y>
<width>72</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>overTime</string>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser_3">
<property name="geometry">
<rect>
<x>820</x>
<y>140</y>
<width>321</width>
<height>331</height>
</rect>
</property>
</widget>
<widget class="QChartView" name="graphicsView">
<property name="geometry">
<rect>
<x>20</x>
<y>640</y>
<width>1341</width>
<height>291</height>
</rect>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser_4">
<property name="geometry">
<rect>
<x>820</x>
<y>530</y>
<width>321</width>
<height>71</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>720</x>
<y>560</y>
<width>101</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>累计覆盖率:</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>720</x>
<y>150</y>
<width>91</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>瞬时覆盖率:</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_4">
<widget class="QPushButton" name="pushButton_4">
<property name="geometry">
<rect>
<x>1510</x>
<y>70</y>
<width>251</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>输入时间,开始运行</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>1520</x>
<y>130</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>startTime</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>1680</x>
<y>130</y>
<width>72</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>overTime</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_6">
<property name="geometry">
<rect>
<x>1520</x>
<y>180</y>
<width>113</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_7">
<property name="geometry">
<rect>
<x>1680</x>
<y>180</y>
<width>113</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser_5">
<property name="geometry">
<rect>
<x>1510</x>
<y>230</y>
<width>331</width>
<height>241</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>1410</x>
<y>240</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>瞬时覆盖率</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>1400</x>
<y>530</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>累计覆盖率</string>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser_6">
<property name="geometry">
<rect>
<x>1510</x>
<y>520</y>
<width>331</width>
<height>41</height>
</rect>
</property>
</widget>
<widget class="QChartView" name="graphicsView_4">
<property name="geometry">
<rect>
<x>10</x>
<y>631</y>
<width>1811</width>
<height>291</height>
</rect>
</property>
</widget>
</widget>
</widget>
<widget class="QPushButton" name="theOne">
<property name="geometry">
<rect>
<x>50</x>
<y>10</y>
<width>231</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>题1-1,城市窗口问题</string>
</property>
</widget>
<widget class="QPushButton" name="theTwo">
<property name="geometry">
<rect>
<x>300</x>
<y>10</y>
<width>231</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>题1-2,求区域各点信息</string>
</property>
</widget>
<widget class="QPushButton" name="theThree">
<property name="geometry">
<rect>
<x>550</x>
<y>10</y>
<width>221</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>题2-1.覆盖率</string>
</property>
</widget>
<widget class="QPushButton" name="theFour">
<property name="geometry">
<rect>
<x>790</x>
<y>10</y>
<width>201</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>题2-2.美国覆盖率</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1895</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"/>
<customwidgets>
<customwidget>
<class>QChartView</class>
<extends>QGraphicsView</extends>
<header>qchartview.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
以上