-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathresultdialog.cpp
134 lines (105 loc) · 3.69 KB
/
resultdialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#include "resultdialog.h"
#include "ui_resultdialog.h"
#include "DialogManager.h"
#include "Utils.h"
#include <QMessageBox>
ResultDialog::ResultDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ResultDialog)
{
ui->setupUi(this);
setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
}
ResultDialog::~ResultDialog()
{
delete ui;
}
void ResultDialog::on_BtnPre_clicked()
{
// DialogManager::GetInstance().HideResultDlg();
// DialogManager::GetInstance().ShowInputParamsDlg();
}
void ResultDialog::show(){
QDialog::show();
Shaft * mShaft = DialogManager::GetInstance().GetProject()->GetShaft();
std::vector<TopArcItem> mVecTop = mShaft->getVecTop();
double maxTopM = mVecTop[0].getM_wanju(), maxTopN = mVecTop[0].getN_zhouli(),
minTopM = maxTopM, minTopN = maxTopN;
for(TopArcItem it : mVecTop){
if(it.getM_wanju() > maxTopM){
maxTopM = it.getM_wanju();
}
if(it.getM_wanju() < minTopM){
minTopM = it.getM_wanju();
}
if(it.getN_zhouli() > maxTopN){
maxTopN = it.getN_zhouli();
}
if(it.getN_zhouli() < minTopN){
minTopN = it.getN_zhouli();
}
}
std::vector<BottomItem> mVecBottom = mShaft->getVecBottom();
double maxBottomM = mVecBottom[0].getM_Wanju(), maxBottomN = mVecBottom[0].getQ_Zhouli(),
minBottomM = maxBottomM, minBottomN = maxBottomN;
for(BottomItem it : mVecBottom){
if(it.getM_Wanju() > maxBottomM){
maxBottomM = it.getM_Wanju();
}
if(it.getM_Wanju() < minBottomM){
minBottomM = it.getM_Wanju();
}
if(it.getQ_Zhouli() > maxBottomN){
maxBottomN = it.getQ_Zhouli();
}
if(it.getQ_Zhouli() < maxBottomN){
minBottomN = it.getQ_Zhouli();
}
}
std::vector<WallItem> mVecWall = mShaft->getVecWall();
double maxWallM = mVecWall[0].getM_wanju(), maxWallN = mVecWall[0].getQ_zhouli(),
minWallM = maxWallM, minWallN = maxWallN;
for(WallItem it : mVecWall){
if(it.getM_wanju() > maxWallM){
maxWallM = it.getM_wanju();
}
if(it.getM_wanju() < minWallM){
minWallM = it.getM_wanju();
}
if(it.getQ_zhouli() > maxWallM){
maxWallN = it.getQ_zhouli();
}
if(it.getQ_zhouli() < minWallN){
minWallN = it.getQ_zhouli();
}
}
ui->mEdtTopMaxM->setText(QString::number(maxTopM));
ui->mEdtTopMinM->setText(QString::number(minTopM));
ui->mEdtTopMaxN->setText(QString::number(maxTopN));
ui->mEdtTopMinN->setText(QString::number(minTopN));
ui->mEdtWallMaxM->setText(QString::number(maxWallM));
ui->mEdtWallMinM->setText(QString::number(minWallM));
ui->mEdtWallMaxN->setText(QString::number(maxWallN));
ui->mEdtWallMinN->setText(QString::number(minWallN));
ui->mEdtBottomMaxM->setText(QString::number(maxBottomM));
ui->mEdtBottomMinM->setText(QString::number(minBottomM));
ui->mEdtBottomMaxN->setText(QString::number(maxBottomN));
ui->mEdtBottomMinN->setText(QString::number(minBottomN));
}
void ResultDialog::on_BtnDraw_clicked()
{
CString filename = CADService::GetAcad2017Path() + _T("ini\\shaft\\bridge.ini");
if(DialogManager::GetInstance().GetProject()->ProjectSaver(filename) == true) {
std::cout << "bridge file save successfully!\n";
}
else{
std::cout << "ERROR: Fail to bridge file!\n";
}
CADService::WriteAcadRx();
CADService::LaunchACad();
QMessageBox::information(NULL, "Message", "绘图成功,AutoCAD已自动启动!");
}
void ResultDialog::on_BtnCancel_clicked()
{
this->hide();
}