OGS
VtkAlgorithmProperties Class Reference

Detailed Description

Contains properties for the visualization of objects as VtkVisPipelineItems.

Definition at line 137 of file VtkAlgorithmProperties.h.

#include <VtkAlgorithmProperties.h>

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

Signals

void ScalarVisibilityChanged (bool on)
 

Public Member Functions

 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.
 
virtual void SetUserProperty (QString name, QVariant value)
 Sets a user property. This should be implemented by subclasses.
 
QVariant GetUserProperty (QString name) const
 Returns the value of a user property.
 
virtual void SetUserVectorProperty (QString name, QList< QVariant > values)
 Sets a vector user property. This should be implemented by subclasses.
 
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.
 

Protected Attributes

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

◆ VtkAlgorithmProperties()

VtkAlgorithmProperties::VtkAlgorithmProperties ( QObject * parent = nullptr)
explicit

Constructor (sets default values)

Definition at line 26 of file VtkAlgorithmProperties.cpp.

27 : QObject(parent)
28{
29 _property = vtkProperty::New();
30 _texture = nullptr;
31 _scalarVisibility = true;
32 _algorithmUserProperties = new QMap<QString, QVariant>;
33 _algorithmUserVectorProperties = new QMap<QString, QList<QVariant>>;
35 _removable = true;
36}
QMap< QString, QList< QVariant > > * _algorithmUserVectorProperties
QMap< QString, QVariant > * _algorithmUserProperties

References _activeAttributeName, _algorithmUserProperties, _algorithmUserVectorProperties, _property, _removable, _scalarVisibility, and _texture.

◆ ~VtkAlgorithmProperties()

VtkAlgorithmProperties::~VtkAlgorithmProperties ( )
override

Definition at line 38 of file VtkAlgorithmProperties.cpp.

39{
40 _property->Delete();
41 if (_texture != nullptr)
42 {
43 _texture->Delete();
44 }
45
46 for (auto& row : _lut)
47 {
48 row.second->Delete();
49 }
52}
std::map< QString, vtkLookupTable * > _lut

References _algorithmUserProperties, _algorithmUserVectorProperties, _lut, _property, and _texture.

Member Function Documentation

◆ GetActiveAttribute()

QString VtkAlgorithmProperties::GetActiveAttribute ( ) const
inline

Returns the desired active attribute.

Definition at line 215 of file VtkAlgorithmProperties.h.

215{ return _activeAttributeName; }

References _activeAttributeName.

Referenced by VtkVisPointSetItem::GetActiveAttribute(), VtkCompositeColorByHeightFilter::init(), and VtkVisPointSetItem::Initialize().

◆ GetAlgorithmUserProperties()

QMap< QString, QVariant > * VtkAlgorithmProperties::GetAlgorithmUserProperties ( ) const
inline

Returns a map of user properties.

Definition at line 184 of file VtkAlgorithmProperties.h.

184 {
186 }

References _algorithmUserProperties.

Referenced by VtkVisTabWidget::buildProportiesDialog().

◆ GetAlgorithmUserVectorProperties()

QMap< QString, QList< QVariant > > * VtkAlgorithmProperties::GetAlgorithmUserVectorProperties ( ) const
inline

Returns a map of vector user properties.

Definition at line 189 of file VtkAlgorithmProperties.h.

189 {
191 }

References _algorithmUserVectorProperties.

Referenced by VtkVisTabWidget::buildProportiesDialog().

◆ GetLookupTable()

vtkLookupTable * VtkAlgorithmProperties::GetLookupTable ( const QString & array_name)

Returns the colour lookup table (if one has been assigned).

Definition at line 54 of file VtkAlgorithmProperties.cpp.

56{
57 auto it = _lut.find(array_name);
58 if (it != _lut.end())
59 {
60 return it->second;
61 }
62
63 return nullptr;
64}

References _lut.

Referenced by VtkVisPointSetItem::SetActiveAttribute(), VtkCompositeImageToCylindersFilter::SetUserProperty(), and VtkCompositeImageToCylindersFilter::SetUserVectorProperty().

◆ GetName()

QString VtkAlgorithmProperties::GetName ( ) const
inline

Returns the name. This is set to the file path if it is a source algorithm.

Definition at line 175 of file VtkAlgorithmProperties.h.

175{ return _name; }

References _name.

◆ GetProperties()

vtkProperty * VtkAlgorithmProperties::GetProperties ( ) const
inline

◆ GetScalarVisibility()

bool VtkAlgorithmProperties::GetScalarVisibility ( ) const
inline

Returns the scalar visibility.

Definition at line 169 of file VtkAlgorithmProperties.h.

169{ return _scalarVisibility; }

References _scalarVisibility.

Referenced by VtkVisPointSetItem::Initialize(), and VtkVisPointSetItem::setVtkProperties().

