OGS
VtkAlgorithmProperties Class Reference

Detailed Description

Contains properties for the visualization of objects as VtkVisPipelineItems.

Definition at line 126 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 15 of file VtkAlgorithmProperties.cpp.

16 : QObject(parent)
17{
18 _property = vtkProperty::New();
19 _texture = nullptr;
20 _scalarVisibility = true;
21 _algorithmUserProperties = new QMap<QString, QVariant>;
22 _algorithmUserVectorProperties = new QMap<QString, QList<QVariant>>;
24 _removable = true;
25}
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 27 of file VtkAlgorithmProperties.cpp.

28{
29 _property->Delete();
30 if (_texture != nullptr)
31 {
32 _texture->Delete();
33 }
34
35 for (auto& row : _lut)
36 {
37 row.second->Delete();
38 }
41}
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 204 of file VtkAlgorithmProperties.h.

204{ return _activeAttributeName; }

References _activeAttributeName.

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

◆ GetAlgorithmUserProperties()

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

Returns a map of user properties.

Definition at line 173 of file VtkAlgorithmProperties.h.

173 {
175 }

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 178 of file VtkAlgorithmProperties.h.

178 {
180 }

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 43 of file VtkAlgorithmProperties.cpp.

45{
46 auto it = _lut.find(array_name);
47 if (it != _lut.end())
48 {
49 return it->second;
50 }
51
52 return nullptr;
53}

References _lut.

Referenced by 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 164 of file VtkAlgorithmProperties.h.

164{ return _name; }

References _name.

◆ GetProperties()

vtkProperty * VtkAlgorithmProperties::GetProperties ( ) const
inline

◆ GetScalarVisibility()

bool VtkAlgorithmProperties::GetScalarVisibility ( ) const
inline

Returns the scalar visibility.

Definition at line 158 of file VtkAlgorithmProperties.h.

158{ 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 140 of file VtkAlgorithmProperties.h.

140{ 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 98 of file VtkAlgorithmProperties.cpp.

99{
100 if (this->_algorithmUserProperties->contains(name))
101 {
102 return this->_algorithmUserProperties->value(name);
103 }
104
105 ERR("Not a valid property: {:s}", name.toStdString());
106 return QVariant();
107}
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40

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 109 of file VtkAlgorithmProperties.cpp.

111{
112 if (this->_algorithmUserVectorProperties->contains(name))
113 {
114 return this->_algorithmUserVectorProperties->value(name);
115 }
116
117 ERR("Not a valid property: {:s}", name.toStdString());
118 return QList<QVariant>();
119}

References _algorithmUserVectorProperties, and ERR().

◆ IsRemovable()

bool VtkAlgorithmProperties::IsRemovable ( ) const
inline

Is this algorithm removable from the pipeline (view).

Definition at line 170 of file VtkAlgorithmProperties.h.

170{ 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 55 of file VtkAlgorithmProperties.cpp.

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

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 121 of file VtkAlgorithmProperties.cpp.

122{
123 if (name.contains("Solid Color") || name.contains("P-TextureCoordinates"))
124 {
125 SetScalarVisibility(false);
126 }
127 else
128 {
130 }
132}
void SetScalarVisibility(bool on)
Sets the scalar visibility.

References _activeAttributeName, and SetScalarVisibility().

◆ 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 78 of file VtkAlgorithmProperties.cpp.

80{
81 DataHolderLib::ColorLookupTable lut;
82 if (FileIO::XmlLutReader::readFromFile(filename, lut))
83 {
84 VtkColorLookupTable* colorLookupTable = VtkColorLookupTable::New();
85 colorLookupTable->setLookupTable(lut);
86 SetLookUpTable(array_name, colorLookupTable);
87 }
88 else
89 ERR("Error reading color look-up table.");
90}
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.
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 65 of file VtkAlgorithmProperties.cpp.

67{
68 lut->Build();
69
70 if (array_name.length() > 0)
71 {
72 this->RemoveLookupTable(array_name);
73 _lut.insert(std::pair<QString, vtkLookupTable*>(array_name, lut));
74 _activeAttributeName = array_name;
75 }
76}
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(), and SetLookUpTable().

◆ SetName()

void VtkAlgorithmProperties::SetName ( QString name)
inline

◆ SetScalarVisibility()

void VtkAlgorithmProperties::SetScalarVisibility ( bool on)

Sets the scalar visibility.

Definition at line 92 of file VtkAlgorithmProperties.cpp.

93{
96}
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 143 of file VtkAlgorithmProperties.h.

143{ _texture = t; }

References _texture.

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

◆ SetUserProperty()

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

◆ 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 218 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: