Workspace 6.21.5
Public Member Functions | List of all members
NodeTextureMapper Class Reference

A NodeTextureMapper uses the texture coordinates stored in the state data associated with a node to lookup and return a value stored in a matrix of scalar data (texture).

#include <Mesh/DataStructures/nodetexturemapper.h>

Inheritance diagram for NodeTextureMapper:
[legend]

Public Member Functions

 NodeTextureMapper ()
 
 NodeTextureMapper (const NodeTextureMapper &mapper)
 
 ~NodeTextureMapper () override
 
bool canSerialize () const override
 
NodeTextureMapperclone () const override
 
Application::Memento::DatacreateMementoData (const MeshModelInterface &model) const override
 
const QString & getStateNameR () const
 
const QString & getStateNameS () const
 
const QString & getStateNameT () const
 
const DataAnalysis::Array3dScalargetTextureData () const
 
double getValue (const NodeHandle &node, Application::Memento::Data &mementoData) const override
 
bool load (const DataExecution::SerializedItem &item) override
 
NodeTextureMapperoperator= (const NodeTextureMapper &mapper)
 
bool save (DataExecution::SerializedItem &item) const override
 
void setStateNameR (const QString &name)
 
void setStateNameS (const QString &name)
 
void setStateNameT (const QString &name)
 
void setTextureData (const DataAnalysis::Array3dScalar *data)
 
- Public Member Functions inherited from NodeMapper
bool canSerialize () const override
 
NodeMapperclone () const override=0
 
virtual Application::Memento::DatacreateMementoData (const MeshModelInterface &model) const =0
 
virtual double getValue (const NodeHandle &node, Application::Memento::Data &mementoData) const =0
 
bool load (const DataExecution::SerializedItem &item) override
 
void logText (const QString &msg) const
 
bool save (DataExecution::SerializedItem &item) const override
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()=default
 
virtual Clonableclone () const =0
 
- Public Member Functions inherited from Serialize
virtual ~Serialize ()=default
 
virtual bool canSerialize () const =0
 
virtual bool load (const SerializedItem &item)=0
 
virtual bool save (SerializedItem &item) const =0
 

Constructor & Destructor Documentation

◆ NodeTextureMapper() [1/2]

The mapper is constructed with no state name set. The vector mapping defaults to mapping the vector magnitude.

See also
setStateName()

◆ NodeTextureMapper() [2/2]

NodeTextureMapper ( const NodeTextureMapper mapper)

◆ ~NodeTextureMapper()

~NodeTextureMapper ( )
override

Member Function Documentation

◆ canSerialize()

bool canSerialize ( ) const
overridevirtual
Returns
True if this object can be serialized.

For objects that can be serialized, the save and load functions will be used to do the serialization. If this function returns false, both load() and save() must also return false.

Reimplemented from NodeMapper.

◆ clone()

NodeTextureMapper * clone ( ) const
overridevirtual
Returns
A clone of this object.
Note
Subclasses would normally return their own type rather than the Clonable type. The C++ language rules allow a more derived type to be returned from a virtual function and the compiler will still treat it as a valid override.

Implements NodeMapper.

◆ createMementoData()

Application::Memento::Data * createMementoData ( const MeshModelInterface model) const
overridevirtual
Parameters
modelThe model that will be used for mapping nodes to values.
Returns
A memento object which client code cannot do anything useful with except pass it around. The memento is ultimately only useful to the getValue() function. It holds internal data the mapper will use to perform the required mapping.
Note
The memento can be considered valid for as long as model is not modified and the state name of the mapper remains the same. As soon as the state name or anything in model is changed, the caller should obtain a new memento.

Implements NodeMapper.

◆ getStateNameR()

const QString & getStateNameR ( ) const
Returns
The name of the state to map to a value.
See also
setStateNameR()
getStateNameS()
getStateNameT()

◆ getStateNameS()

const QString & getStateNameS ( ) const
Returns
The name of the state to map to a value.
See also
setStateNameS()
getStateNameT()
getStateNameR()

◆ getStateNameT()

const QString & getStateNameT ( ) const
Returns
The name of the state to map to a value.
See also
setStateNameT()
getStateNameS()
getStateNameR()

◆ getTextureData()

const Array3dScalar * getTextureData ( ) const

◆ getValue()

double getValue ( const NodeHandle node,
Application::Memento::Data mementoData 
) const
overridevirtual
Parameters
nodeThe node whose state should be mapped to a value.
mementoDataThe data from the memento created by a previous call to createMementoData(). It is used internally by this function to work out what value needs to be returned.
Returns
The value of the requested state from this node. If mementoData is invalid, which can happen if the requested node state is not in the model passed to createMementoData(), then this function returns 0.

Implements NodeMapper.

◆ load()

bool load ( const DataExecution::SerializedItem item)
overridevirtual
Parameters
itemSupplies the state to be loaded into this object.

This function will load the state of this object from item. For many object types, this is most easily implemented in terms of the object's input operator (>>).

It would be reasonable for subclass implementations to assume that the data provided in item is in the same form as would have been saved from a call to save.

Returns
If the state of the object could not be loaded, the function returns false. A return value of true implies that the object state was successfully loaded. If canSerialize() returns false, this function must do nothing except return false as well.

Reimplemented from NodeMapper.

◆ operator=()

NodeTextureMapper & operator= ( const NodeTextureMapper mapper)

◆ save()

bool save ( DataExecution::SerializedItem item) const
overridevirtual
Parameters
itemWhere to save the state of this object.

This function will serialise the object by saving it to item. For most object types, this is most easily implemented in terms of the object's output operator (<<).

It is allowable for an object to only serialize part of itself. This would be useful if the data it represents has a set of defaults and only those values different to the defaults need to be serialized. Such an implementation then needs to be careful how it handles the complimentary load member function.

Returns
If an object could not be serialised or if the underlying object type does not support serialisation, this function should return false. A return value of true implies that the object was successfully saved to item. If canSerialize() returns false, this function must do nothing except return false as well.

Reimplemented from NodeMapper.

◆ setStateNameR()

void setStateNameR ( const QString &  name)
Parameters
nameThe name of the state to be mapped to be used as the R coordinate to lookup a value in the vector dataset provided.
See also
getStateNameR()
setStateNameS()
setStateNameT()

◆ setStateNameS()

void setStateNameS ( const QString &  name)
Parameters
nameThe name of the state to be mapped to be used as the S coordinate to lookup a value in the vector dataset provided.
See also
getStateNameS()
setStateNameT()
setStateNameR()

◆ setStateNameT()

void setStateNameT ( const QString &  name)
Parameters
nameThe name of the state to be mapped to be used as the T coordinate to lookup a value in the vector dataset provided.
See also
getStateNameT()
setStateNameS()
setStateNameR()

◆ setTextureData()

void setTextureData ( const DataAnalysis::Array3dScalar data)