OGS
MeshQualitySelectionDialog Class Reference

Detailed Description

A dialog for selecting a mesh quality metric.

Definition at line 27 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 24 of file MeshQualitySelectionDialog.cpp.

25 : QDialog(parent), _histogram_path("")
26{
27 setupUi(this);
28 this->choiceEdges->toggle();
29}

◆ ~MeshQualitySelectionDialog()

MeshQualitySelectionDialog::~MeshQualitySelectionDialog ( )
overridedefault

Member Function Documentation

◆ accept

void MeshQualitySelectionDialog::accept ( )
overrideprivateslot

Instructions if the OK-Button has been pressed.

Definition at line 51 of file MeshQualitySelectionDialog.cpp.

52{
53 if (this->choiceEdges->isChecked())
54 {
56 }
57 else if (this->choiceArea->isChecked())
58 {
60 }
61 else if (this->choiceVolume->isChecked())
62 {
64 }
65 else if (this->choiceAngles->isChecked())
66 {
68 }
69 else if (this->choiceRadius->isChecked())
70 {
72 }
73 else
74 {
76 }
77
78 if (this->histogramCheckBox->isChecked())
79 {
80 _histogram_path = this->histogramPathEdit->text().toStdString();
81 if (_histogram_path.empty())
82 {
83 OGSError::box("No path for histogram file specified.");
84 return;
85 }
86 }
87
88 this->done(QDialog::Accepted);
89}
static void box(const QString &e)
Definition OGSError.cpp:23

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 39 of file MeshQualitySelectionDialog.h.

39{ 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 42 of file MeshQualitySelectionDialog.h.

42{ return _histogram_path; }

References _histogram_path.

Referenced by MainWindow::showMeshQualitySelectionDialog().

◆ getSelectedMetric()

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

Returns selected metric.

Definition at line 36 of file MeshQualitySelectionDialog.h.

36{ return _metric; }

References _metric.

Referenced by MainWindow::showMeshQualitySelectionDialog().

◆ on_histogramCheckBox_toggled

void MeshQualitySelectionDialog::on_histogramCheckBox_toggled ( bool is_checked) const
privateslot

Definition at line 33 of file MeshQualitySelectionDialog.cpp.

35{
36 histogramPathEdit->setEnabled(is_checked);
37 histogramPathButton->setEnabled(is_checked);
38}

◆ on_histogramPathButton_pressed

void MeshQualitySelectionDialog::on_histogramPathButton_pressed ( )
privateslot

Definition at line 40 of file MeshQualitySelectionDialog.cpp.

41{
42 QSettings settings;
43 QFileInfo fi(settings.value("lastOpenedFileDirectory").toString());
44 QString file_name =
45 QFileDialog::getSaveFileName(this, "Save histogram as", fi.baseName(),
46 "Text files (*.txt);;All files (* *.*)");
47 this->histogramPathEdit->setText(file_name);
48}

◆ reject

void MeshQualitySelectionDialog::reject ( )
overrideprivateslot

Instructions if the Cancel-Button has been pressed.

Definition at line 92 of file MeshQualitySelectionDialog.cpp.

93{
94 this->done(QDialog::Rejected);
95}

Member Data Documentation

◆ _histogram_path

std::string MeshQualitySelectionDialog::_histogram_path
private

Definition at line 46 of file MeshQualitySelectionDialog.h.

Referenced by accept(), and getHistogramPath().

◆ _metric

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

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