Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
PaletteEntry Class Reference

Container for color, transparency (alpha) and textual id and description. Does not contain intensity thresholds (intervals). More...

#include <PaletteEntry.h>

Inheritance diagram for PaletteEntry:
Inheritance graph
[legend]
Collaboration diagram for PaletteEntry:
Collaboration graph
[legend]

Public Types

typedef double value_t
 Intensity type.
 
typedef UniTuple< value_t, 3 > color_t
 Color vector type.
 

Public Member Functions

 PaletteEntry ()
 Default constructor. More...
 
 PaletteEntry (const PaletteEntry &entry)
 Copy constructor.
 
 PaletteEntry (const char *code, const char *label, const color_t &color, value_t alpha=255.0, bool hidden=false)
 
 PaletteEntry (const char *label, const color_t &color, value_t alpha=255.0, bool hidden=false)
 
 PaletteEntry (const color_t &color, value_t alpha=255.0, bool hidden=false)
 
 PaletteEntry (const std::initializer_list< Variable::init_pair_t > &args)
 Constructor supporting Palette initialization using "{key,value}" form. More...
 
 PaletteEntry (const char *label)
 Special dummy constructor for reading a title or other metadata related to Palette. More...
 
void checkAlpha ()
 
std::ostream & toStream (std::ostream &ostr, char separator='\t') const
 
void getHexColor (std::ostream &ostr) const
 Returns the color without leading marker (like "0x").
 
void getHexColor (std::string &str) const
 
- Public Member Functions inherited from BeanLike
virtual const std::string & getName () const
 Return the name of an instance.
 
virtual const std::string & getDescription () const
 Return a brief description.
 
bool hasParameters () const
 
template<class F >
getParameter (const std::string &p) const
 Gets a single parameter.
 
const ReferenceMapgetParameters () const
 
ReferenceMapgetParameters ()
 
template<class F >
void setParametersFromEntries (const F &args)
 
void setParameters (std::initializer_list< Variable::init_pair_t > args)
 Grants access to (if above hidden)
 
virtual void setParameters (const std::string &p, char assignmentSymbol='=', char separatorSymbol=0)
 Sets comma-separated parameters in a predetermined order "a,b,c" or by specifing them "b=2". More...
 
template<class T >
void setParameters (const std::map< std::string, T > &args)
 Set parameters.
 
template<class T >
void setParameters (const SmartMap< T > &args)
 Set parameters.
 
void setParameter (const std::string &p, const Castable &value)
 Sets a single parameter.
 
template<class T >
void setParameter (const std::string &p, const VariableT< T > &value)
 
template<class F >
void setParameter (const std::string &p, const F &value)
 Sets a single parameter. More...
 
template<class F >
void setParameter (const std::string &p, std::initializer_list< F > value)
 Sets a single parameter.
 
BeanLikeoperator= (const BeanLike &b)
 
virtual std::ostream & toStream (std::ostream &ostr, bool compact=true) const
 
 BeanLike (const BeanLike &b)
 
 BeanLike (const std::string &name, const std::string &description="")
 

Public Attributes

std::string code
 Technical identifier (optional).
 
std::string label
 Short description for legends.
 
color_t color
 Index or threshold value. Must be signed, as image data may generally have negative values. More...
 
value_t alpha
 Transparency.
 
bool hidden
 Suggests hiding the entry in legends. Does not affect colouring of images. More...
 

Protected Member Functions

void init ()
 
- Protected Member Functions inherited from BeanLike
virtual void storeLastArguments (const std::string &p)
 Called after setParameters()
 
virtual void updateBean () const
 Called after setParameters()
 

Additional Inherited Members

- Protected Attributes inherited from BeanLike
const std::string name
 
const std::string description
 
ReferenceMap parameters
 

Detailed Description

Container for color, transparency (alpha) and textual id and description. Does not contain intensity thresholds (intervals).

The color is stored as 8 bit value [0.0 ,255.0]. Alpha is stored (currenly) as a float: [0.0, 1.0].

Constructor & Destructor Documentation

◆ PaletteEntry() [1/6]

Default constructor.

Colorizes an image of 1 channel to an image of N channels by using a palette image as a lookup table.

Treats an RGB truecolor image of N pixels as as a palette of N colors.

◆ PaletteEntry() [2/6]

PaletteEntry ( const char *  code,
const char *  label,
const color_t color,
value_t  alpha = 255.0,
bool  hidden = false 
)

This constructor supports Palette initialization of form:

palette = {
{ 10, {{"label","Timing problem"},{"color",{240,240,240}},{"code","tech.err.time"},{"alpha",255}} },
{ 13, {{"label","Unclassified"},{"color",{144,144,144}},{"code","tech.class.unclass"},{"alpha",255}} },
{ 64, {{"label","Precipitation"},{"color",{80,208,80}},{"code","precip"},{"alpha",255}} },
{ 72, {{"label","Rain"},{"color",{32,248,96}},{"code","precip.widespread"},{"alpha",255}} },
// ...

◆ PaletteEntry() [3/6]

PaletteEntry ( const char *  label,
const color_t color,
value_t  alpha = 255.0,
bool  hidden = false 
)

This constructor supports Palette initialization with following entry syntax:

palette = {
{"nodata", {"nodata", "Data unavailable", {255.0,255.0,255.0}} },
{"undetect", {"undetect", "Measurement failed", {0.0,0.0,0.0}} },
{ -32.0, {"noise", "Noise", {0.0,0.0,0.0}} },
{ 24.0, {"precip.rain.moderate", "Moderate rain", {255.0,150.0,50.0}} },
// ...

◆ PaletteEntry() [4/6]

PaletteEntry ( const color_t color,
value_t  alpha = 255.0,
bool  hidden = false 
)

This constructor supports Palette initialization of form:

palette = {
{"nodata", {"Data unavailable", {255.0,255.0,255.0}} },
{"undetect", {"Measurement failed", {0.0,0.0,0.0}} },
{ -32.0, {"Noise", {0.0,0.0,0.0}} },
{ 24.0, {"precip.moderate", "Moderate", {255.0,150.0,50.0}} },
// ...

◆ PaletteEntry() [5/6]

PaletteEntry ( const std::initializer_list< Variable::init_pair_t > &  args)

Constructor supporting Palette initialization using "{key,value}" form.

palette = {
{ 10, {{"label","Timing problem"},{"color",{240,240,240}},{"code","tech.err.time"},{"alpha",255}} },
{ 13, {{"label","Unclassified"},{"color",{144,144,144}},{"code","tech.class.unclass"},{"alpha",255}} },
{ 64, {{"label","Precipitation"},{"color",{80,208,80}},{"code","precip"},{"alpha",255}} },
{ 72, {{"label","Rain"},{"color",{32,248,96}},{"code","precip.widespread"},{"alpha",255}} },
// ...

◆ PaletteEntry() [6/6]

PaletteEntry ( const char *  label)

Special dummy constructor for reading a title or other metadata related to Palette.

This constructor supports Palette initialization of form:

palette = {
{ "title", {"Radar reflectivity"} }
// ...

Member Function Documentation

◆ toStream()

std::ostream & toStream ( std::ostream &  ostr,
char  separator = '\t' 
) const
Parameters
ostr- output stream
separator- char after palette index
separator2- char after each color intensity value

Member Data Documentation

◆ color

color_t color

Index or threshold value. Must be signed, as image data may generally have negative values.

Colors, or more generally, channel values

◆ hidden

bool hidden

Suggests hiding the entry in legends. Does not affect colouring of images.

When true, indicates that this entry is less significant and can be skipped when rendering legends, for example.


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