◆ GetTexture()

vtkTexture * VtkAlgorithmProperties::GetTexture ( )
inline

Returns a texture (if one has been assigned).

Definition at line 151 of file VtkAlgorithmProperties.h.

151{ return _texture; }

References _texture.

Referenced by VtkVisPointSetItem::Initialize(), VtkTextureOnSurfaceFilter::RequestData(), and VtkVisPointSetItem::setVtkProperties().

◆ GetUserProperty()

QVariant VtkAlgorithmProperties::GetUserProperty ( QString name) const

Returns the value of a user property.

Definition at line 109 of file VtkAlgorithmProperties.cpp.

110{
111 if (this->_algorithmUserProperties->contains(name))
112 {
113 return this->_algorithmUserProperties->value(name);
114 }
115
116 ERR("Not a valid property: {:s}", name.toStdString());
117 return QVariant();
118}
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:45

References _algorithmUserProperties, and ERR().

Referenced by VtkCompositeImageToPointCloudFilter::SetUserProperty(), and VtkCompositeContourFilter::SetUserVectorProperty().

◆ GetUserVectorProperty()

QList< QVariant > VtkAlgorithmProperties::GetUserVectorProperty ( QString name) const

Returns a list of values of a vector user property.

Definition at line 120 of file VtkAlgorithmProperties.cpp.

122{
123 if (this->_algorithmUserVectorProperties->contains(name))
124 {
125 return this->_algorithmUserVectorProperties->value(name);
126 }
127
128 ERR("Not a valid property: {:s}", name.toStdString());
129 return QList<QVariant>();
130}

References _algorithmUserVectorProperties, and ERR().

◆ IsRemovable()

bool VtkAlgorithmProperties::IsRemovable ( ) const
inline

Is this algorithm removable from the pipeline (view).

Definition at line 181 of file VtkAlgorithmProperties.h.

181{ return _removable; }

References _removable.

Referenced by VtkVisPipelineView::contextMenuEvent().

◆ RemoveLookupTable()

void VtkAlgorithmProperties::RemoveLookupTable ( const QString & array_name)

Removes the lookup table for the given scalar.

Definition at line 66 of file VtkAlgorithmProperties.cpp.

67{
68 auto it = _lut.find(array_name);
69 if (it != _lut.end())
70 {
71 it->second->Delete();
72 _lut.erase(it);
73 }
74}

References _lut.

Referenced by VtkVisTabWidget::on_arrayResetPushButton_clicked(), and SetLookUpTable().

◆ ScalarVisibilityChanged

void VtkAlgorithmProperties::ScalarVisibilityChanged ( bool on)
signal

Referenced by SetScalarVisibility().

◆ SetActiveAttribute()

void VtkAlgorithmProperties::SetActiveAttribute ( QString name)

Set the active attribute.

Definition at line 132 of file VtkAlgorithmProperties.cpp.

133{
134 if (name.contains("Solid Color") || name.contains("P-TextureCoordinates"))
135 {
136 SetScalarVisibility(false);
137 }
138 else
139 {
141 }
143}
void SetScalarVisibility(bool on)
Sets the scalar visibility.

References _activeAttributeName, and SetScalarVisibility().

Referenced by VtkVisPointSetItem::SetActiveAttribute().

◆ SetLookUpTable() [1/2]

void VtkAlgorithmProperties::SetLookUpTable ( const QString & array_name,
const QString & filename )

Loads a predefined color lookup table from a file for the specified scalar array.

Definition at line 89 of file VtkAlgorithmProperties.cpp.

91{
93 if (FileIO::XmlLutReader::readFromFile(filename, lut))
94 {
96 colorLookupTable->setLookupTable(lut);
97 SetLookUpTable(array_name, colorLookupTable);
98 }
99 else
100 ERR("Error reading color look-up table.");
101}
static bool readFromFile(const QString &fileName, DataHolderLib::ColorLookupTable &lut)
void SetLookUpTable(const QString &array_name, vtkLookupTable *lut)
Sets a colour lookup table for the given scalar array of the VtkVisPipelineItem.
Calculates and stores a colour lookup table.
void setLookupTable(DataHolderLib::ColorLookupTable const &lut)
Imports settings of OGS lookup table class.
static VtkColorLookupTable * New()
Create new objects with New() because of VTKs object reference counting.

References ERR(), VtkColorLookupTable::New(), FileIO::XmlLutReader::readFromFile(), SetLookUpTable(), and VtkColorLookupTable::setLookupTable().

◆ SetLookUpTable() [2/2]

void VtkAlgorithmProperties::SetLookUpTable ( const QString & array_name,
vtkLookupTable * lut )

Sets a colour lookup table for the given scalar array of the VtkVisPipelineItem.

Definition at line 76 of file VtkAlgorithmProperties.cpp.

78{
79 lut->Build();
80
81 if (array_name.length() > 0)
82 {
83 this->RemoveLookupTable(array_name);
84 _lut.insert(std::pair<QString, vtkLookupTable*>(array_name, lut));
85 _activeAttributeName = array_name;
86 }
87}
void RemoveLookupTable(const QString &array_name)
Removes the lookup table for the given scalar.

References _activeAttributeName, _lut, and RemoveLookupTable().

Referenced by VtkVisPipelineView::addColorTable(), VtkCompositeColorByHeightFilter::init(), VtkCompositeElementSelectionFilter::init(), VtkCompositeImageToCylindersFilter::init(), VtkVisPointSetItem::SetActiveAttribute(), and SetLookUpTable().

◆ SetName()

void VtkAlgorithmProperties::SetName ( QString name)
inline

◆ SetScalarVisibility()

void VtkAlgorithmProperties::SetScalarVisibility ( bool on)

Sets the scalar visibility.

Definition at line 103 of file VtkAlgorithmProperties.cpp.

104{
107}
void ScalarVisibilityChanged(bool on)

References _scalarVisibility, and ScalarVisibilityChanged().

Referenced by SetActiveAttribute(), and VtkVisPointSetItem::setVtkProperties().

◆ SetTexture()

void VtkAlgorithmProperties::SetTexture ( vtkTexture * t)
inline

Sets a texture for the VtkVisPipelineItem.

Definition at line 154 of file VtkAlgorithmProperties.h.

154{ _texture = t; }

References _texture.

Referenced by VtkBGImageSource::SetRaster(), and VtkTextureOnSurfaceFilter::SetRaster().

◆ SetUserProperty()

virtual void VtkAlgorithmProperties::SetUserProperty ( QString name,
QVariant value )
inlinevirtual

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

Reimplemented in VtkAppendArrayFilter, VtkBGImageSource, VtkColorByHeightFilter, VtkCompositeColorByHeightFilter, VtkCompositeColormapToImageFilter, VtkCompositeContourFilter, VtkCompositeGeoObjectFilter, VtkCompositeImageToCylindersFilter, VtkCompositeImageToPointCloudFilter, VtkCompositeImageToSurfacePointsFilter, VtkCompositeLineToTubeFilter, VtkCompositePointToGlyphFilter, VtkCompositeTextureOnSurfaceFilter, VtkCompositeThresholdFilter, VtkGeoImageSource, VtkImageDataToLinePolyDataFilter, VtkPointsSource, VtkPolylinesSource, VtkStationSource, VtkSurfacesSource, and VtkTextureOnSurfaceFilter.

Definition at line 194 of file VtkAlgorithmProperties.h.

195 {
196 (*_algorithmUserProperties)[name] = value;
197 }

Referenced by VtkCompositeGeoObjectFilter::init(), VtkAlgorithmPropertyCheckbox::setNewValue(), VtkAlgorithmPropertyLineEdit::setNewValue(), VtkBGImageSource::SetUserProperty(), VtkCompositeColormapToImageFilter::SetUserProperty(), VtkCompositeContourFilter::SetUserProperty(), VtkCompositeImageToCylindersFilter::SetUserProperty(), VtkCompositeImageToPointCloudFilter::SetUserProperty(), VtkCompositeImageToSurfacePointsFilter::SetUserProperty(), VtkCompositeLineToTubeFilter::SetUserProperty(), VtkCompositePointToGlyphFilter::SetUserProperty(), VtkCompositeTextureOnSurfaceFilter::SetUserProperty(), VtkCompositeThresholdFilter::SetUserProperty(), VtkSurfacesSource::SetUserProperty(), and VtkTextureOnSurfaceFilter::SetUserProperty().

◆ SetUserVectorProperty()

Member Data Documentation

◆ _activeAttributeName

QString VtkAlgorithmProperties::_activeAttributeName
protected

◆ _algorithmUserProperties

QMap<QString, QVariant>* VtkAlgorithmProperties::_algorithmUserProperties
protected

◆ _algorithmUserVectorProperties

QMap<QString, QList<QVariant> >* VtkAlgorithmProperties::_algorithmUserVectorProperties
protected

◆ _lut

std::map<QString, vtkLookupTable*> VtkAlgorithmProperties::_lut
protected

◆ _name

QString VtkAlgorithmProperties::_name
protected

Definition at line 229 of file VtkAlgorithmProperties.h.

Referenced by GetName(), and SetName().

◆ _property

vtkProperty* VtkAlgorithmProperties::_property
protected

◆ _removable

◆ _scalarVisibility

bool VtkAlgorithmProperties::_scalarVisibility
protected

◆ _texture

vtkTexture* VtkAlgorithmProperties::_texture
protected

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