Skip to content
Snippets Groups Projects
Verified Commit e63a8983 authored by Karsten Rink's avatar Karsten Rink Committed by Lars Bilke
Browse files

[gui] adding widget and access for ignoring nodata

parent 1e7bd1a0
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,20 @@
<string>2D Mesh Mapping</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="2">
<widget class="QLineEdit" name="newNameEdit">
<property name="text">
<string>MappedMesh</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="newNameLabel">
<property name="text">
<string>Name of new mesh:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="rasterSelectButton">
<property name="maximumSize">
......@@ -39,20 +53,6 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="noDataValueLabel">
<property name="text">
<string> Set NoData values to:</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QRadioButton" name="staticValueButton">
<property name="text">
<string>Map to static value:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="rasterPathEdit"/>
</item>
......@@ -66,7 +66,7 @@
</property>
</widget>
</item>
<item row="2" column="2">
<item row="4" column="2">
<widget class="QLineEdit" name="noDataValueEdit">
<property name="text">
<string>0.0</string>
......@@ -76,7 +76,7 @@
</property>
</widget>
</item>
<item row="3" column="2">
<item row="5" column="2">
<widget class="QLineEdit" name="staticValueEdit">
<property name="enabled">
<bool>false</bool>
......@@ -89,13 +89,10 @@
</property>
</widget>
</item>
<item row="5" column="1" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<item row="5" column="0" colspan="2">
<widget class="QRadioButton" name="staticValueButton">
<property name="text">
<string>Map to static value:</string>
</property>
</widget>
</item>
......@@ -109,17 +106,27 @@
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLineEdit" name="newNameEdit">
<property name="text">
<string>MappedMesh</string>
<item row="7" column="1" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="newNameLabel">
<widget class="QLabel" name="noDataValueLabel">
<property name="text">
<string>Name of new mesh:</string>
<string> Set NoData values to:</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QCheckBox" name="ignoreNoDataCheckbox">
<property name="text">
<string>Ignore</string>
</property>
</widget>
</item>
......
......@@ -25,10 +25,17 @@ MeshMapping2DDialog::MeshMapping2DDialog(QDialog* parent)
this->staticValueEdit->setValidator (static_value_validator);
}
void MeshMapping2DDialog::on_ignoreNoDataCheckbox_toggled(bool isChecked)
{
this->noDataValueEdit->setEnabled(!isChecked);
}
void MeshMapping2DDialog::on_rasterValueButton_toggled(bool isChecked)
{
this->rasterPathEdit->setEnabled(isChecked);
this->noDataValueEdit->setEnabled(isChecked);
this->ignoreNoDataCheckbox->setEnabled(isChecked);
this->noDataValueEdit->setEnabled(isChecked &&
!this->ignoreNoDataCheckbox->isChecked());
this->rasterSelectButton->setEnabled(isChecked);
this->staticValueEdit->setEnabled(!isChecked);
}
......@@ -52,7 +59,9 @@ void MeshMapping2DDialog::accept()
OGSError::box("Please specify path to raster file.");
return;
}
if (this->rasterValueButton->isChecked() && this->noDataValueEdit->text().isEmpty())
if (this->rasterValueButton->isChecked() &&
!this->ignoreNoDataCheckbox->isChecked() &&
this->noDataValueEdit->text().isEmpty())
{
OGSError::box("Please specify No Data value.");
return;
......@@ -67,6 +76,10 @@ void MeshMapping2DDialog::accept()
OGSError::box("Please specify a name for the resulting mesh.");
return;
}
if (this->noDataValueEdit->text().isEmpty())
{
this->noDataValueEdit->setText("0.0");
}
this->done(QDialog::Accepted);
}
......
......@@ -29,10 +29,12 @@ public:
bool useStaticMapping() const { return this->staticValueButton->isChecked(); }
std::string getRasterPath() const { return this->rasterPathEdit->text().toStdString(); }
double getNoDataReplacement() const { return this->noDataValueEdit->text().toDouble(); }
bool getIgnoreNoData() const { return this->ignoreNoDataCheckbox->isChecked(); }
double getStaticValue() const { return this->staticValueEdit->text().toDouble(); }
std::string getNewMeshName() const { return this->newNameEdit->text().toStdString(); }
private slots:
void on_ignoreNoDataCheckbox_toggled(bool isChecked);
void on_rasterValueButton_toggled(bool isChecked);
void on_rasterSelectButton_pressed();
......
......@@ -189,7 +189,8 @@ void MeshView::openMap2dMeshDialog()
return;
}
if (!MeshLib::MeshLayerMapper::layerMapping(*result, *raster,
dlg.getNoDataReplacement()))
dlg.getNoDataReplacement(),
dlg.getIgnoreNoData()))
{
OGSError::box("Error mapping mesh.");
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment