OGS
VtkAddFilterDialog Class Reference

Detailed Description

Dialog for selecting a filter to be applied to a VtkPipelineItem. The dialog lets you select filters defined in VtkOGSFilter that have been registered as OGSFilterInfo - objects.

Definition at line 28 of file VtkAddFilterDialog.h.

#include <VtkAddFilterDialog.h>

Inheritance diagram for VtkAddFilterDialog:
[legend]
Collaboration diagram for VtkAddFilterDialog:
[legend]

Public Slots

void on_buttonBox_accepted ()
 

Public Member Functions

 VtkAddFilterDialog (VtkVisPipeline &pipeline, QModelIndex parentIndex, QDialog *parent=nullptr)
 

Protected Slots

void on_filterListWidget_currentRowChanged (int currentRow)
 

Private Attributes

VtkVisPipeline_pipeline
 
QModelIndex _parentIndex
 

Constructor & Destructor Documentation

◆ VtkAddFilterDialog()

VtkAddFilterDialog::VtkAddFilterDialog ( VtkVisPipeline pipeline,
QModelIndex  parentIndex,
QDialog *  parent = nullptr 
)

Definition at line 32 of file VtkAddFilterDialog.cpp.

35 : QDialog(parent), _pipeline(pipeline), _parentIndex(parentIndex)
36{
37 setupUi(this);
38 filterListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
39
40 auto* parentItem =
41 static_cast<VtkVisPipelineItem*>(_pipeline.getItem(parentIndex));
42 vtkDataObject* parentDataObject =
43 parentItem->algorithm()->GetOutputDataObject(0);
44 int parentDataObjectType = parentDataObject->GetDataObjectType();
45
46 QVector<VtkFilterInfo> filterList = VtkFilterFactory::GetFilterList();
47 foreach (VtkFilterInfo filter, filterList)
48 {
49 // Check for suitable filters (see vtkDataSet inheritance diagram)
50 int inputType = filter.inputDataObjectType;
51 if ((inputType == parentDataObjectType) ||
52 (inputType == VTK_POINT_SET &&
53 parentDataObjectType != VTK_IMAGE_DATA) ||
54 (inputType == VTK_IMAGE_DATA &&
55 (parentDataObjectType == VTK_STRUCTURED_POINTS ||
56 parentDataObjectType == VTK_UNIFORM_GRID)))
57 {
58 new QListWidgetItem(filter.readableName, filterListWidget);
59 }
60 }
61
62 // On double clicking an item the dialog gets accepted
63 connect(filterListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
64 this->buttonBox, SIGNAL(accepted()));
65}
TreeItem * getItem(const QModelIndex &index) const
Definition: TreeModel.cpp:188
VtkVisPipeline & _pipeline
static QVector< VtkFilterInfo > GetFilterList()
Returns all registered filters. New VtkCompositeFilter or filter inherited from VtkAlgorithmPropertie...
An item in the VtkVisPipeline containing a graphic object to be visualized.
vtkAlgorithm * algorithm() const
Returns the algorithm object.
constexpr List filter(Pred, SomeListOfTypes<> *)
Definition: TMP.h:48
Holds meta information about a filter.

References _pipeline, VtkVisPipelineItem::algorithm(), VtkFilterFactory::GetFilterList(), and TreeModel::getItem().

Member Function Documentation

◆ on_buttonBox_accepted

void VtkAddFilterDialog::on_buttonBox_accepted ( )
slot

Definition at line 67 of file VtkAddFilterDialog.cpp.

68{
69 QVector<VtkFilterInfo> filterList = VtkFilterFactory::GetFilterList();
70 QString filterName;
71 foreach (VtkFilterInfo filter, filterList)
72 {
73 if (filter.readableName.compare(
74 filterListWidget->currentItem()->text()) == 0)
75 {
76 filterName = filter.name;
77 break;
78 }
79 }
80 auto* parentItem =
82 QList<QVariant> itemData;
83 itemData << filterListWidget->currentItem()->text() << true;
84
86 if (dynamic_cast<VtkVisImageItem*>(parentItem))
87 {
89 filterName, parentItem->algorithm());
90 }
91 else
92 {
94 filterName, parentItem->transformFilter());
95 }
96
98 if (filter)
99 {
100 if (filter->GetOutputDataObjectType() == VTK_IMAGE_DATA)
101 {
102 item = new VtkVisImageItem(filter, parentItem, itemData);
103 }
104 else
105 {
106 item = new VtkVisPointSetItem(filter, parentItem, itemData);
107 }
108 }
109 else
110 {
111 vtkAlgorithm* algorithm =
113 if (algorithm)
114 {
115 item = new VtkVisPointSetItem(algorithm, parentItem, itemData);
116 }
117 else
118 {
119 ERR("VtkFilterFactory cannot create {:s}.",
120 filterName.toStdString());
121 return;
122 }
123 }
125}
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:45
Is used to combine several filter in one VtkVisPipelineItem. You can use vtk filter and custom filter...
static VtkCompositeFilter * CreateCompositeFilter(QString type, vtkAlgorithm *inputAlgorithm)
Creates a composite filter by name.
static vtkAlgorithm * CreateSimpleFilter(QString type)
Creates a normal filter name.
An item in the VtkVisPipeline containing an image to be visualized.
void addPipelineItem(MeshModel *model, const QModelIndex &idx)
Adds the given Model to the pipeline.
An item in the VtkVisPipeline containing a point set object to be visualized.

References _parentIndex, _pipeline, VtkVisPipeline::addPipelineItem(), VtkFilterFactory::CreateCompositeFilter(), VtkFilterFactory::CreateSimpleFilter(), ERR(), VtkFilterFactory::GetFilterList(), and TreeModel::getItem().

◆ on_filterListWidget_currentRowChanged

void VtkAddFilterDialog::on_filterListWidget_currentRowChanged ( int  currentRow)
protectedslot

Definition at line 127 of file VtkAddFilterDialog.cpp.

128{
130 {
131 if (filter.readableName.compare(
132 filterListWidget->item(currentRow)->text()) == 0)
133 {
134 QString desc = filter.description;
135 desc = desc + QString("\n\nThis filter outputs ") +
136 filter.OutputDataObjectTypeAsString() +
137 QString("\n\nFilter class name: ") + filter.name;
138
139 this->filterDescTextEdit->setText(desc);
140 continue;
141 }
142 }
143}

References VtkFilterFactory::GetFilterList().

Member Data Documentation

◆ _parentIndex

QModelIndex VtkAddFilterDialog::_parentIndex
private

Definition at line 45 of file VtkAddFilterDialog.h.

Referenced by on_buttonBox_accepted().

◆ _pipeline

VtkVisPipeline& VtkAddFilterDialog::_pipeline
private

Definition at line 44 of file VtkAddFilterDialog.h.

Referenced by VtkAddFilterDialog(), and on_buttonBox_accepted().


The documentation for this class was generated from the following files: