diff --git a/dataselectdialog.cpp b/dataselectdialog.cpp index d44ffd52..425dc9a2 100644 --- a/dataselectdialog.cpp +++ b/dataselectdialog.cpp @@ -66,8 +66,10 @@ void DataSelectDialog::closeEvent(QCloseEvent* event) { event->accept(); - if (!data_selected) + if (!data_selected) { qobject_cast(this->parent())->close(); + exit(0); + } } void DataSelectDialog::on_computeButton_clicked() diff --git a/interface/c_api.cpp b/interface/c_api.cpp index 73660b67..b2434b87 100644 --- a/interface/c_api.cpp +++ b/interface/c_api.cpp @@ -34,7 +34,7 @@ extern "C" RivetComputationResult read_rivet_computation(const char* bytes, size extern "C" void free_rivet_computation_result(RivetComputationResult result) { if (result.computation != nullptr) { - delete reinterpret_cast(result.computation); + delete reinterpret_cast(result.computation); } else { delete[] result.error; } @@ -67,7 +67,7 @@ extern "C" BarCodesResult barcodes_from_computation(RivetComputation* rivet_comp barcodes[i].angle = angles[i]; barcodes[i].offset = offsets[i]; } -// Bounds bounds = compute_bounds(*computation); + // Bounds bounds = compute_bounds(*computation); result.barcodes = barcodes; result.length = query_results.size(); result.error = nullptr; @@ -108,8 +108,7 @@ extern "C" void free_barcodes_result(BarCodesResult result) } } - -extern "C" StructurePoints * structure_from_computation(RivetComputation* rivet_computation) +extern "C" StructurePoints* structure_from_computation(RivetComputation* rivet_computation) { ComputationResult* computation = reinterpret_cast(rivet_computation); auto x_exact = new Ratio[computation->arrangement->x_exact.size()]; @@ -146,7 +145,8 @@ extern "C" StructurePoints * structure_from_computation(RivetComputation* rivet_ return result; } -void free_structure_points(StructurePoints *points) { +void free_structure_points(StructurePoints* points) +{ delete[] points->grades->x_grades; delete[] points->grades->y_grades; delete points->grades; diff --git a/interface/c_api.h b/interface/c_api.h index d88f1baf..f015e5e6 100644 --- a/interface/c_api.h +++ b/interface/c_api.h @@ -40,7 +40,7 @@ typedef struct { typedef struct { BarCode* barcodes; size_t length; - char * error; + char* error; size_t error_length; } BarCodesResult; @@ -80,9 +80,9 @@ typedef struct { } Ratio; typedef struct { - Ratio *x_grades; + Ratio* x_grades; size_t x_length; - Ratio *y_grades; + Ratio* y_grades; size_t y_length; } ExactGrades; @@ -95,15 +95,14 @@ typedef struct { } StructurePoint; typedef struct { - ExactGrades *grades; - StructurePoint *points; + ExactGrades* grades; + StructurePoint* points; size_t length; } StructurePoints; -StructurePoints * structure_from_computation(RivetComputation* rivet_computation); - -void free_structure_points(StructurePoints *points); +StructurePoints* structure_from_computation(RivetComputation* rivet_computation); +void free_structure_points(StructurePoints* points); } #endif //RIVET_CONSOLE_C_API_H diff --git a/interface/configuredialog.cpp b/interface/configuredialog.cpp index c7b11208..927807b7 100644 --- a/interface/configuredialog.cpp +++ b/interface/configuredialog.cpp @@ -119,6 +119,12 @@ ConfigureDialog::~ConfigureDialog() delete ui; } +void ConfigureDialog::closeEvent(QCloseEvent* event) +{ + emit window_closed(); // tells visualization window to check for changes and redraw + QDialog::closeEvent(event); +} + void ConfigureDialog::on_cancelButton_clicked() { close(); diff --git a/interface/configuredialog.h b/interface/configuredialog.h index 93c1ae03..41680779 100644 --- a/interface/configuredialog.h +++ b/interface/configuredialog.h @@ -41,6 +41,10 @@ class ConfigureDialog : public QDialog { public: explicit ConfigureDialog(ConfigParameters& c_params, InputParameters& i_params, QWidget* parent = 0); ~ConfigureDialog(); + void closeEvent(QCloseEvent* event); + +signals: + void window_closed(); private slots: void on_cancelButton_clicked(); diff --git a/interface/control_dot.cpp b/interface/control_dot.cpp index 16a88d36..10a8f0e6 100644 --- a/interface/control_dot.cpp +++ b/interface/control_dot.cpp @@ -56,11 +56,9 @@ void ControlDot::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*unus QRectF rect = boundingRect(); QBrush brush(config_params->sliceLineColor); - if(!slice_line->is_inside_view()) - { + if (!slice_line->is_inside_view()) { brush.setColor(Qt::gray); - } - else if (pressed) { + } else if (pressed) { brush.setColor(config_params->sliceLineHighlightColor); } @@ -74,8 +72,7 @@ QVariant ControlDot::itemChange(GraphicsItemChange change, const QVariant& value { if (change == QGraphicsItem::ItemPositionChange && !update_lock) { - - if(!slice_line->is_inside_view()){ + if (!slice_line->is_inside_view()) { //then don't allow the user to drag the dot return pos(); } @@ -165,7 +162,7 @@ void ControlDot::set_position(const QPointF& newpos) void ControlDot::mousePressEvent(QGraphicsSceneMouseEvent* event) { - if(!slice_line->is_inside_view()){ + if (!slice_line->is_inside_view()) { return; } pressed = true; @@ -177,7 +174,7 @@ void ControlDot::mousePressEvent(QGraphicsSceneMouseEvent* event) void ControlDot::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) { - if(!slice_line->is_inside_view()){ + if (!slice_line->is_inside_view()) { return; } pressed = false; diff --git a/interface/persistence_diagram.cpp b/interface/persistence_diagram.cpp index c2a7979a..d80d9e94 100644 --- a/interface/persistence_diagram.cpp +++ b/interface/persistence_diagram.cpp @@ -48,6 +48,16 @@ PersistenceDiagram::PersistenceDiagram(ConfigParameters* params, QObject* parent setItemIndexMethod(NoIndex); //not sure why, but this seems to fix the dot update issue (#7 in the issue tracker) } +// resets data structures and variables to draw new diagram +void PersistenceDiagram::reset() +{ + clear(); + all_dots.clear(); + dots_by_bc_index.clear(); + selected = NULL; + barcode = new Barcode(); +} + //simply creates all objects; resize_diagram() handles positioning of objects void PersistenceDiagram::create_diagram() { @@ -541,7 +551,7 @@ void PersistenceDiagram::update_diagram(double slice_length_pix, double diagram_ if (is_visible) { line_size = slice_length_pix / sqrt(2); //divide by sqrt(2) because the line is drawn at a 45-degree angle } else { - line_size=0; + line_size = 0; } dist_to_origin = slice_dist_dat; scale = diagram_scale / sqrt(2); //similarly to line_size, divide by sqrt(2) diff --git a/interface/persistence_diagram.h b/interface/persistence_diagram.h index ac9da15f..e777f900 100644 --- a/interface/persistence_diagram.h +++ b/interface/persistence_diagram.h @@ -52,6 +52,7 @@ class PersistenceDiagram : public QGraphicsScene { void deselect_dot(); //remove selection and propagate to the slice diagram void receive_parameter_change(); //updates the diagram after a change in the configuration parameters + void reset(); // clears up data structures and variable values public slots: void receive_dot_selection(unsigned index); //highlight the specified dot, which has been selected externally diff --git a/interface/progressdialog.cpp b/interface/progressdialog.cpp index 5e60e7f3..03dd0356 100644 --- a/interface/progressdialog.cpp +++ b/interface/progressdialog.cpp @@ -85,8 +85,7 @@ void ProgressDialog::updateProgress(unsigned current) void ProgressDialog::setComputationFinished() { computation_finished = true; - QThread::msleep(200); //seems to prevent ProgressDialog from sticking around after it is supposed to have been closed - done(0); + close(); } void ProgressDialog::closeEvent(QCloseEvent* event) diff --git a/interface/slice_diagram.cpp b/interface/slice_diagram.cpp index 8f6b1163..17fb193b 100644 --- a/interface/slice_diagram.cpp +++ b/interface/slice_diagram.cpp @@ -58,6 +58,27 @@ SliceDiagram::~SliceDiagram() clear(); //removes and deletes all items from the QGraphicsScene } +// resets data structures and variables to draw new diagram +void SliceDiagram::reset() +{ + clear(); + xi0_dots.clear(); + xi1_dots.clear(); + xi2_dots.clear(); + bars.clear(); + primary_selected.clear(); + secondary_selected.clear(); + points.clear(); + hom_dim_rects.resize(boost::extents[0][0]); + dot_left = nullptr; + dot_right = nullptr; + slice_line = nullptr; + max_xi_value = 0; + line_visible = true; + created = false; + control_dot_moved = false; +} + //receives an xi support point, which will be drawn when create_diagram() is called void SliceDiagram::add_point(double x_coord, double y_coord, int xi0m, int xi1m, int xi2m) { @@ -536,7 +557,7 @@ void SliceDiagram::zoom_diagram(double angle, double offset, double distance_to_ if (line_vert) { double relative_intercept_horz = (-offset - data_xmin) / (data_xmax - data_xmin); //vertical line has negative offset x = relative_intercept_horz * diagram_width; - line_visible = (0 <= relative_intercept_horz && relative_intercept_horz <= 1+float(padding)/diagram_width); + line_visible = (0 <= relative_intercept_horz && relative_intercept_horz <= 1 + float(padding) / diagram_width); slice_line->update_position(x, y, line_vert, 0); slice_line->set_visibility(line_visible); //don't plot the line if it lies outisde of the viewing window line_pos = -1 * relative_intercept_horz; @@ -550,12 +571,12 @@ void SliceDiagram::zoom_diagram(double angle, double offset, double distance_to_ double relative_intercept_horz = -data_xmin + (data_ymin - intrinsic_y_int) / (intrinsic_slope); relative_intercept_horz /= data_xmax - data_xmin; x = relative_intercept_horz * diagram_width; - line_visible = relative_intercept_horz < 1+float(padding)/diagram_width; + line_visible = relative_intercept_horz < 1 + float(padding) / diagram_width; line_pos = -1 * relative_intercept_horz; } else //then left-bottom endpoint is along left edge of box { y = relative_intercept_vert * diagram_height; - line_visible = relative_intercept_vert < 1+float(padding)/diagram_height; + line_visible = relative_intercept_vert < 1 + float(padding) / diagram_height; line_pos = relative_intercept_vert; } @@ -689,7 +710,7 @@ void SliceDiagram::update_line(double angle, double offset, double distance_to_o line_vert = true; line_pos = offset / (data_xmax - data_xmin); //relative units - line_visible = (-1 <= line_pos && line_pos <= float(padding)/diagram_width); //vertical line has negative offset + line_visible = (-1 <= line_pos && line_pos <= float(padding) / diagram_width); //vertical line has negative offset //update the SliceLine @@ -703,7 +724,7 @@ void SliceDiagram::update_line(double angle, double offset, double distance_to_o line_vert = false; line_slope = 0; line_pos = offset / (data_ymax - data_ymin); //relative units - line_visible = (0 <= line_pos && line_pos <= 1+float(padding)/diagram_height); + line_visible = (0 <= line_pos && line_pos <= 1 + float(padding) / diagram_height); //update the SliceLine int ypos = (offset - data_ymin) * scale_y; //pixel units @@ -721,14 +742,14 @@ void SliceDiagram::update_line(double angle, double offset, double distance_to_o if (y_coord >= data_ymin) //then slice line intersects left edge of box { line_pos = (y_coord - data_ymin) / (data_ymax - data_ymin); //relative units - line_visible = line_pos < 1+float(padding)/diagram_height; + line_visible = line_pos < 1 + float(padding) / diagram_height; slice_line->update_position(0, (y_coord - data_ymin) * scale_y, false, line_slope * scale_y / scale_x); } else //then slice line intersects bottom of box { double x_coord = (data_ymin - offset / cos(radians)) / line_slope; //x-coordinate of slice line at y=data_ymin; data units line_pos = -1 * (x_coord - data_xmin) / (data_xmax - data_xmin); //relative units - line_visible = -1 -float(padding)/diagram_width< line_pos; + line_visible = -1 - float(padding) / diagram_width < line_pos; slice_line->update_position((x_coord - data_xmin) * scale_x, 0, false, line_slope * scale_y / scale_x); } @@ -903,7 +924,7 @@ std::pair SliceDiagram::compute_endpoint(double coordinate, unsi if (coordinate == std::numeric_limits::infinity() || coordinate * std::min(scale_x, scale_y) > pow(10.0, 7.0)) { //set coordinate so that it will be outside the viewable window //the finite cutoff seems to patch over the issue with phantom barcodes-not sure why - coordinate = dist_to_origin+view_length / std::min(scale_x, scale_y); + coordinate = dist_to_origin + view_length / std::min(scale_x, scale_y); } //find (x,y) along the line diff --git a/interface/slice_diagram.h b/interface/slice_diagram.h index dd03fc1a..1a84440c 100644 --- a/interface/slice_diagram.h +++ b/interface/slice_diagram.h @@ -105,6 +105,8 @@ class SliceDiagram : public QGraphicsScene { int get_diagram_width() { return diagram_width; }; //the width of the above region corresponding to the displayed window bounds int get_diagram_height() { return diagram_height; }; + void reset(); // clears up data structures and variable values + public slots: void receive_bar_selection(std::vector indexes); //highlight the specified class of bars, which has been selected externally void receive_bar_secondary_selection(std::vector indexes); //secondary highlight, used for persistence dots that represent multiple classes of bars diff --git a/interface/slice_line.cpp b/interface/slice_line.cpp index ba47399c..b455ff96 100644 --- a/interface/slice_line.cpp +++ b/interface/slice_line.cpp @@ -67,10 +67,9 @@ void SliceLine::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*unuse QPen pen(config_params->sliceLineColor); pen.setWidth(config_params->sliceLineWidth); - if(!inside_view){ + if (!inside_view) { pen.setColor(Qt::gray); - } - else if (pressed) { + } else if (pressed) { pen.setColor(config_params->sliceLineHighlightColor); } @@ -101,8 +100,7 @@ void SliceLine::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*unuse //left-click and drag to move line, maintaining the same slope QVariant SliceLine::itemChange(GraphicsItemChange change, const QVariant& value) { - if(!inside_view) - {//then don't allow the line to be moved + if (!inside_view) { //then don't allow the line to be moved return QGraphicsItem::itemChange(change, value); } if (change == QGraphicsItem::ItemPositionChange && !update_lock) { @@ -308,7 +306,7 @@ void SliceLine::update_position(double xpos, double ypos, bool vert, double pixe void SliceLine::mousePressEvent(QGraphicsSceneMouseEvent* event) { - if(!inside_view){ + if (!inside_view) { return; } if (event->button() == Qt::RightButton) { @@ -325,7 +323,7 @@ void SliceLine::mousePressEvent(QGraphicsSceneMouseEvent* event) void SliceLine::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) { - if(!inside_view){ + if (!inside_view) { return; } if (event->button() == Qt::RightButton) { @@ -343,7 +341,7 @@ void SliceLine::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) //right-click and drag to change slope, left/bottom endpoint stays fixed void SliceLine::mouseMoveEvent(QGraphicsSceneMouseEvent* event) { - if(!inside_view){ + if (!inside_view) { return; } if (rotating) { @@ -419,7 +417,5 @@ bool SliceLine::is_inside_view() void SliceLine::set_visibility(bool visible) { - inside_view=visible; - - + inside_view = visible; } diff --git a/interface/slice_line.h b/interface/slice_line.h index 1c6637d6..fef5e9d7 100644 --- a/interface/slice_line.h +++ b/interface/slice_line.h @@ -63,6 +63,7 @@ class SliceLine : public QGraphicsItem { void set_visibility(bool visible); bool is_inside_view(); + protected: void mousePressEvent(QGraphicsSceneMouseEvent* event); void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); @@ -87,7 +88,7 @@ class SliceLine : public QGraphicsItem { SliceDiagram* sdgm; ConfigParameters* config_params; - bool inside_view=true; + bool inside_view = true; void compute_right_point(); //sets correct position of right_point, given slope of line and position of left point }; diff --git a/math/presentation.cpp b/math/presentation.cpp index bbb54184..cf05c9e6 100644 --- a/math/presentation.cpp +++ b/math/presentation.cpp @@ -371,9 +371,9 @@ void Presentation::minimize(int verbosity) //mark pivot_i for removal from row indices new_row_indices[pivot_i] = -1; - //zero out the part of the row pivot_i to the right of i. - //The part of the row to the left is already zero. - #pragma omp parallel for +//zero out the part of the row pivot_i to the right of i. +//The part of the row to the left is already zero. +#pragma omp parallel for for (unsigned j = i + 1; j < mat.width(); j++) { if (mat.entry_sorted(pivot_i, j)) { diff --git a/visualizationwindow.cpp b/visualizationwindow.cpp index 6e71eae0..2b85bb98 100644 --- a/visualizationwindow.cpp +++ b/visualizationwindow.cpp @@ -59,8 +59,6 @@ VisualizationWindow::VisualizationWindow(InputParameters& params) , template_points() , degenerate_x(false) , degenerate_y(false) - , cthread(input_params) - , prog_dialog(this) , line_selection_ready(false) , slice_diagram(&config_params, grades.x, grades.y, this) , slice_update_lock(false) @@ -68,6 +66,9 @@ VisualizationWindow::VisualizationWindow(InputParameters& params) , persistence_diagram_drawn(false) , slice_diagram_initialized(false) { + // create computation thread + cthread = new ComputationThread(input_params); + ui->setupUi(this); //set up the slice diagram @@ -85,16 +86,12 @@ VisualizationWindow::VisualizationWindow(InputParameters& params) //connect signal from DataSelectDialog to start the computation - QObject::connect(&ds_dialog, &DataSelectDialog::dataSelected, this, &VisualizationWindow::start_computation); + QObject::connect(&ds_dialog, &DataSelectDialog::dataSelected, this, &VisualizationWindow::init); //connect signals from ComputationThread to slots in VisualizationWindow - QObject::connect(&cthread, &ComputationThread::advanceProgressStage, &prog_dialog, &ProgressDialog::advanceToNextStage); - QObject::connect(&cthread, &ComputationThread::setProgressMaximum, &prog_dialog, &ProgressDialog::setStageMaximum); - QObject::connect(&cthread, &ComputationThread::setCurrentProgress, &prog_dialog, &ProgressDialog::updateProgress); - QObject::connect(&cthread, &ComputationThread::templatePointsReady, this, &VisualizationWindow::paint_template_points); - QObject::connect(&cthread, &ComputationThread::arrangementReady, this, &VisualizationWindow::augmented_arrangement_ready); - QObject::connect(&cthread, &ComputationThread::finished, &prog_dialog, &ProgressDialog::setComputationFinished); - + QObject::connect(cthread, &ComputationThread::templatePointsReady, this, &VisualizationWindow::paint_template_points); + QObject::connect(cthread, &ComputationThread::arrangementReady, this, &VisualizationWindow::augmented_arrangement_ready); + //connect signals and slots for the diagrams QObject::connect(&slice_diagram, &SliceDiagram::set_line_control_elements, this, &VisualizationWindow::set_line_parameters); QObject::connect(&slice_diagram, &SliceDiagram::persistence_bar_selected, &p_diagram, &PersistenceDiagram::receive_dot_selection); @@ -104,9 +101,6 @@ VisualizationWindow::VisualizationWindow(InputParameters& params) QObject::connect(&p_diagram, &PersistenceDiagram::persistence_dot_secondary_selection, &slice_diagram, &SliceDiagram::receive_bar_secondary_selection); QObject::connect(&p_diagram, &PersistenceDiagram::persistence_dot_deselected, &slice_diagram, &SliceDiagram::receive_bar_deselection); - - //connect other signals and slots - QObject::connect(&prog_dialog, &ProgressDialog::stopComputation, &cthread, &ComputationThread::terminate); ///TODO: don't use QThread::terminate()! modify ComputationThread so that it can stop gracefully and clean up after itself } VisualizationWindow::~VisualizationWindow() @@ -114,7 +108,79 @@ VisualizationWindow::~VisualizationWindow() delete ui; } +void VisualizationWindow::redraw() +{ + // redraw slice diagram and persistence diagram + // if config parameters are changed + if (line_selection_ready) { + slice_diagram.receive_parameter_change(); + + if (persistence_diagram_drawn) + p_diagram.receive_parameter_change(); + } + + // disconnect and delete configure dialog + QObject::disconnect(configBox, &ConfigureDialog::window_closed, this, &VisualizationWindow::redraw); + delete configBox; +} + +// slot that resets data structures, variables and ui +void VisualizationWindow::init() +{ + // disable visualization window parameters + // when computation is going on + ui->BettiLabel->setEnabled(false); + ui->xi0CheckBox->setEnabled(false); + ui->xi1CheckBox->setEnabled(false); + ui->xi2CheckBox->setEnabled(false); + ui->normCoordCheckBox->setEnabled(false); + + ui->angleLabel->setEnabled(false); + ui->angleDoubleSpinBox->setEnabled(false); + ui->offsetLabel->setEnabled(false); + ui->offsetSpinBox->setEnabled(false); + ui->barcodeCheckBox->setEnabled(false); + + // reset data structures associated with visualization window + if (template_points) + template_points = NULL; + + if (arrangement) + arrangement = NULL; + + if (barcode) + barcode.release(); + + template_points = std::shared_ptr(); + arrangement = std::shared_ptr(); + barcode = std::unique_ptr(); + grades = Grades(); + slice_diagram.reset(); + p_diagram.reset(); + + // reset variables associated with visualization window + // Possible TODO: Remove intializers from constructor? + x_reverse = false; + y_reverse = false; + degenerate_x = false; + degenerate_y = false; + line_selection_ready = false; + persistence_diagram_drawn = false; + slice_diagram_initialized = false; + + // create new progress dialog for computation + prog_dialog = new ProgressDialog(this); + + //connect signals related to prog_dialog + QObject::connect(cthread, &ComputationThread::advanceProgressStage, prog_dialog, &ProgressDialog::advanceToNextStage); + QObject::connect(cthread, &ComputationThread::setProgressMaximum, prog_dialog, &ProgressDialog::setStageMaximum); + QObject::connect(cthread, &ComputationThread::setCurrentProgress, prog_dialog, &ProgressDialog::updateProgress); + + // to stop computation midway - TODO: make it stop more gracefully + QObject::connect(prog_dialog, &ProgressDialog::stopComputation, cthread, &ComputationThread::terminate); + start_computation(); +} //slot that starts the persistent homology computation in a new thread void VisualizationWindow::start_computation() @@ -122,12 +188,12 @@ void VisualizationWindow::start_computation() data_selected = true; //show the progress box - prog_dialog.show(); - prog_dialog.activateWindow(); - prog_dialog.raise(); + prog_dialog->show(); + prog_dialog->activateWindow(); + prog_dialog->raise(); //start the computation in a new thread - cthread.compute(); + cthread->compute(); //update text items auto shortName = QString::fromStdString(input_params.shortName); @@ -143,7 +209,6 @@ void VisualizationWindow::paint_template_points(std::shared_ptrx_reverse; y_reverse=points->y_reverse; @@ -205,7 +270,6 @@ void VisualizationWindow::paint_template_points(std::shared_ptroffsetSpinBox->setMinimum(grades.min_offset()); @@ -302,6 +362,7 @@ void VisualizationWindow::paint_template_points(std::shared_ptrstatusBar->showMessage("bigraded Betti number visualization ready"); STATUS BAR CURRENTLY DISABLED } @@ -377,6 +438,11 @@ void VisualizationWindow::augmented_arrangement_ready(std::shared_ptrsetComputationFinished(); + delete prog_dialog; + } } //end augmented_arrangement_ready() @@ -750,17 +816,12 @@ void VisualizationWindow::on_actionAbout_triggered() void VisualizationWindow::on_actionConfigure_triggered() { + // create new configure dialog configBox = new ConfigureDialog(config_params, input_params, this); - configBox->exec(); + configBox->show(); - if (line_selection_ready) { - slice_diagram.receive_parameter_change(); - - if (persistence_diagram_drawn) - p_diagram.receive_parameter_change(); - } - - delete configBox; + // connect to receive config parameter change + QObject::connect(configBox, &ConfigureDialog::window_closed, this, &VisualizationWindow::redraw); } void VisualizationWindow::on_actionSave_persistence_diagram_as_image_triggered() @@ -819,13 +880,10 @@ void VisualizationWindow::save_arrangement(const QString& filename) void VisualizationWindow::on_actionOpen_triggered() { - ///TODO: get user confirmation and clear the existing data structures - - QMessageBox msgBox; - msgBox.setText("This feature is not implemented yet."); - msgBox.exec(); + ///TODO: get user confirmation + // open dataselect dialog to get new data + ds_dialog.exec(); - ///TODO: open the data select dialog box and load new data } //end on_actionOpen_triggered() diff --git a/visualizationwindow.h b/visualizationwindow.h index 03365c9a..c69c4ddb 100644 --- a/visualizationwindow.h +++ b/visualizationwindow.h @@ -69,6 +69,9 @@ public slots: void augmented_arrangement_ready(std::shared_ptr 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); @@ -141,8 +144,8 @@ private slots: bool degenerate_x,degenerate_y; //these are true if there is exactly one x/y grade //computation items - ComputationThread cthread; - ProgressDialog prog_dialog; + 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