OGS
MeshQualitySelectionDialog Class Reference

Detailed Description

A dialog for selecting a mesh quality metric.

Definition at line 16 of file MeshQualitySelectionDialog.h.

#include <MeshQualitySelectionDialog.h>

Inheritance diagram for MeshQualitySelectionDialog:
[legend]
Collaboration diagram for MeshQualitySelectionDialog:
[legend]

Public Member Functions

 MeshQualitySelectionDialog (QDialog *parent=nullptr)
 Constructor.
 ~MeshQualitySelectionDialog () override
MeshLib::MeshQualityType getSelectedMetric () const
 Returns selected metric.
bool getHistogram () const
 Returns true if a histogram needs to be calculated.
std::string getHistogramPath () const
 Returns selected path for histogram (or empty string if no histogram is required)

Private Slots

void on_histogramCheckBox_toggled (bool is_checked) const
void on_histogramPathButton_pressed ()
void accept () override
 Instructions if the OK-Button has been pressed.
void reject () override
 Instructions if the Cancel-Button has been pressed.

Private Attributes

MeshLib::MeshQualityType _metric {MeshLib::MeshQualityType::EDGERATIO}
std::string _histogram_path

Constructor & Destructor Documentation

◆ MeshQualitySelectionDialog()

MeshQualitySelectionDialog::MeshQualitySelectionDialog ( QDialog * parent = nullptr)
explicit

Constructor.

Definition at line 13 of file MeshQualitySelectionDialog.cpp.

14 : QDialog(parent), _histogram_path("")
15{
16 setupUi(this);
17 this->choiceEdges->toggle();
18}

References _histogram_path.

◆ ~MeshQualitySelectionDialog()

MeshQualitySelectionDialog::~MeshQualitySelectionDialog ( )
overridedefault

Member Function Documentation

◆ accept

void MeshQualitySelectionDialog::accept ( )
overrideprivateslot

Instructions if the OK-Button has been pressed.

Definition at line 40 of file MeshQualitySelectionDialog.cpp.

41{
42 if (this->choiceEdges->isChecked())
43 {
45 }
46 else if (this->choiceArea->isChecked())
47 {
49 }
50 else if (this->choiceVolume->isChecked())
51 {
53 }
54 else if (this->choiceAngles->isChecked())
55 {
57 }
58 else if (this->choiceRadius->isChecked())
59 {
61 }
62 else
63 {
65 }
66
67 if (this->histogramCheckBox->isChecked())
68 {
69 _histogram_path = this->histogramPathEdit->text().toStdString();
70 if (_histogram_path.empty())
71 {
72 OGSError::box("No path for histogram file specified.");
73 return;
74 }
75 }
76
77 this->done(QDialog::Accepted);
78}
static void box(const QString &e)
Definition OGSError.cpp:13

References _histogram_path, _metric, OGSError::box(), MeshLib::EDGERATIO, MeshLib::ELEMENTSIZE, MeshLib::EQUIANGLESKEW, MeshLib::INVALID, MeshLib::RADIUSEDGERATIO, and MeshLib::SIZEDIFFERENCE.

◆ getHistogram()

bool MeshQualitySelectionDialog::getHistogram ( ) const
inline

Returns true if a histogram needs to be calculated.

Definition at line 28 of file MeshQualitySelectionDialog.h.

28{ return this->histogramCheckBox->isChecked(); }

Referenced by MainWindow::showMeshQualitySelectionDialog().

◆ getHistogramPath()

std::string MeshQualitySelectionDialog::getHistogramPath ( ) const
inline

Returns selected path for histogram (or empty string if no histogram is required)

Definition at line 31 of file MeshQualitySelectionDialog.h.

31{ return _histogram_path; }

References _histogram_path.

Referenced by MainWindow::showMeshQualitySelectionDialog().

◆ getSelectedMetric()

MeshLib::MeshQualityType MeshQualitySelectionDialog::getSelectedMetric ( ) const
inline

Returns selected metric.

Definition at line 25 of file MeshQualitySelectionDialog.h.

25{ return _metric; }

References _metric.

Referenced by MainWindow::showMeshQualitySelectionDialog().

◆ on_histogramCheckBox_toggled

void MeshQualitySelectionDialog::on_histogramCheckBox_toggled ( bool is_checked) const
privateslot

Definition at line 22 of file MeshQualitySelectionDialog.cpp.

24{
25 histogramPathEdit->setEnabled(is_checked);
26 histogramPathButton->setEnabled(is_checked);
27}

◆ on_histogramPathButton_pressed

void MeshQualitySelectionDialog::on_histogramPathButton_pressed ( )
privateslot

Definition at line 29 of file MeshQualitySelectionDialog.cpp.

30{
31 QSettings settings;
32 QFileInfo fi(settings.value("lastOpenedFileDirectory").toString());
33 QString file_name =
34 QFileDialog::getSaveFileName(this, "Save histogram as", fi.baseName(),
35 "Text files (*.txt);;All files (* *.*)");
36 this->histogramPathEdit->setText(file_name);
37}

◆ reject

void MeshQualitySelectionDialog::reject ( )
overrideprivateslot

Instructions if the Cancel-Button has been pressed.

Definition at line 81 of file MeshQualitySelectionDialog.cpp.

82{
83 this->done(QDialog::Rejected);
84}

Member Data Documentation

◆ _histogram_path

std::string MeshQualitySelectionDialog::_histogram_path
private

◆ _metric

MeshLib::MeshQualityType MeshQualitySelectionDialog::_metric {MeshLib::MeshQualityType::EDGERATIO}
private

The documentation for this class was generated from the following files: