diff --git a/Applications/DataExplorer/DataView/MeshElementRemoval.ui b/Applications/DataExplorer/DataView/MeshElementRemoval.ui index da7de44974f1e132b16ee34314299f320167523c..67985d2007b0120981797966560dd7e299d796cc 100644 --- a/Applications/DataExplorer/DataView/MeshElementRemoval.ui +++ b/Applications/DataExplorer/DataView/MeshElementRemoval.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>400</width> - <height>420</height> + <height>481</height> </rect> </property> <property name="windowTitle"> @@ -267,6 +267,23 @@ </item> </layout> </widget> + <tabstops> + <tabstop>meshNameComboBox</tabstop> + <tabstop>newMeshNameEdit</tabstop> + <tabstop>elementTypeCheckBox</tabstop> + <tabstop>elementTypeListWidget</tabstop> + <tabstop>materialIDCheckBox</tabstop> + <tabstop>materialListWidget</tabstop> + <tabstop>boundingBoxCheckBox</tabstop> + <tabstop>xMinEdit</tabstop> + <tabstop>xMaxEdit</tabstop> + <tabstop>yMinEdit</tabstop> + <tabstop>yMaxEdit</tabstop> + <tabstop>zMinEdit</tabstop> + <tabstop>zMaxEdit</tabstop> + <tabstop>zeroVolumeCheckBox</tabstop> + <tabstop>buttonBox</tabstop> + </tabstops> <resources/> <connections> <connection> @@ -276,8 +293,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>248</x> - <y>254</y> + <x>388</x> + <y>469</y> </hint> <hint type="destinationlabel"> <x>157</x> @@ -292,8 +309,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>316</x> - <y>260</y> + <x>388</x> + <y>469</y> </hint> <hint type="destinationlabel"> <x>286</x> diff --git a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp index 57a298c7b8a051ce7a49f91159e1bd49d11c43a3..77d489f1dbd25831ac9cbf8533d4fedabf2ef135 100644 --- a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp +++ b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp @@ -44,7 +44,6 @@ MeshElementRemovalDialog::MeshElementRemovalDialog(const ProjectData &project, Q OGSError::box("No meshes available."); QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection); } - } MeshElementRemovalDialog::~MeshElementRemovalDialog() @@ -78,15 +77,22 @@ void MeshElementRemovalDialog::accept() } if (this->boundingBoxCheckBox->isChecked()) { - const MeshLib::Node min(this->xMinEdit->text().toDouble(), - this->yMinEdit->text().toDouble(), - this->zMinEdit->text().toDouble(),0); - const MeshLib::Node max(this->xMaxEdit->text().toDouble(), - this->yMaxEdit->text().toDouble(), - this->zMaxEdit->text().toDouble(),0); - ex.searchByBoundingBox(min, max); + std::vector<MeshLib::Node*> const& nodes (_project.getMesh(this->meshNameComboBox->currentText().toStdString())->getNodes()); + GeoLib::AABB<MeshLib::Node> const aabb(nodes.begin(), nodes.end()); + MeshLib::Node minAABB = aabb.getMinPoint(); + MeshLib::Node maxAABB = aabb.getMaxPoint(); + + // only extract bounding box parameters that have been edited (otherwise there will be rounding errors!) + minAABB[0] = (aabb_edits[0]) ? this->xMinEdit->text().toDouble() : (minAABB[0]); + maxAABB[0] = (aabb_edits[1]) ? this->xMaxEdit->text().toDouble() : (maxAABB[0]); + minAABB[1] = (aabb_edits[2]) ? this->yMinEdit->text().toDouble() : (minAABB[1]); + maxAABB[1] = (aabb_edits[3]) ? this->yMaxEdit->text().toDouble() : (maxAABB[1]); + minAABB[2] = (aabb_edits[4]) ? this->zMinEdit->text().toDouble() : (minAABB[2]); + maxAABB[2] = (aabb_edits[5]) ? this->zMaxEdit->text().toDouble() : (maxAABB[2]); + ex.searchByBoundingBox(minAABB, maxAABB); anything_checked = true; } + if (this->zeroVolumeCheckBox->isChecked()) { ex.searchByContent(); @@ -132,19 +138,18 @@ void MeshElementRemovalDialog::on_boundingBoxCheckBox_toggled(bool is_checked) if (is_checked && (_currentIndex != _aabbIndex)) { _aabbIndex = _currentIndex; - const std::vector<MeshLib::Node*> nodes (_project.getMesh(this->meshNameComboBox->currentText().toStdString())->getNodes()); + std::vector<MeshLib::Node*> const& nodes (_project.getMesh(this->meshNameComboBox->currentText().toStdString())->getNodes()); GeoLib::AABB<MeshLib::Node> aabb(nodes.begin(), nodes.end()); - const MeshLib::Node minAABB = aabb.getMinPoint(); - const MeshLib::Node maxAABB = aabb.getMaxPoint(); + MeshLib::Node const minAABB = aabb.getMinPoint(); + MeshLib::Node const maxAABB = aabb.getMaxPoint(); this->xMinEdit->setText(QString::number(minAABB[0], 'f')); this->xMaxEdit->setText(QString::number(maxAABB[0], 'f')); this->yMinEdit->setText(QString::number(minAABB[1], 'f')); this->yMaxEdit->setText(QString::number(maxAABB[1], 'f')); this->zMinEdit->setText(QString::number(minAABB[2], 'f')); this->zMaxEdit->setText(QString::number(maxAABB[2], 'f')); - + aabb_edits.fill(false); } - } void MeshElementRemovalDialog::on_elementTypeCheckBox_toggled(bool is_checked) @@ -181,7 +186,3 @@ void MeshElementRemovalDialog::on_meshNameComboBox_currentIndexChanged(int idx) if (this->boundingBoxCheckBox->isChecked()) this->on_boundingBoxCheckBox_toggled(true); if (this->materialIDCheckBox->isChecked()) this->on_materialIDCheckBox_toggled(true); } - - - - diff --git a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.h b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.h index 76b2a6aa8a73b280580a416f46a428cd04a12a78..c306c44d4d2e399f312f0e2ab2a998f2fc89b93d 100644 --- a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.h +++ b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.h @@ -40,12 +40,19 @@ private slots: void on_elementTypeCheckBox_toggled(bool is_checked); void on_materialIDCheckBox_toggled(bool is_checked); void on_meshNameComboBox_currentIndexChanged(int idx); + void on_xMinEdit_textChanged() { aabb_edits[0] = true; } + void on_xMaxEdit_textChanged() { aabb_edits[1] = true; } + void on_yMinEdit_textChanged() { aabb_edits[2] = true; } + void on_yMaxEdit_textChanged() { aabb_edits[3] = true; } + void on_zMinEdit_textChanged() { aabb_edits[4] = true; } + void on_zMaxEdit_textChanged() { aabb_edits[5] = true; } void accept(); void reject(); private: const ProjectData& _project; unsigned _currentIndex, _aabbIndex, _matIDIndex; + std::array<bool, 6> aabb_edits; signals: void meshAdded(MeshLib::Mesh* mesh);