-
Notifications
You must be signed in to change notification settings - Fork 5
/
mainwindow.h
148 lines (146 loc) · 4.98 KB
/
mainwindow.h
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/******************************************************/
/* */
/* mainwindow.h - main window */
/* */
/******************************************************/
/* Copyright 2019-2021 Pierre Abbat.
* This file is part of PerfectTIN.
*
* PerfectTIN is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* PerfectTIN is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License and Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* and Lesser General Public License along with PerfectTIN. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "threads.h"
#include <QMainWindow>
#include <QTimer>
#include <QtWidgets>
#include <QPixmap>
#include <string>
#include <array>
#include <deque>
#include "configdialog.h"
#include "unitbutton.h"
#include "csaction.h"
#include "ciaction.h"
#include "cidialog.h"
#include "tincanvas.h"
#define BUSY_LOAD 1 /* loading a point cloud */
#define BUSY_OPEN 2 /* opening a PerfectTIN file */
#define BUSY_CVT 4 /* converting a point cloud to a TIN */
#define BUSY_SAVE 8 /* saving a PerfectTIN file */
#define BUSY_EXP 16 /* exporting a TIN */
#define BUSY_CTR 32 /* drawing, pruning, or smoothing contours */
#define BUSY_SPL 64 /* showing splash screen */
#define BUSY_OCT 128 /* making octagon */
#define BUSY_CLD 256 /* a point cloud is loaded */
#define BUSY_TIN 512 /* a TIN is present */
#define BUSY_UNFIN 1024 /* unfinished conversion */
#define BUSY_DO (BUSY_LOAD|BUSY_OPEN|BUSY_CVT|BUSY_SAVE|BUSY_EXP|BUSY_CTR)
class MainWindow: public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent=0);
~MainWindow();
void makeActions();
void makeStatusBar();
void readSettings();
void writeSettings();
int getNumberThreads()
{
return numberThreads;
}
bool conversionBusy();
bool bfl(int set,int clear);
signals:
void tinSizeChanged();
void lengthUnitChanged(double unit);
void colorSchemeChanged(int scheme);
void noCloudArea();
void verticalOutlier();
void gotResult(ThreadAction ta);
public slots:
void tick();
void refreshNumTriangles();
void setSettings(double lu,double tol,int thr,bool ee,bool oc,Printer3dSize pri);
void setUnit(double lu);
void openFile();
void loadFile();
void loadBoundary();
void disableMenuSplash();
void enableMenuSplash();
void endisableMenu();
void setBusy(int activity);
void setIdle(int activity);
void updateContourIntervalActions();
void exportDxfTxt();
void exportDxfBin();
void exportPlyTxt();
void exportPlyBin();
void exportStlTxt();
void exportStlBin();
void exportTinTxt();
void exportCarlsonTin();
void exportLandXml();
void startConversion();
void stopConversion();
void resumeConversion();
void saveFile();
void setColorScheme(int scheme);
void clearCloud();
void deleteContours();
void configure();
void msgNoCloudArea();
void msgVerticalOutlier();
void handleResult(ThreadAction ta);
void aboutProgram();
void aboutQt();
protected:
void closeEvent(QCloseEvent *event) override;
private:
int lastNumDots,lastNumTriangles,lastNumEdges,lastNumContours;
int traceHiLo; // -1, 0, or 1
int busy;
double lastTolerance,lastStageTolerance,writtenTolerance,lastDensity,rmsadj;
int numberThreads;
int lastState; // state is in TinCanvas
bool conversionStopped,showingResult,exportEmpty;
bool onlyContours,onlyInBoundary,lastLargeVertical;
double tolerance,density,lengthUnit;
double lpfBusyFraction;
std::string fileNames,saveFileName,lastFileName;
std::deque<ContourIntervalAction> ciActions;
QTimer *timer;
QFileDialog *fileDialog;
QMessageBox *msgBox;
QToolBar *toolbar;
ConfigurationDialog *configDialog;
QMenu *fileMenu,*viewMenu,*contourMenu,*settingsMenu,*helpMenu,*exportMenu,*colorMenu;
QLabel *fileMsg,*dotTriangleMsg,*toleranceMsg,*densityMsg;
QProgressBar *doneBar,*busyBar;
QAction *openAction,*loadAction,*loadBoundaryAction,*convertAction;
QAction *saveFileAction,*clearAction;
QAction *exportAction,*stopAction,*resumeAction,*exitAction;
QAction *exportDxfTxtAction,*exportDxfBinAction,*exportTinTxtAction;
QAction *exportCarlsonTinAction,*exportLandXmlAction;
QAction *exportPlyTxtAction,*exportPlyBinAction;
QAction *exportStlTxtAction,*exportStlBinAction;
ColorSchemeAction *colorGradientAction,*colorElevationAction;
QAction *selectContourIntervalAction,*roughContoursAction;
QAction *pruneContoursAction,*smoothContoursAction,*deleteContoursAction;
QAction *configureAction;
QAction *aboutProgramAction,*aboutQtAction;
UnitButton *unitButtons[4];
TinCanvas *canvas;
};