OGS
VtkCompositeFilter Class Referenceabstract

Detailed Description

Is used to combine several filter in one VtkVisPipelineItem. You can use vtk filter and custom filter. To subclass this you have to implement the init() function. There you combine the filters. Make sure to set the members _inputDataObjectType, _outputDataObjectType and _outputAlgorithm. Make also sure to implement VtkAlgorithmProperties::SetUserProperty() and VtkAlgorithmProperties::SetUserVectorProperty().

Allocate vtk objects inside init() with vtkSmartPointer except for the last filter. This filter must also be set to _outputAlgorithm, e.g.

MyVtkFilter* lastFilter = MyVtkFilter::New();
...(do something here)
_outputAlgorithm = lastFilter;

Create user properties with ogsUserPropertyMacro or ogsUserVecxPropertyMacro and initialize these properties inside the constructor with this->Set[Property Name](value). See VtkCompositeThresholdFilter for an example.

Definition at line 41 of file VtkCompositeFilter.h.

#include <VtkCompositeFilter.h>

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

Public Member Functions

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

Protected Member Functions

double GetInitialRadius () const
 Calculates a 1/200th of the largest extension of the bounding box (this is used as default radius for various filters) More...
 
virtual void init ()=0
 

Protected Attributes

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
 

Additional Inherited Members

- Signals inherited from VtkAlgorithmProperties
void ScalarVisibilityChanged (bool on)
 

Constructor & Destructor Documentation

◆ VtkCompositeFilter()

VtkCompositeFilter::VtkCompositeFilter ( vtkAlgorithm *  inputAlgorithm)
explicit

Constructor.

Parameters
inputAlgorithmThe algorithm to attach this filter to.

Definition at line 25 of file VtkCompositeFilter.cpp.

28  _inputAlgorithm(inputAlgorithm),
29  _outputAlgorithm(nullptr)
30 {
31 }
vtkAlgorithm * _outputAlgorithm
vtkAlgorithm * _inputAlgorithm

◆ ~VtkCompositeFilter()

VtkCompositeFilter::~VtkCompositeFilter ( )
override

Destructor.

Definition at line 33 of file VtkCompositeFilter.cpp.

34 {
35  _outputAlgorithm->Delete();
36 }

References _outputAlgorithm.

Member Function Documentation

◆ GetInitialRadius()

double VtkCompositeFilter::GetInitialRadius ( ) const
protected

Calculates a 1/200th of the largest extension of the bounding box (this is used as default radius for various filters)

Definition at line 38 of file VtkCompositeFilter.cpp.

39 {
40  double bounding_box[6];
41  static_cast<vtkPolyData*>(this->_inputAlgorithm->GetOutputDataObject(0))
42  ->GetBounds(bounding_box);
43  double x_diff = fabs(bounding_box[0] - bounding_box[1]);
44  double y_diff = fabs(bounding_box[2] - bounding_box[3]);
45  double z_diff = fabs(bounding_box[4] - bounding_box[5]);
46 
47  double max = (x_diff == 0) ? 1 : x_diff;
48  max = (max > y_diff) ? max : y_diff;
49  max = (max > z_diff) ? max : z_diff;
50 
51  return max / 200.0;
52 }

References _inputAlgorithm.

Referenced by VtkCompositeGeoObjectFilter::init(), VtkCompositeLineToTubeFilter::init(), VtkCompositeNodeSelectionFilter::init(), and VtkCompositePointToGlyphFilter::init().

◆ GetInputDataObjectType()

int VtkCompositeFilter::GetInputDataObjectType ( ) const
inline
Returns
the type of the data input. Can be compared with
  • VTK_POLY_DATA
  • VTK_STRUCTURED_POINTS
  • VTK_STRUCTURED_GRID
  • VTK_RECTILINEAR_GRID
  • VTK_UNSTRUCTURED_GRID
  • VTK_IMAGE_DATA
  • VTK_DATA_SET

Definition at line 60 of file VtkCompositeFilter.h.

60 { return _inputDataObjectType; }

References _inputDataObjectType.

◆ GetOutputAlgorithm()

vtkAlgorithm* VtkCompositeFilter::GetOutputAlgorithm ( ) const
inline
Returns
the last algorithm in this composite filter.

Definition at line 66 of file VtkCompositeFilter.h.

66 { return _outputAlgorithm; }

References _outputAlgorithm.

Referenced by VtkVisPipelineItem::VtkVisPipelineItem(), and VtkCompositeGeoObjectFilter::init().

◆ GetOutputDataObjectType()

int VtkCompositeFilter::GetOutputDataObjectType ( ) const
inline
Returns
the type of the data output.

Definition at line 63 of file VtkCompositeFilter.h.

63 { return _outputDataObjectType; }

References _outputDataObjectType.

◆ init()

Member Data Documentation

◆ _inputAlgorithm

◆ _inputDataObjectType

◆ _outputAlgorithm

◆ _outputDataObjectType


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