OGS
|
VtkVisPipeline manages the VTK visualization. It is a TreeModel and provides functions for adding and removing OGS Model or vtkAlgorithm objects.
Definition at line 55 of file VtkVisPipeline.h.
#include <VtkVisPipeline.h>
Public Slots | |
void | addPipelineItem (MeshModel *model, const QModelIndex &idx) |
Adds the given Model to the pipeline. | |
void | addPipelineItem (GeoTreeModel *model, const std::string &name, GeoLib::GEOTYPE type) |
void | addPipelineItem (StationTreeModel *model, const std::string &name) |
QModelIndex | addPipelineItem (VtkVisPipelineItem *item, const QModelIndex &parent) |
QModelIndex | addPipelineItem (vtkAlgorithm *source, QModelIndex parent=QModelIndex()) |
Inserts the vtkAlgorithm as a child of the given QModelIndex to the pipeline. | |
void | removeSourceItem (MeshModel *model, const QModelIndex &idx) |
Removes the given Model (and all attached vtkAlgorithms) from the pipeline. | |
void | removeSourceItem (GeoTreeModel *model, const std::string &name, GeoLib::GEOTYPE type) |
void | removeSourceItem (StationTreeModel *model, const std::string &name) |
void | removePipelineItem (QModelIndex index) |
Removes the vtkAlgorithm at the given QModelIndex (and all attached vtkAlgorithms) from the pipeline. | |
void | highlightGeoObject (const vtkPolyDataAlgorithm *source, int index) |
Applies a VtkCompositeGeoObjectFilter to add a specific index of the given geometry-source to the pipeline for highlighted display in the render window. | |
void | removeHighlightedGeoObject () |
Removes the currently highlighted geometry-object. | |
void | highlightMeshComponent (vtkUnstructuredGridAlgorithm const *const source, unsigned index, bool is_element) |
Applies a VtkCompositeSelectionFilter to add a specific component of the given mesh-source to the pipeline for highlighted display in the render window. | |
void | removeHighlightedMeshComponent () |
Removes the currently highlighted mesh component. | |
Public Slots inherited from TreeModel | |
void | updateData () |
Signals | |
void | vtkVisPipelineChanged () const |
Is emitted when a pipeline item was added or removed. | |
void | itemSelected (const QModelIndex &) const |
Public Member Functions | |
VtkVisPipeline (vtkRenderer *renderer, QObject *parent=nullptr) | |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
Emits vtkVisPipelineChanged() and calls base class method. | |
void | addLight (const GeoLib::Point &pos) |
Adds a light to the scene at the given coordinates. | |
vtkLight * | getLight (const GeoLib::Point &pos) const |
Returns a light (or nullptr) for the given coordinates. | |
void | removeLight (const GeoLib::Point &pos) |
Removes a light at the given coordinates (if possible). | |
QColor | getBGColor () const |
Returns the background-colour of the scene. | |
void | setBGColor (const QColor &color) |
Sets the background-colour of the scene. | |
QModelIndex | getIndex (vtkProp3D *actor) |
Returns the QModelIndex of VtkVisPipelineItem which actor is the given one. | |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
void | loadFromFile (QString filename) |
Loads a vtk object from the given file and adds it to the pipeline. | |
void | resetCameraOnAddOrRemove (bool reset) |
Defaults to on. | |
void | setGlobalSuperelevation (double factor) const |
Sets a global superelevation factor on all source items and resets the factor on other items to 1. | |
void | setGlobalBackfaceCulling (bool enable) const |
Enables / disables backface culling on all actors. | |
void | showMeshElementQuality (MeshLib::VtkMappedMeshSource *source, MeshLib::MeshQualityType t, std::vector< double > const &quality) |
Checks the quality of mesh elements and adds a filter to highlight deformed elements. | |
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 | listArrays (vtkDataSet *dataSet) |
Private Attributes | |
vtkRenderer * | _renderer |
QVector< vtkAlgorithm * > | _sources |
std::list< vtkLight * > | _lights |
QMap< vtkProp3D *, QModelIndex > | _actorMap |
bool | _resetCameraOnAddOrRemove |
QModelIndex | _highlighted_geo_index |
QModelIndex | _highlighted_mesh_component |
Additional Inherited Members | |
Protected Attributes inherited from TreeModel | |
TreeItem * | _rootItem |
|
explicit |
Definition at line 64 of file VtkVisPipeline.cpp.
References _resetCameraOnAddOrRemove, TreeModel::_rootItem, and setBGColor().
void VtkVisPipeline::addLight | ( | const GeoLib::Point & | pos | ) |
Adds a light to the scene at the given coordinates.
Definition at line 92 of file VtkVisPipeline.cpp.
References _lights, and _renderer.
Referenced by VisPrefsDialog::on_lightAboveBox_clicked(), and VisPrefsDialog::on_lightBelowBox_clicked().
|
slot |
Definition at line 286 of file VtkVisPipeline.cpp.
References addPipelineItem(), and GeoTreeModel::vtkSource().
|
slot |
Adds the given Model to the pipeline.
Definition at line 299 of file VtkVisPipeline.cpp.
References addPipelineItem(), TreeModel::getItem(), and MeshItem::vtkSource().
Referenced by addPipelineItem(), addPipelineItem(), addPipelineItem(), addPipelineItem(), highlightGeoObject(), highlightMeshComponent(), loadFromFile(), VtkAddFilterDialog::on_buttonBox_accepted(), and showMeshElementQuality().
|
slot |
Definition at line 293 of file VtkVisPipeline.cpp.
References addPipelineItem(), and StationTreeModel::vtkSource().
|
slot |
Inserts the vtkAlgorithm as a child of the given QModelIndex to the pipeline.
Definition at line 346 of file VtkVisPipeline.cpp.
References addPipelineItem(), TreeModel::getItem(), and TreeModel::parent().
|
slot |
Definition at line 304 of file VtkVisPipeline.cpp.
References _actorMap, _renderer, _resetCameraOnAddOrRemove, TreeModel::_rootItem, VtkVisPipelineItem::actor(), VtkVisPipelineItem::algorithm(), TreeItem::appendChild(), TreeItem::childCount(), TreeModel::index(), VtkVisPipelineItem::Initialize(), itemSelected(), TreeModel::parent(), TreeItem::parentItem(), VtkVisPipelineItem::setScale(), and vtkVisPipelineChanged().
|
override |
Definition at line 163 of file VtkVisPipeline.cpp.
References TreeModel::index().
QColor VtkVisPipeline::getBGColor | ( | ) | const |
Returns the background-colour of the scene.
Definition at line 142 of file VtkVisPipeline.cpp.
References _renderer.
Referenced by VisPrefsDialog::VisPrefsDialog().
QModelIndex VtkVisPipeline::getIndex | ( | vtkProp3D * | actor | ) |
Returns the QModelIndex of VtkVisPipelineItem which actor is the given one.
Definition at line 158 of file VtkVisPipeline.cpp.
References _actorMap.
vtkLight * VtkVisPipeline::getLight | ( | const GeoLib::Point & | pos | ) | const |
Returns a light (or nullptr) for the given coordinates.
Definition at line 110 of file VtkVisPipeline.cpp.
References _lights.
Referenced by VisPrefsDialog::VisPrefsDialog().
|
slot |
Applies a VtkCompositeGeoObjectFilter to add a specific index of the given geometry-source to the pipeline for highlighted display in the render window.
Definition at line 537 of file VtkVisPipeline.cpp.
References _highlighted_geo_index, TreeModel::_rootItem, addPipelineItem(), TreeItem::child(), TreeItem::childCount(), VtkFilterFactory::CreateCompositeFilter(), TreeModel::index(), and removeHighlightedGeoObject().
|
slot |
Applies a VtkCompositeSelectionFilter to add a specific component of the given mesh-source to the pipeline for highlighted display in the render window.
Definition at line 575 of file VtkVisPipeline.cpp.
References _highlighted_mesh_component, TreeModel::_rootItem, addPipelineItem(), TreeItem::child(), TreeItem::childCount(), VtkFilterFactory::CreateCompositeFilter(), and TreeModel::index().
|
signal |
Referenced by addPipelineItem().
|
private |
Definition at line 476 of file VtkVisPipeline.cpp.
Referenced by loadFromFile().
void VtkVisPipeline::loadFromFile | ( | QString | filename | ) |
Loads a vtk object from the given file and adds it to the pipeline.
Definition at line 178 of file VtkVisPipeline.cpp.
References addPipelineItem(), ERR(), INFO(), and listArrays().
|
slot |
Removes the currently highlighted geometry-object.
Definition at line 566 of file VtkVisPipeline.cpp.
References _highlighted_geo_index, and removePipelineItem().
Referenced by highlightGeoObject().
|
slot |
Removes the currently highlighted mesh component.
Definition at line 624 of file VtkVisPipeline.cpp.
References _highlighted_mesh_component, and removePipelineItem().
void VtkVisPipeline::removeLight | ( | const GeoLib::Point & | pos | ) |
Removes a light at the given coordinates (if possible).
Definition at line 125 of file VtkVisPipeline.cpp.
References _lights, and _renderer.
Referenced by VisPrefsDialog::on_lightAboveBox_clicked(), and VisPrefsDialog::on_lightBelowBox_clicked().
|
slot |
Removes the vtkAlgorithm at the given QModelIndex (and all attached vtkAlgorithms) from the pipeline.
Definition at line 447 of file VtkVisPipeline.cpp.
References _actorMap, _renderer, _resetCameraOnAddOrRemove, TreeModel::index(), TreeModel::removeRows(), and vtkVisPipelineChanged().
Referenced by removeHighlightedGeoObject(), removeHighlightedMeshComponent(), removeSourceItem(), removeSourceItem(), and removeSourceItem().
|
slot |
Definition at line 400 of file VtkVisPipeline.cpp.
References TreeModel::_rootItem, VtkVisPipelineItem::algorithm(), TreeItem::childCount(), TreeModel::getItem(), TreeModel::index(), removePipelineItem(), and GeoTreeModel::vtkSource().
|
slot |
Removes the given Model (and all attached vtkAlgorithms) from the pipeline.
Definition at line 431 of file VtkVisPipeline.cpp.
References TreeModel::_rootItem, VtkVisPipelineItem::algorithm(), TreeItem::childCount(), TreeModel::getItem(), TreeModel::index(), and removePipelineItem().
|
slot |
Definition at line 416 of file VtkVisPipeline.cpp.
References TreeModel::_rootItem, VtkVisPipelineItem::algorithm(), TreeItem::childCount(), TreeModel::getItem(), TreeModel::index(), removePipelineItem(), and StationTreeModel::vtkSource().
|
inline |
Defaults to on.
Definition at line 91 of file VtkVisPipeline.h.
References _resetCameraOnAddOrRemove.
Referenced by VisPrefsDialog::on_loadShowAllCheckBox_stateChanged().
void VtkVisPipeline::setBGColor | ( | const QColor & | color | ) |
Sets the background-colour of the scene.
Definition at line 151 of file VtkVisPipeline.cpp.
References _renderer.
Referenced by VtkVisPipeline(), and VisPrefsDialog::on_bgColorButton_colorPicked().
|
override |
Emits vtkVisPipelineChanged() and calls base class method.
Definition at line 84 of file VtkVisPipeline.cpp.
References TreeModel::index(), TreeModel::setData(), and vtkVisPipelineChanged().
void VtkVisPipeline::setGlobalBackfaceCulling | ( | bool | enable | ) | const |
Enables / disables backface culling on all actors.
Definition at line 271 of file VtkVisPipeline.cpp.
References TreeModel::_rootItem, TreeItem::child(), TreeItem::childCount(), VtkVisPipelineItem::setBackfaceCulling(), and vtkVisPipelineChanged().
Referenced by VisPrefsDialog::on_cullBackfacesCheckBox_stateChanged().
void VtkVisPipeline::setGlobalSuperelevation | ( | double | factor | ) | const |
Sets a global superelevation factor on all source items and resets the factor on other items to 1.
Definition at line 256 of file VtkVisPipeline.cpp.
References TreeModel::_rootItem, TreeItem::child(), TreeItem::childCount(), VtkVisPipelineItem::setScale(), and vtkVisPipelineChanged().
Referenced by VisPrefsDialog::on_superelevationPushButton_pressed().
void VtkVisPipeline::showMeshElementQuality | ( | MeshLib::VtkMappedMeshSource * | source, |
MeshLib::MeshQualityType | t, | ||
std::vector< double > const & | quality ) |
Checks the quality of mesh elements and adds a filter to highlight deformed elements.
Definition at line 494 of file VtkVisPipeline.cpp.
References TreeModel::_rootItem, addPipelineItem(), TreeItem::child(), TreeItem::childCount(), VtkFilterFactory::CreateCompositeFilter(), and MeshLib::ELEMENTSIZE.
|
signal |
Is emitted when a pipeline item was added or removed.
Referenced by addPipelineItem(), removePipelineItem(), setData(), setGlobalBackfaceCulling(), and setGlobalSuperelevation().
|
private |
Definition at line 143 of file VtkVisPipeline.h.
Referenced by addPipelineItem(), getIndex(), and removePipelineItem().
|
private |
Definition at line 146 of file VtkVisPipeline.h.
Referenced by highlightGeoObject(), and removeHighlightedGeoObject().
|
private |
Definition at line 147 of file VtkVisPipeline.h.
Referenced by highlightMeshComponent(), and removeHighlightedMeshComponent().
|
private |
Definition at line 142 of file VtkVisPipeline.h.
Referenced by addLight(), getLight(), and removeLight().
|
private |
Definition at line 140 of file VtkVisPipeline.h.
Referenced by addLight(), addPipelineItem(), getBGColor(), removeLight(), removePipelineItem(), and setBGColor().
|
private |
Definition at line 144 of file VtkVisPipeline.h.
Referenced by VtkVisPipeline(), addPipelineItem(), removePipelineItem(), and resetCameraOnAddOrRemove().
|
private |
Definition at line 141 of file VtkVisPipeline.h.