OGS
VtkCompositeContourFilter Class Reference

Detailed Description

Visualisation of contour-lines/-planes within dense scalar fields. In init() the threshold is first set to double min / max values. Set the threshold later on via SetUserVectorProperty() to the actual data range.

Definition at line 22 of file VtkCompositeContourFilter.h.

#include <VtkCompositeContourFilter.h>

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

Public Member Functions

 VtkCompositeContourFilter (vtkAlgorithm *inputAlgorithm)
 
 ~VtkCompositeContourFilter () override
 
void init () override
 
void SetUserProperty (QString name, QVariant value) override
 Sets a user property. This should be implemented by subclasses.
 
void SetUserVectorProperty (QString name, QList< QVariant > values) override
 Sets a vector user property. This should be implemented by subclasses.
 
- Public Member Functions inherited from VtkCompositeFilter
 VtkCompositeFilter (vtkAlgorithm *inputAlgorithm)
 Constructor.
 
 ~VtkCompositeFilter () override
 Destructor.
 
int GetInputDataObjectType () const
 
int GetOutputDataObjectType () const
 
vtkAlgorithm * GetOutputAlgorithm () const
 
- Public Member Functions inherited from VtkAlgorithmProperties
 VtkAlgorithmProperties (QObject *parent=nullptr)
 Constructor (sets default values)
 
 ~VtkAlgorithmProperties () override
 
vtkProperty * GetProperties () const
 Returns the vtk properties.
 
vtkTexture * GetTexture ()
 Returns a texture (if one has been assigned).
 
void SetTexture (vtkTexture *t)
 Sets a texture for the VtkVisPipelineItem.
 
vtkLookupTable * GetLookupTable (const QString &array_name)
 Returns the colour lookup table (if one has been assigned).
 
void RemoveLookupTable (const QString &array_name)
 Removes the lookup table for the given scalar.
 
void SetLookUpTable (const QString &array_name, vtkLookupTable *lut)
 Sets a colour lookup table for the given scalar array of the VtkVisPipelineItem.
 
void SetLookUpTable (const QString &array_name, const QString &filename)
 Loads a predefined color lookup table from a file for the specified scalar array.
 
bool GetScalarVisibility () const
 Returns the scalar visibility.
 
void SetScalarVisibility (bool on)
 Sets the scalar visibility.
 
QString GetName () const
 Returns the name. This is set to the file path if it is a source algorithm.
 
void SetName (QString name)
 Sets the name.
 
bool IsRemovable () const
 Is this algorithm removable from the pipeline (view).
 
QMap< QString, QVariant > * GetAlgorithmUserProperties () const
 Returns a map of user properties.
 
QMap< QString, QList< QVariant > > * GetAlgorithmUserVectorProperties () const
 Returns a map of vector user properties.
 
QVariant GetUserProperty (QString name) const
 Returns the value of a user property.
 
QList< QVariant > GetUserVectorProperty (QString name) const
 Returns a list of values of a vector user property.
 
void SetActiveAttribute (QString name)
 Set the active attribute.
 
QString GetActiveAttribute () const
 Returns the desired active attribute.
 

Additional Inherited Members

- Signals inherited from VtkAlgorithmProperties
void ScalarVisibilityChanged (bool on)
 
- Protected Member Functions inherited from VtkCompositeFilter
double GetInitialRadius () const
 Calculates a 1/200th of the largest extension of the bounding box (this is used as default radius for various filters)
 
- Protected Attributes inherited from VtkCompositeFilter
int _inputDataObjectType
 
int _outputDataObjectType
 
vtkAlgorithm * _inputAlgorithm
 
vtkAlgorithm * _outputAlgorithm
 
- Protected Attributes inherited from VtkAlgorithmProperties
vtkProperty * _property
 
vtkTexture * _texture
 
bool _scalarVisibility
 
std::map< QString, vtkLookupTable * > _lut
 
QString _name
 
QString _activeAttributeName
 
bool _removable
 
QMap< QString, QVariant > * _algorithmUserProperties
 
QMap< QString, QList< QVariant > > * _algorithmUserVectorProperties
 

Constructor & Destructor Documentation

◆ VtkCompositeContourFilter()

VtkCompositeContourFilter::VtkCompositeContourFilter ( vtkAlgorithm * inputAlgorithm)
explicit

Definition at line 25 of file VtkCompositeContourFilter.cpp.

27 : VtkCompositeFilter(inputAlgorithm)
28{
29 this->init();
30}
VtkCompositeFilter(vtkAlgorithm *inputAlgorithm)
Constructor.

