Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::TFPrimitiveSet Class Reference

data structure managing multiple TFPrimitives More...

#include <inviwo/core/datastructures/tfprimitiveset.h>

Inheritance diagram for inviwo::TFPrimitiveSet:

Public Types

using const_iterator
using const_transform_t = const TFPrimitive& (*)(const TFPrimitive*)
using iterator
using transform_t = TFPrimitive& (*)(TFPrimitive*)

Public Member Functions

TFPrimitiveadd (const dvec2 &pos)
void add (const std::vector< TFPrimitiveData > &primitives)
TFPrimitiveadd (const TFPrimitive &primitive)
TFPrimitiveadd (const TFPrimitiveData &data)
TFPrimitiveadd (double pos, const vec4 &color)
TFPrimitiveadd (double pos, double alpha)
TFPrimitiveback ()
const TFPrimitiveback () const
iterator begin ()
const_iterator begin () const
const_iterator cbegin () const
const_iterator cend () const
void clear ()
bool contains (const TFPrimitive *primitive) const
virtual void deserialize (Deserializer &d) override
bool empty () const
iterator end ()
const_iterator end () const
TFPrimitivefront ()
const TFPrimitivefront () const
std::vector< TFPrimitiveDataget () const
TFPrimitiveget (size_t i)
const TFPrimitiveget (size_t i) const
std::vector< vec4 > getColors () const
std::vector< double > getPositions () const
std::vector< float > getPositionsf () const
dvec2 getRange () const
TFPrimitiveSetType getType () const
std::vector< TFPrimitiveDatagetUnsorted () const
std::pair< std::vector< double >, std::vector< vec4 > > getVectors () const
std::pair< std::vector< float >, std::vector< vec4 > > getVectorsf () const
virtual void interpolateAndStoreColors (std::span< vec4 > data) const
virtual void onTFPrimitiveChange (const TFPrimitive &p) override
TFPrimitiveSet & operator= (const TFPrimitiveSet &rhs)
TFPrimitiveSet & operator= (TFPrimitiveSet &&rhs) noexcept
bool operator== (const std::vector< TFPrimitiveData > &rhs) const
TFPrimitiveoperator[] (size_t i)
const TFPrimitiveoperator[] (size_t i) const
bool remove (const TFPrimitive &primitive)
virtual void serialize (Serializer &s) const override
void set (const_iterator begin, const_iterator end)
void set (std::span< const TFPrimitiveData >)
void setPosition (std::span< TFPrimitive * > primitives, double pos)
void setType (TFPrimitiveSetType type)
size_t size () const
 TFPrimitiveSet (const std::vector< TFPrimitiveData > &values={}, TFPrimitiveSetType type=TFPrimitiveSetType::Relative)
 TFPrimitiveSet (const TFPrimitiveSet &rhs)
 TFPrimitiveSet (TFPrimitiveSet &&rhs) noexcept=default
Public Member Functions inherited from inviwo::Observable< TFPrimitiveSetObserver >
void addObserver (TFPrimitiveSetObserver *observer)
bool isObservedBy (TFPrimitiveSetObserver *observer) const
Observable< TFPrimitiveSetObserver > & operator= (const Observable< TFPrimitiveSetObserver > &other)
void removeObserver (TFPrimitiveSetObserver *observer)
virtual void startBlockingNotifications () override final
virtual void stopBlockingNotifications () override final
Public Member Functions inherited from inviwo::Observer
 Observer (const Observer &other)
 Observer (Observer &&other)
Observer & operator= (const Observer &other)
Observer & operator= (Observer &&other)
void removeObservation (ObservableInterface *observable)
void removeObservations ()
virtual ~Observer ()

Protected Member Functions

TFPrimitiveadd (std::unique_ptr< TFPrimitive > primitive)
vec4 interpolateColor (double t) const
bool remove (std::vector< std::unique_ptr< TFPrimitive > >::iterator it)
virtual std::string_view serializationItemKey () const
virtual std::string_view serializationKey () const
void sort ()
void verifyPoint (const TFPrimitive &primitive) const
void verifyPoint (const TFPrimitiveData &primitive) const
void verifyPoint (double pos) const
Protected Member Functions inherited from inviwo::TFPrimitiveSetObservable
void notifyTFMaskChanged (const TFPrimitiveSet &set, dvec2 mask)
void notifyTFPrimitiveAdded (const TFPrimitiveSet &set, TFPrimitive &p)
void notifyTFPrimitiveChanged (const TFPrimitiveSet &set, const TFPrimitive &p)
void notifyTFPrimitiveRemoved (const TFPrimitiveSet &set, TFPrimitive &p)
void notifyTFTypeChanged (const TFPrimitiveSet &set, TFPrimitiveSetType type)
Protected Member Functions inherited from inviwo::Observable< TFPrimitiveSetObserver >
void forEachObserver (C callback)
Protected Member Functions inherited from inviwo::ObservableInterface
void addObservationHelper (Observer *observer)
virtual void addObserver (Observer *observer)=0
void removeObservationHelper (Observer *observer)
virtual void removeObserver (Observer *observer)=0
Protected Member Functions inherited from inviwo::Observer
void addObservation (ObservableInterface *observable)

Protected Attributes

std::vector< TFPrimitive * > sorted_
std::vector< std::unique_ptr< TFPrimitive > > values_
Protected Attributes inherited from inviwo::Observer
std::unordered_set< ObservableInterface * > observables_

Friends

IVW_CORE_API bool operator!= (const TFPrimitiveSet &lhs, const TFPrimitiveSet &rhs)
IVW_CORE_API bool operator== (const TFPrimitiveSet &lhs, const TFPrimitiveSet &rhs)

Detailed Description

data structure managing multiple TFPrimitives

See also
TFPrimitive

Member Typedef Documentation

◆ const_iterator

using inviwo::TFPrimitiveSet::const_iterator
Initial value:
util::TransformIterator<const_transform_t,
typename std::vector<TFPrimitive*>::const_iterator>
Definition transformiterator.h:53

◆ iterator

using inviwo::TFPrimitiveSet::iterator

Member Function Documentation

◆ add() [1/6]

TFPrimitive & inviwo::TFPrimitiveSet::add ( const dvec2 & pos)

Add a TFPrimitive at pos.x where pos.y is used as alpha and the color is interpolated from existing TFPrimitives before and after the given position

Parameters
pospos.x refers to the position of the TFPrimitive, pos.y will be mapped to alpha
Exceptions
RangeExceptionif TF type is relative and pos.x is outside [0,1]

◆ add() [2/6]

void inviwo::TFPrimitiveSet::add ( const std::vector< TFPrimitiveData > & primitives)

Add multiple TFPrimitives

Parameters
primitivesvector of primitives to be added
Exceptions
RangeExceptionif TF type is relative and any of the given points is outside [0,1]

◆ add() [3/6]

TFPrimitive & inviwo::TFPrimitiveSet::add ( const TFPrimitive & primitive)

Add a TFPrimitive

Parameters
primitiveTFPrimitive to be added
Exceptions
RangeExceptionif TF type is relative and the primitive position is outside [0,1]

◆ add() [4/6]

TFPrimitive & inviwo::TFPrimitiveSet::add ( const TFPrimitiveData & data)

Add a TFPrimitive

Parameters
dataPrimitive to be added
Exceptions
RangeExceptionif TF type is relative and position of point is outside [0,1]

◆ add() [5/6]

TFPrimitive & inviwo::TFPrimitiveSet::add ( double pos,
const vec4 & color )

Add a TFPrimitive

Parameters
posrefers to the position of the TFPrimitive
colorcolor of the TFPrimitive including alpha
Exceptions
RangeExceptionif TF type is relative and pos is outside [0,1]

◆ add() [6/6]

