OGS
RasterDataToMeshDialog Class Reference

Detailed Description

A dialog window for transferring raster data onto a mesh.

Definition at line 22 of file RasterDataToMeshDialog.h.

#include <RasterDataToMeshDialog.h>

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

Public Member Functions

 RasterDataToMeshDialog (std::string const &mesh_name, QDialog *parent=nullptr)
 
bool createNodeArray () const
 
bool createElemArray () const
 
std::string getArrayName () const
 
std::string getMeshName () const
 
std::string getRasterPath () const
 
double getNoDataReplacement () const
 

Private Slots

void on_rasterSelectButton_pressed ()
 
void accept () override
 
void reject () override
 

Constructor & Destructor Documentation

◆ RasterDataToMeshDialog()

RasterDataToMeshDialog::RasterDataToMeshDialog ( std::string const & mesh_name,
QDialog * parent = nullptr )
explicit

Definition at line 19 of file RasterDataToMeshDialog.cpp.

21 : QDialog(parent)
22{
23 setupUi(this);
24
25 this->meshNameEdit->setText(QString::fromStdString(mesh_name) + "_Raster");
26 auto* no_data_validator = new StrictDoubleValidator(this);
27 this->noDataValueEdit->setValidator(no_data_validator);
28}
A validator for an input field which only accepts decimals. Source code adapted from StackOverflow

Member Function Documentation

◆ accept

void RasterDataToMeshDialog::accept ( )
overrideprivateslot

Definition at line 42 of file RasterDataToMeshDialog.cpp.

43{
44 if (this->rasterPathEdit->text().isEmpty())
45 {
46 OGSError::box("Please specify path to raster file.");
47 return;
48 }
49 else if (this->arrayNameEdit->text().isEmpty())
50 {
51 OGSError::box("Please specify a name for the new array.");
52 return;
53 }
54 else if (this->noDataValueEdit->text().isEmpty())
55 {
56 OGSError::box("Please specify No Data value.");
57 return;
58 }
59 else if (this->meshNameEdit->text().isEmpty())
60 {
61 OGSError::box("Please specify name of new mesh.");
62 return;
63 }
64
65 this->done(QDialog::Accepted);
66}
static void box(const QString &e)
Definition OGSError.cpp:23

References OGSError::box().

◆ createElemArray()

bool RasterDataToMeshDialog::createElemArray ( ) const
inline

Definition at line 31 of file RasterDataToMeshDialog.h.

31{ return this->elemButton->isChecked(); }

◆ createNodeArray()

bool RasterDataToMeshDialog::createNodeArray ( ) const
inline

Definition at line 30 of file RasterDataToMeshDialog.h.

30{ return this->nodeButton->isChecked(); }

Referenced by MeshView::openRasterDataToMeshDialog().

◆ getArrayName()

std::string RasterDataToMeshDialog::getArrayName ( ) const
inline

Definition at line 32 of file RasterDataToMeshDialog.h.

32{ return this->arrayNameEdit->text().toStdString(); }

Referenced by MeshView::openRasterDataToMeshDialog().

◆ getMeshName()

std::string RasterDataToMeshDialog::getMeshName ( ) const
inline

Definition at line 33 of file RasterDataToMeshDialog.h.

33{ return this->meshNameEdit->text().toStdString(); }

Referenced by MeshView::openRasterDataToMeshDialog().

◆ getNoDataReplacement()

double RasterDataToMeshDialog::getNoDataReplacement ( ) const
inline

Definition at line 35 of file RasterDataToMeshDialog.h.

35{ return this->noDataValueEdit->text().toDouble(); }

Referenced by MeshView::openRasterDataToMeshDialog().

◆ getRasterPath()

std::string RasterDataToMeshDialog::getRasterPath ( ) const
inline

Definition at line 34 of file RasterDataToMeshDialog.h.

34{ return this->rasterPathEdit->text().toStdString(); }

Referenced by MeshView::openRasterDataToMeshDialog().

◆ on_rasterSelectButton_pressed

void RasterDataToMeshDialog::on_rasterSelectButton_pressed ( )
privateslot

Definition at line 30 of file RasterDataToMeshDialog.cpp.

31{
32 QSettings settings;
33 QString filename = QFileDialog::getOpenFileName(
34 this, "Select raster file to open",
35 settings.value("lastOpenedRasterFileDirectory").toString(),
36 "ASCII raster files (*.asc);;All files (* *.*)");
37 this->rasterPathEdit->setText(filename);
38 QFileInfo fi(filename);
39 settings.setValue("lastOpenedRasterFileDirectory", fi.absolutePath());
40}

◆ reject

void RasterDataToMeshDialog::reject ( )
inlineoverrideprivateslot

Definition at line 41 of file RasterDataToMeshDialog.h.

41{ this->done(QDialog::Rejected); }

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