References init().

◆ ~VtkCompositeContourFilter()

VtkCompositeContourFilter::~VtkCompositeContourFilter ( )
overridedefault

Member Function Documentation

◆ init()

void VtkCompositeContourFilter::init ( )
overridevirtual

Implements VtkCompositeFilter.

Definition at line 34 of file VtkCompositeContourFilter.cpp.

35{
36 // Set meta information about input and output data types
37 this->_inputDataObjectType = VTK_UNSTRUCTURED_GRID; // VTK_DATA_SET;
38 this->_outputDataObjectType = VTK_UNSTRUCTURED_GRID;
39
40 // Because this is the only filter here we cannot use vtkSmartPointer
41 vtkContourFilter* contour = vtkContourFilter::New();
42 contour->SetInputConnection(_inputAlgorithm->GetOutputPort());
43
44 // Getting the scalar range from the active point data scalar of the input
45 // algorithm This assumes that we do not want to contour on cell data.
46 double range[2];
47 vtkDataSet* dataSet =
48 vtkDataSet::SafeDownCast(_inputAlgorithm->GetOutputDataObject(0));
49 if (dataSet)
50 {
51 vtkPointData* pointData = dataSet->GetPointData();
52 if (pointData)
53 {
54 pointData->GetScalars()->GetRange(range);
55 }
56 }
57 else
58 {
59 // Setting the range to min / max values, this will result in a "bad
60 // table range" vtk warning.
61 range[0] = std::numeric_limits<double>::lowest();
62 range[1] = std::numeric_limits<double>::max();
63 }
64
65 // Sets a filter vector property which will be user editable
66 contour->GenerateValues(10, range[0], range[1]);
67
68 // Create a list for the ThresholdBetween (vector) property.
69 QList<QVariant> contourRangeList;
70 // Insert the values (same values as above)
71 contourRangeList.push_back(range[0]);
72 contourRangeList.push_back(range[1]);
73 // Put that list in the property map
74 (*_algorithmUserVectorProperties)["Range"] = contourRangeList;
75
76 // Make a new entry in the property map for the "Number of Values" property
77 (*_algorithmUserProperties)["Number of Contours"] = 10;
78
79 // The threshold filter is last one and so it is also the _outputAlgorithm
80 _outputAlgorithm = contour;
81}
vtkAlgorithm * _outputAlgorithm
vtkAlgorithm * _inputAlgorithm

References VtkCompositeFilter::_inputAlgorithm, VtkCompositeFilter::_inputDataObjectType, VtkCompositeFilter::_outputAlgorithm, and VtkCompositeFilter::_outputDataObjectType.

Referenced by VtkCompositeContourFilter().

◆ SetUserProperty()

void VtkCompositeContourFilter::SetUserProperty ( QString name,
QVariant value )
overridevirtual

Sets a user property. This should be implemented by subclasses.

Reimplemented from VtkAlgorithmProperties.

Definition at line 83 of file VtkCompositeContourFilter.cpp.

84{
86
87 // Use the same name as in init()
88 if (name.compare("Number of Contours") == 0)
89 {
90 static_cast<vtkContourFilter*>(_outputAlgorithm)
91 ->SetNumberOfContours(value.toInt());
92 }
93}
virtual void SetUserProperty(QString name, QVariant value)
Sets a user property. This should be implemented by subclasses.

References VtkCompositeFilter::_outputAlgorithm, and VtkAlgorithmProperties::SetUserProperty().

◆ SetUserVectorProperty()

void VtkCompositeContourFilter::SetUserVectorProperty ( QString name,
QList< QVariant > values )
overridevirtual

Sets a vector user property. This should be implemented by subclasses.

Reimplemented from VtkAlgorithmProperties.

Definition at line 95 of file VtkCompositeContourFilter.cpp.

97{
99
100 // Use the same name as in init()
101 if (name.compare("Range") == 0)
102 {
103 static_cast<vtkContourFilter*>(_outputAlgorithm)
104 ->GenerateValues(
105 VtkAlgorithmProperties::GetUserProperty("Number of Contours")
106 .toInt(),
107 values[0].toDouble(),
108 values[1].toDouble());
109 }
110}
virtual void SetUserVectorProperty(QString name, QList< QVariant > values)
Sets a vector user property. This should be implemented by subclasses.
QVariant GetUserProperty(QString name) const
Returns the value of a user property.

References VtkCompositeFilter::_outputAlgorithm, VtkAlgorithmProperties::GetUserProperty(), and VtkAlgorithmProperties::SetUserVectorProperty().


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