TFPrimitive & inviwo::TFPrimitiveSet::add ( double pos,
double alpha )

Add a TFPrimitive at pos with alpha. The color is interpolated from existing TFPrimitives before and after the given position

Parameters
posposition of the TFPrimitive,
alphaalpha value of the TFPrimitive
Exceptions
RangeExceptionif TF type is relative and pos is outside [0,1]

◆ deserialize()

virtual void inviwo::TFPrimitiveSet::deserialize ( Deserializer & d)
overridevirtual

Implements inviwo::Serializable.

◆ getColors()

std::vector< vec4 > inviwo::TFPrimitiveSet::getColors ( ) const

Access TFPrimitives colors as a vector which can be used, e.g., for setting uniforms of a shader.

Returns
vector of TFPrimitives' colors sorted increasingly regarding position

◆ getPositions()

std::vector< double > inviwo::TFPrimitiveSet::getPositions ( ) const

Access TFPrimitives positions as a vector which can be used, e.g., for setting uniforms of a shader.

Returns
vector of TFPrimitives' positions sorted increasingly regarding position

◆ getPositionsf()

std::vector< float > inviwo::TFPrimitiveSet::getPositionsf ( ) const

Access TFPrimitives positions as a vector which can be used, e.g., for setting uniforms of a shader.

Returns
vector of TFPrimitives' positions sorted increasingly regarding position

◆ getRange()

dvec2 inviwo::TFPrimitiveSet::getRange ( ) const

returns the range of the TF. For a relative TF this will return [0,1]. In case of an absolute TF the range between first and last TF primitive is returned. If there are no primitives in the TF [0,1] will be returned.

Returns
range of TF

◆ getVectors()

std::pair< std::vector< double >, std::vector< vec4 > > inviwo::TFPrimitiveSet::getVectors ( ) const

Access TFPrimitives as pair of vectors which can be used, e.g., for setting uniforms of a shader.

Returns
vectors of TFPrimitives' position and color sorted increasingly regarding position

◆ getVectorsf()

std::pair< std::vector< float >, std::vector< vec4 > > inviwo::TFPrimitiveSet::getVectorsf ( ) const

Access TFPrimitives as pair of vectors which can be used, e.g., for setting uniforms of a shader.

Returns
vectors of TFPrimitives' position and color sorted increasingly regarding position

◆ interpolateAndStoreColors()

virtual void inviwo::TFPrimitiveSet::interpolateAndStoreColors ( std::span< vec4 > data) const
virtual

Interpolate the color between all neighboring pairs of TFPrimitives and write the result to dataArray. The range of all TFPrimitives is [0,1] when TF type is relative

Parameters
datawrite interpolated colors into data

Reimplemented in inviwo::TransferFunction.

◆ interpolateColor()

vec4 inviwo::TFPrimitiveSet::interpolateColor ( double t) const
protected

Interpolate the color between TFPrimitives at position t and return the respective color and opacity (rgba). The range of all TFPrimitives is [0,1] when TF type is relative

Parameters
tsampling position, if TF type is relative and t is outside the range [0,1] it is clamped to [0,1]
Returns
color and opacity at position t

◆ onTFPrimitiveChange()

virtual void inviwo::TFPrimitiveSet::onTFPrimitiveChange ( const TFPrimitive & p)
overridevirtual

Reimplemented from inviwo::TFPrimitiveObserver.

◆ remove()

bool inviwo::TFPrimitiveSet::remove ( const TFPrimitive & primitive)

Removes a primitive from the set

Returns
if a primitive was found and removed

◆ serialize()

virtual void inviwo::TFPrimitiveSet::serialize ( Serializer & s) const
overridevirtual

Implements inviwo::Serializable.

◆ set()

void inviwo::TFPrimitiveSet::set ( const_iterator begin,
const_iterator end )

Set/update the list of TFPrimitives from given range


The documentation for this class was generated from the following file:
  • include/inviwo/core/datastructures/tfprimitiveset.h