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
 
void beginBulkUpdate ()
 
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
 
void endBulkUpdate ()
 
TFPrimitivefront ()
 
const TFPrimitivefront () const
 
std::vector< TFPrimitiveDataget () const
 
TFPrimitiveget (size_t i)
 
const TFPrimitiveget (size_t i) const
 
std::vector< vec4 > getColors () const
 
PrimitiveSetMode getMode () const
 
std::vector< double > getPositions () const
 
std::vector< float > getPositionsf () const
 
dvec2 getRange () 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
 
void interpolateAndStoreColors (std::span< vec4 > data) const
 
TFPrimitiveSetoperator= (const TFPrimitiveSet &rhs)
 
TFPrimitiveSetoperator= (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
 
template<std::input_iterator Iter, std::sentinel_for< Iter > Sentinel>
requires std::convertible_to<std::iter_reference_t<Iter>, TFPrimitiveData>
void set (Iter sbegin, Sentinel send)
 
template<std::ranges::input_range R>
requires std::convertible_to<std::ranges::range_reference_t<R>, TFPrimitiveData>
void set (R range)
 
void setMode (PrimitiveSetMode mode)
 
void setMode (PrimitiveSetMode mode, const DataMapper &dm)
 
void setPosition (std::span< TFPrimitive * > primitives, double pos)
 
size_t size () const
 
 TFPrimitiveSet (const std::vector< TFPrimitiveData > &values={}, PrimitiveSetMode mode=PrimitiveSetMode::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 (const Observable< TFPrimitiveSetObserver > &other)
 
 Observable (Observable< TFPrimitiveSetObserver > &&other) noexcept
 
Observable< TFPrimitiveSetObserver > & operator= (const Observable< TFPrimitiveSetObserver > &other)
 
Observable< TFPrimitiveSetObserver > & operator= (Observable< TFPrimitiveSetObserver > &&other) noexcept
 
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)
 
Observeroperator= (const Observer &other)
 
Observeroperator= (Observer &&other)
 
void removeObservation (ObservableInterface *observable)
 
void removeObservations ()
 
virtual ~Observer ()
 

Protected Member Functions

TFPrimitiveadd (std::unique_ptr< TFPrimitive > primitive)
 
vec4 interpolateColor (double t) const
 
virtual void onTFPrimitiveChange (const TFPrimitive &p) override
 
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 notifyTFBeginBulkUpdate (const TFPrimitiveSet &set)
 
void notifyTFEndBulkUpdate (const TFPrimitiveSet &set)
 
void notifyTFModeChanged (const TFPrimitiveSet &set, PrimitiveSetMode mode)
 
void notifyTFPrimitiveAdded (const TFPrimitiveSet &set, TFPrimitive &p)
 
void notifyTFPrimitiveChanged (const TFPrimitiveSet &set, const TFPrimitive &p)
 
void notifyTFPrimitiveRemoved (const TFPrimitiveSet &set, TFPrimitive &p)
 
- Protected Member Functions inherited from inviwo::Observable< TFPrimitiveSetObserver >
void forEachObserver (C callback)
 
- Protected Member Functions inherited from inviwo::ObservableInterface
void addObservationHelper (Observer *observer)
 
void removeObservationHelper (Observer *observer)
 
- 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

Initial value:
util::TransformIterator<const_transform_t,
typename std::vector<TFPrimitive*>::const_iterator>

◆ iterator

Initial value:
util::TransformIterator<transform_t, typename std::vector<TFPrimitive*>::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 mode 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 mode 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 mode 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 mode 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 mode 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 mode 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()

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

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 mode is relative

Parameters
datawrite interpolated colors into data

◆ 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 mode is relative

Parameters
tsampling position, if TF mode 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)
overrideprotectedvirtual

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() [1/2]

template<std::input_iterator Iter, std::sentinel_for< Iter > Sentinel>
requires std::convertible_to<std::iter_reference_t<Iter>, TFPrimitiveData>
void inviwo::TFPrimitiveSet::set ( Iter sbegin,
Sentinel send )

Set/update the list of TFPrimitives from given range

◆ set() [2/2]

template<std::ranges::input_range R>
requires std::convertible_to<std::ranges::range_reference_t<R>, TFPrimitiveData>
void inviwo::TFPrimitiveSet::set ( R range)

Set/update the list of TFPrimitives from given range


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