17#include <QStringListModel>
31 : QDialog(parent), _mesh_model(mesh_model)
34 QStringList voxelGridList;
35 QStringList faultsList;
37 for (
int model_index = 0; model_index < mesh_model.
rowCount();
40 auto const* mesh = mesh_model.
getMesh(mesh_model.
index(model_index, 0));
45 voxelGridList.append(QString::fromStdString(mesh->getName()));
47 if (mesh->getDimension() == 2)
49 faultsList.append(QString::fromStdString(mesh->getName()));
52 if (voxelGridList.empty())
57 if (faultsList.empty())
59 faultsList.append(
"[No 2D faults available.]");
64 this->voxelGridListBox->addItems(
_voxelGrids.stringList());
82 if (this->voxelGridListBox->currentText() ==
no_voxel_str)
89 this->voxelGridListBox->currentText().toStdString());
90 assert(input_voxelgrid);
91 std::unique_ptr<MeshLib::Mesh> voxelgrid(
97 if (mat_ids ==
nullptr)
103 std::vector<std::string>
const selected_faults =
108 OGSError::box(
"Please specify the fault(s) to be added to the mesh.");
112 auto max_mat_id = std::max_element(mat_ids->cbegin(), mat_ids->cend());
114 auto fault_id = *max_mat_id;
115 for (
auto const& fault_name : selected_faults)
119 if (AddFaultToVoxelGrid::addFaultToVoxelGrid(voxelgrid.get(), fault,
122 INFO(
"The fault '{}' was added.", fault_name);
125 OGSError::box(
"The fault " + QString::fromStdString(fault_name) +
126 " could not be added.");
130 this->done(QDialog::Accepted);
Definition of the AddFaultsToVoxelGridDialog class.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the MeshModel class.
Definition of the Mesh class.
Definition of the OGSError class.
QStringListModel _meshes2D
AddFaultsToVoxelGridDialog(MeshModel &mesh_model, QDialog *parent=nullptr)
void on_selectDataButton_pressed()
Instructions if the ">>-button" has been pressed.
QStringListModel _voxelGrids
QStringListModel _selFaults
void accept() override
Instructions if the OK-Button has been pressed.
void on_deselectDataButton_pressed()
Instructions if the "<<-button" has been pressed.
void addMesh(std::unique_ptr< MeshLib::Mesh > mesh)
Adds a new mesh.
const MeshLib::Mesh * getMesh(const QModelIndex &idx) const
Returns the mesh with the given index.
static void box(const QString &e)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
PropertyVector< int > const * materialIDs(Mesh const &mesh)
std::vector< std::string > getSelectedObjects(QStringList const &list)
void moveSelectedItems(QListView *sourceView, QStringListModel &sourceModel, QStringListModel &targetModel)