Loading...
Searching...
No Matches
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>

Collaboration diagram for PaletteEntry:
Collaboration graph
[legend]

Public Types

typedef double value_t
 Intensity type.
 
typedef std::vector< value_tcolor_vect_t
 
typedef drain::FlexVariableMap map_t
 
typedef FlexibleVariable color_t
 Color vector type.
 

Public Member Functions

 PaletteEntry ()
 Default constructor.
 
 PaletteEntry (const PaletteEntry &entry)
 Copy constructor.
 
 PaletteEntry (const char *code, const char *label, const color_vect_t &color, value_t alpha=255.0, bool hidden=false)
 
 PaletteEntry (const char *label, const color_vect_t &color, value_t alpha=255.0, bool hidden=false)
 
 PaletteEntry (const color_vect_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.
 
 PaletteEntry (const char *label)
 Special dummy constructor for reading a title or other metadata related to Palette.
 
PaletteEntryoperator= (const PaletteEntry &b)
 
const map_tgetParameters () const
 
map_tgetParameters ()
 
std::ostream & toStream (std::ostream &ostr, char separator='\t') const
 
void checkAlpha ()
 
void getHexColor (std::ostream &ostr) const
 Returns the color without leading marker (like "0x").
 
void getHexColor (std::string &str, const std::string &prefix="") const
 Write colour in hexadecimal notation, with an optional prefix (often "#").
 

Public Attributes

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

Protected Member Functions

void init ()
 

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_vect_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_vect_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_vect_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

◆ alpha

value_t alpha

Colors, or more generally, channel values.

Transparency

◆ 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: