OGS
|
The MeshModel is a Qt model which represents Mesh objects.
Definition at line 37 of file MeshModel.h.
#include <MeshModel.h>
Public Slots | |
void | addMesh (MeshLib::Mesh *mesh) |
Adds a new mesh (using no unique_ptr as this interferes with Qt's signal/slot policy) | |
const MeshLib::Mesh * | getMesh (const QModelIndex &idx) const |
Returns the mesh with the given index. | |
const MeshLib::Mesh * | getMesh (const std::string &name) const |
Returns the mesh with the given name. | |
bool | removeMesh (const QModelIndex &idx) |
Removes the mesh with the given index. | |
bool | removeMesh (const std::string &name) |
Removes the mesh with the given name. | |
void | updateMesh (MeshLib::Mesh *) |
Updates the model/view for a mesh. | |
void | updateModel () |
Updates the model based on the ProjectData-object. | |
vtkUnstructuredGridAlgorithm * | vtkSource (const QModelIndex &idx) const |
Returns the VTK source item for the mesh with the given index. | |
vtkUnstructuredGridAlgorithm * | vtkSource (const std::string &name) const |
Returns the VTK source item for the mesh with the given name. | |
Public Slots inherited from TreeModel | |
void | updateData () |
Signals | |
void | meshAdded (MeshModel *, const QModelIndex &) |
void | meshRemoved (MeshModel *, const QModelIndex &) |
Public Member Functions | |
MeshModel (DataHolderLib::Project &project, QObject *parent=nullptr) | |
void | addMesh (std::unique_ptr< MeshLib::Mesh > mesh) |
Adds a new mesh. | |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
Returns the number of columns used for the data list. | |
Public Member Functions inherited from TreeModel | |
TreeModel (QObject *parent=nullptr) | |
~TreeModel () override | |
QVariant | data (const QModelIndex &index, int role) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
TreeItem * | getItem (const QModelIndex &index) const |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | parent (const QModelIndex &index) const override |
bool | removeRows (int position, int count, const QModelIndex &parent) override |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
TreeItem * | rootItem () const |
Private Member Functions | |
void | addMeshObject (const MeshLib::Mesh *mesh) |
Adds the mesh to the GUI-Mesh-Model und -View. | |
Static Private Member Functions | |
static std::map< MeshLib::MeshElemType, QVariant > | createMeshElemTypeMap () |
Creates a static map of all element type name-strings in QVariant format. | |
Private Attributes | |
DataHolderLib::Project & | _project |
Checks if the name of the mesh is already exists, if so it generates a unique name. | |
Static Private Attributes | |
static const std::map< MeshLib::MeshElemType, QVariant > | elem_type_map |
static const QVariant | element_str = "Element" |
Additional Inherited Members | |
Protected Attributes inherited from TreeModel | |
TreeItem * | _rootItem |
|
explicit |
Definition at line 34 of file MeshModel.cpp.
References TreeModel::_rootItem.
|
slot |
Adds a new mesh (using no unique_ptr as this interferes with Qt's signal/slot policy)
Definition at line 59 of file MeshModel.cpp.
References _project, DataHolderLib::Project::addMesh(), addMeshObject(), and DataHolderLib::Project::getMeshObjects().
void MeshModel::addMesh | ( | std::unique_ptr< MeshLib::Mesh > | mesh | ) |
Adds a new mesh.
Definition at line 52 of file MeshModel.cpp.
References _project, DataHolderLib::Project::addMesh(), addMeshObject(), and DataHolderLib::Project::getMeshObjects().
Referenced by AddFaultsToVoxelGridDialog::accept(), Layers2GridDialog::accept(), and Vtu2GridDialog::accept().
|
private |
Adds the mesh to the GUI-Mesh-Model und -View.
Definition at line 66 of file MeshModel.cpp.
References TreeModel::_rootItem, TreeItem::appendChild(), TreeItem::childCount(), elem_type_map, element_str, MeshLib::Mesh::getElements(), MeshLib::Mesh::getName(), TreeModel::index(), INFO(), and meshAdded().
Referenced by addMesh(), addMesh(), updateMesh(), and updateModel().
|
override |
Returns the number of columns used for the data list.
Definition at line 45 of file MeshModel.cpp.
References TreeModel::parent().
|
staticprivate |
Creates a static map of all element type name-strings in QVariant format.
Definition at line 186 of file MeshModel.cpp.
References MeshLib::getMeshElemTypes(), and MeshLib::MeshElemType2String().
|
slot |
Returns the mesh with the given index.
Definition at line 96 of file MeshModel.cpp.
References TreeModel::getItem(), and WARN().
Referenced by AddFaultsToVoxelGridDialog::AddFaultsToVoxelGridDialog(), Layers2GridDialog::Layers2GridDialog(), TranslateDataDialog::TranslateDataDialog(), Vtu2GridDialog::Vtu2GridDialog(), AddFaultsToVoxelGridDialog::accept(), Layers2GridDialog::accept(), Vtu2GridDialog::accept(), TranslateDataDialog::moveMesh(), MeshView::openMap2dMeshDialog(), MeshView::openMeshEditDialog(), MeshView::openRasterDataToMeshDialog(), MeshView::openValuesEditDialog(), Layers2GridDialog::updateExpectedVoxel(), Vtu2GridDialog::updateExpectedVoxel(), and updateModel().
|
slot |
Returns the mesh with the given name.
Definition at line 112 of file MeshModel.cpp.
References TreeModel::_rootItem, TreeItem::child(), TreeItem::childCount(), and INFO().
|
signal |
Referenced by addMeshObject().
|
signal |
Referenced by removeMesh(), and updateMesh().
|
slot |
Removes the mesh with the given index.
Definition at line 127 of file MeshModel.cpp.
References TreeModel::getItem(), and removeMesh().
Referenced by removeMesh().
|
slot |
Removes the mesh with the given name.
Definition at line 141 of file MeshModel.cpp.
References _project, TreeModel::_rootItem, TreeItem::child(), TreeItem::childCount(), TreeItem::data(), TreeModel::index(), INFO(), meshRemoved(), TreeItem::removeChildren(), and DataHolderLib::Project::removeMesh().
|
slot |
Updates the model/view for a mesh.
Definition at line 160 of file MeshModel.cpp.
References TreeModel::_rootItem, addMeshObject(), TreeItem::child(), TreeItem::childCount(), MeshItem::getMesh(), TreeModel::index(), meshRemoved(), and TreeItem::removeChildren().
Referenced by TranslateDataDialog::moveMesh().
|
slot |
Updates the model based on the ProjectData-object.
Definition at line 174 of file MeshModel.cpp.
References _project, addMeshObject(), getMesh(), and DataHolderLib::Project::getMeshObjects().
|
slot |
Returns the VTK source item for the mesh with the given index.
Definition at line 201 of file MeshModel.cpp.
References TreeModel::getItem(), INFO(), and MeshItem::vtkSource().
|
slot |
Returns the VTK source item for the mesh with the given name.
Definition at line 213 of file MeshModel.cpp.
References TreeModel::_rootItem, TreeItem::child(), TreeItem::childCount(), and INFO().
|
private |
Checks if the name of the mesh is already exists, if so it generates a unique name.
Definition at line 77 of file MeshModel.h.
Referenced by addMesh(), addMesh(), removeMesh(), and updateModel().
|
staticprivate |
Definition at line 82 of file MeshModel.h.
Referenced by addMeshObject().
|
staticprivate |
Definition at line 83 of file MeshModel.h.
Referenced by addMeshObject().