forked from rivetTDA/rivet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualizationwindow.h
170 lines (127 loc) · 6.77 KB
/
visualizationwindow.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/**********************************************************************
Copyright 2014-2016 The RIVET Developers. See the COPYRIGHT file at
the top-level directory of this distribution.
This file is part of RIVET.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
#ifndef VISUALIZATIONWINDOW_H
#define VISUALIZATIONWINDOW_H
//forward declarations
class Barcode;
class BarcodeTemplate;
class TemplatePoint;
#include "computationthread.h"
#include "dataselectdialog.h"
#include "dcel/arrangement_message.h"
#include "dcel/grades.h"
#include "interface/aboutmessagebox.h"
#include "interface/config_parameters.h"
#include "interface/configuredialog.h"
#include "interface/input_parameters.h"
#include "interface/persistence_diagram.h"
#include "interface/progressdialog.h"
#include "interface/slice_diagram.h"
#include <QMainWindow>
#include <QtWidgets>
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_rational exact;
#include "boost/multi_array.hpp"
typedef boost::multi_array<unsigned, 2> unsigned_matrix;
#include <vector>
namespace Ui {
class VisualizationWindow;
}
class VisualizationWindow : public QMainWindow {
Q_OBJECT
public:
explicit VisualizationWindow(InputParameters& params);
~VisualizationWindow();
protected:
void showEvent(QShowEvent* event); //shows the DataSelectDialog and blocks until it is closed
void resizeEvent(QResizeEvent*);
void closeEvent(QCloseEvent* event);
QString suggestedName(QString extension);
public slots:
void start_computation(); //begins the computation pipeline
void paint_template_points(std::shared_ptr<TemplatePointsMessage> points);
void augmented_arrangement_ready(std::shared_ptr<ArrangementMessage> arrangement);
void set_line_parameters(double angle, double offset);
void redraw();
void init();
private slots:
void on_angleDoubleSpinBox_valueChanged(double angle);
void on_offsetSpinBox_valueChanged(double arg1);
void on_xi0CheckBox_toggled(bool checked);
void on_xi1CheckBox_toggled(bool checked);
void on_xi2CheckBox_toggled(bool checked);
void on_normCoordCheckBox_clicked(bool checked);
void on_barcodeCheckBox_clicked(bool checked);
void on_BottomCornerXSpinBox_valueChanged(double x_bottom);
void on_BottomCornerYSpinBox_valueChanged(double y_bottom);
void on_TopCornerXSpinBox_valueChanged(double x_top);
void on_TopCornerYSpinBox_valueChanged(double y_top);
void on_actionExit_triggered();
void on_actionAbout_triggered();
void on_actionConfigure_triggered();
void on_actionSave_persistence_diagram_as_image_triggered();
void on_actionSave_line_selection_window_as_image_triggered();
void on_actionSave_triggered();
void on_actionOpen_triggered();
void on_actionRestore_default_window_triggered();
void on_actionBetti_number_window_triggered();
void on_actionAutomatically_reset_line_toggled();
private:
static const QString DEFAULT_SAVE_DIR_KEY;
Ui::VisualizationWindow* ui;
//data items
const int verbosity;
bool data_selected; //false until user selects data, then true
bool unsaved_data; //false until augmented arrangement is computed, then true until user saves the augmented arrangement
InputParameters& input_params; //parameters set by the user via the DataSelectDialog
ConfigParameters config_params; //parameters that control the visualization
DataSelectDialog ds_dialog; //dialog box that gets the input parameters
Grades grades;
double angle_precise; //sufficiently-precise internal value of the slice-line angle in DEGREES, necessary because QDoubleSpinBox truncates this value
double offset_precise; //sufficiently-precise internal value of the slice-line offset, necessary because QDoubleSpinBox truncates this value
double xmin_precise; //internal value of the coordinates of the current window
double xmax_precise;
double ymin_precise;
double ymax_precise;
bool x_reverse,y_reverse; //true when the grades are shown in decreasing order
double origin_x, origin_y;//the coordinates in data units of the origin on the line; i.e. the point where it intersects the box circumscribing the gradings
double dist_to_origin; //signed distance in data units from bottom left control dot in visible window to the origin; positive if the dot is up and to the right of the origin; negative otherwise
double slice_length;//length of the visible slice in DATA units
bool is_visible; //whether the line is visible in the current window
std::shared_ptr<TemplatePointsMessage> template_points; //The template points, homology dimensions, and other useful context
std::shared_ptr<ArrangementMessage> arrangement; //pointer to the DCEL arrangement
std::unique_ptr<Barcode> barcode; //pointer to the currently-displayed barcode
bool degenerate_x,degenerate_y; //these are true if there is exactly one x/y grade
//computation items
ComputationThread* cthread;
ProgressDialog* prog_dialog;
//items for slice diagram
bool line_selection_ready; //initially false, but set to true when data is in place for line selection
SliceDiagram slice_diagram; //subclass of QGraphicsScene, contains all of the graphics elements for the line-selection diagram
bool slice_update_lock; //true iff slice diagram is being updated; helps avoid an infinite loop
//items for persistence diagram
PersistenceDiagram p_diagram; //subclass of QGraphicsScene, contains all of the graphics elements for the persistence diagram
bool persistence_diagram_drawn;
bool slice_diagram_initialized;
void update_persistence_diagram(bool line_changed=true); //updates the persistence diagram and barcode after a change in the slice line and/or viewing window
void reset_line(); //change the line so it connects the extreme points of the current window
void update_origin();//computes the origin of the line after a change in parameters; updates the value of dist_to_origin
//other items
void save_arrangement(const QString& filename);
AboutMessageBox aboutBox; //which is better for these dialog boxes
ConfigureDialog* configBox; // -- pointer or no pointer?
};
#endif // VISUALIZATIONWINDOW_H