28 #include "WStringUtils.h"
29 #include "WPropertyTypes.h"
30 #include "WTransferFunction.h"
38 out <<
"PV_TRIGGER_TRIGGERED";
41 out <<
"PV_TRIGGER_READY";
53 if( s ==
"PV_TRIGGER_TRIGGERED" )
83 std::vector< std::string > tokens;
87 while( idx < tokens.size() )
89 std::vector< std::string > innerTokens;
93 if( innerTokens[ 0 ] ==
"c" )
95 tf.
addColor( string_utils::fromString< double >( innerTokens[ 1 ].c_str() ),
96 WColor( string_utils::fromString< double >( innerTokens[ 2 ].c_str() ),
97 string_utils::fromString< double >( innerTokens[ 3 ].c_str() ),
98 string_utils::fromString< double >( innerTokens[ 4 ].c_str() ),
102 else if( innerTokens[ 0 ] ==
"a" )
104 tf.
addAlpha( string_utils::fromString< double >( innerTokens[ 1 ].c_str() ),
105 string_utils::fromString< double >( innerTokens[ 2 ].c_str() ) );
115 std::ostringstream out;
117 for(
size_t i = 0; i < numColors; ++i )
121 out <<
"c:" << iso <<
":" << c[ 0 ] <<
":" << c[ 1 ] <<
":" << c[ 2 ] <<
";";
124 for(
size_t i = 0; i < numAlphas; ++i )
128 out <<
"a:" << iso <<
":" << alpha;
129 if( i != numAlphas-1 )
T create(const T &, const std::string str)
Creates a new instance of the type from a given string.
std::string asString(const T &v)
Creates a string from the specified value.
A class that stores a 1D transfer function which consists of a linear interpolation of alpha and colo...
double getColorIsovalue(size_t i) const
The isovalue of the color at a given index.
size_t numAlphas() const
Get the number of alphas.
double getAlphaIsovalue(size_t i) const
Get the isovalue at a given index in the alpha values.
size_t numColors() const
Get the number of colors.
double getAlpha(size_t i) const
Get alpha at given index.
void addColor(double iso, const WColor &color)
Insert a new color point.
const WColor & getColor(size_t i) const
Get color at given index.
void addAlpha(double iso, double alpha)
Insert a new alpha point.
This namespace contains several helper classes which translate their template type to an enum.
PV_TRIGGER
Enum denoting the possible trigger states.
@ PV_TRIGGER_TRIGGERED
Trigger property: got triggered.
@ PV_TRIGGER_READY
Trigger property: is ready to be triggered (again)
bool isPropertyGroup(PROPERTY_TYPE type)
Checks which property types are derived from WPropertyGroupBase.
std::ostream & operator<<(std::ostream &out, const PV_TRIGGER &c)
Write a PV_TRIGGER in string representation to the given output stream.
std::istream & operator>>(std::istream &in, PV_TRIGGER &c)
Write a PV_TRIGGER in string representation to the given input stream.
std::vector< std::string > tokenize(const std::string &source, const std::string &delim=WHITESPACE, bool compress=true)
Splits the given string into a vector of strings (so called tokens).