te::color::ColorBar Class Reference

It models the concept of color bar. More...

#include <ColorBar.h>

Public Member Functions

Initializer Methods

Methods related to instantiation and destruction.

 ColorBar ()
 It initializes a new ColorBar(default constructor) More...
 
 ColorBar (int size)
 It initializes a new ColorBar. More...
 
 ColorBar (const RGBAColor &colorBegin, const RGBAColor &colorEnd, int size)
 It initializes a new ColorBar. More...
 
 ColorBar (const ColorBar &rhs)
 Copy constructor. More...
 
te::color::ColorBaroperator= (const ColorBar &rhs)
 
 ~ColorBar ()
 Destructor. More...
 
Accessor methods

Methods used to get or set properties.

const std::string & getName () const
 It returns the color bar name. More...
 
void setName (const std::string &name)
 It sets the color bar name and adjust its entry in the scheme group if needed. More...
 
const std::map< double, te::color::RGBAColor > & getColorMap () const
 It gets color map. More...
 
const std::vector< te::color::RGBAColor > & getColorBar ()
 It generates color bar. More...
 
const std::vector< te::color::RGBAColor > & getSlices (const int &n)
 It generates color bar. More...
 
const te::color::RGBAColorgetMeanSlice ()
 
const std::vector< te::color::RGBAColor > & getLowerMeanSlices (const int &n)
 
const std::vector< te::color::RGBAColor > & getUpperMeanSlices (const int &n)
 
void setBarSize (const int &size)
 It sets number of colors in the color bar. More...
 
int getBarSize ()
 It returns number of colors in the color bar. More...
 
void addColor (const RGBAColor &color, const double &pos)
 It adds a color in the color bar. More...
 
void remove (const RGBAColor &color)
 It removes a color in the color bar. More...
 
void remove (const int &index)
 It removes a color in the color bar. More...
 
void remove (const double &pos)
 It removes a color in the color bar. More...
 
void removeReverse (const int &index)
 It removes a color in the color bar. More...
 
void changeColor (const double &pos, const RGBAColor &color)
 It moves a color to new posisiton. More...
 
void changeColor (const int &index, const RGBAColor &color)
 It moves a color to new posisiton. More...
 
void move (const RGBAColor &color, const double &pos)
 It moves a color to new posisiton. More...
 
int move (const int &index, const double &pos)
 It moves a color to new posisiton. More...
 
double move (const double &pi, const double &pm)
 It moves a color to new posisiton. More...
 
int moveReverse (const int &index, const double &pos)
 It moves a color to new posisiton. More...
 

Private Member Functions

Private methods

Methods used to generate colors.

void generateColorBar ()
 It generates bar colors. More...
 
void generateSlices (const int &n)
 It generates legend colors. More...
 

Private Attributes

int m_barSize
 Size of color bar (number of colors in the color bar). More...
 
std::vector< RGBAColorm_colorBarVec
 Color vector. More...
 
std::map< double, RGBAColorm_colorMap
 Color map. More...
 
std::vector< RGBAColorm_colorSliceVec
 Color step vector. More...
 
std::string m_name
 Color bar name. More...
 

Detailed Description

It models the concept of color bar.

It is used to construct color bar.

Definition at line 49 of file ColorBar.h.

Constructor & Destructor Documentation

◆ ColorBar() [1/4]

te::color::ColorBar::ColorBar ( )

It initializes a new ColorBar(default constructor)

◆ ColorBar() [2/4]

te::color::ColorBar::ColorBar ( int  size)

It initializes a new ColorBar.

Parameters
sizeNumber of colors to be generated.
Note
By default the first color is red and the second is white.

◆ ColorBar() [3/4]

te::color::ColorBar::ColorBar ( const RGBAColor colorBegin,
const RGBAColor colorEnd,
int  size 
)

It initializes a new ColorBar.

Parameters
colorBeginBegin color.
colorEndEnd color.
sizeNumber of colors to be generated.

◆ ColorBar() [4/4]

te::color::ColorBar::ColorBar ( const ColorBar rhs)

Copy constructor.

◆ ~ColorBar()

te::color::ColorBar::~ColorBar ( )

Destructor.

Member Function Documentation

◆ addColor()

void te::color::ColorBar::addColor ( const RGBAColor color,
const double &  pos 
)

It adds a color in the color bar.

Parameters
colorColor to be added in the color bar.
posPosition where the color is added.
Note
0 <= pos <= 1
If you add to the first position, the color previously occupied is shifted to be between this and the next color of the bar.
If you add to the last position, the color previously occupied is shifted to be between this and the previous color of the bar.
If you add where there is already another, the color previously occupied is shifted to be between this and the next/previous color of the bar.

◆ changeColor() [1/2]

void te::color::ColorBar::changeColor ( const double &  pos,
const RGBAColor color 
)

It moves a color to new posisiton.

Parameters
posposition of the color in the color bar.
colorThe new color.

◆ changeColor() [2/2]

void te::color::ColorBar::changeColor ( const int &  index,
const RGBAColor color 
)

It moves a color to new posisiton.

Parameters
indexindex of the color in the color bar.
colorThe new color.

◆ generateColorBar()

void te::color::ColorBar::generateColorBar ( )
private

It generates bar colors.

◆ generateSlices()

void te::color::ColorBar::generateSlices ( const int &  n)
private

It generates legend colors.

Parameters
nNumber of slices. It is the amount of legends.

◆ getBarSize()

int te::color::ColorBar::getBarSize ( )

It returns number of colors in the color bar.

Returns
number of colors in the color bar.

◆ getColorBar()

const std::vector<te::color::RGBAColor>& te::color::ColorBar::getColorBar ( )

It generates color bar.

Returns
Generated color bar.

◆ getColorMap()

const std::map<double, te::color::RGBAColor>& te::color::ColorBar::getColorMap ( ) const

It gets color map.

Returns
Generated color bar.

◆ getLowerMeanSlices()

const std::vector<te::color::RGBAColor>& te::color::ColorBar::getLowerMeanSlices ( const int &  n)

◆ getMeanSlice()

const te::color::RGBAColor& te::color::ColorBar::getMeanSlice ( )

◆ getName()

const std::string& te::color::ColorBar::getName ( ) const

It returns the color bar name.

Returns
The color bar name.

◆ getSlices()

const std::vector<te::color::RGBAColor>& te::color::ColorBar::getSlices ( const int &  n)

It generates color bar.

Parameters
nNumber of slices. It is the amount of legends.
Returns
Generated color steps.

◆ getUpperMeanSlices()

const std::vector<te::color::RGBAColor>& te::color::ColorBar::getUpperMeanSlices ( const int &  n)

◆ move() [1/3]

void te::color::ColorBar::move ( const RGBAColor color,
const double &  pos 
)

It moves a color to new posisiton.

Parameters
colorColor to be moved in the color bar.
Note
Move the first color matching found in the color bar.
If you place the color where there is already another, the color previously occupied is shifted to be between this and the next color of the bar.

◆ move() [2/3]

int te::color::ColorBar::move ( const int &  index,
const double &  pos 
)

It moves a color to new posisiton.

Parameters
indexIndex of color to be moved in the color bar.
posThe new postion of color in the color bar.
Note
0:move the first color; 1:remove the second color...
If you place the color where there is already another, the color previously occupied is shifted to be between this and the next color of the bar.
Returns
The index of color. The index may have changed depending on the new position that the color will take on the color bar.

◆ move() [3/3]

double te::color::ColorBar::move ( const double &  pi,
const double &  pm 
)

It moves a color to new posisiton.

Parameters
indexIndex of color to be moved in the color bar.
posThe new postion of color in the color bar.
Note
0:move the first color; 1:remove the second color...
If you place the color where there is already another, the color previously occupied is shifted to be between this and the next color of the bar.
Returns
The position of color. The position may have changed depending on the new position that the color will take on the color bar.

◆ moveReverse()

int te::color::ColorBar::moveReverse ( const int &  index,
const double &  pos 
)

It moves a color to new posisiton.

Parameters
indexReverse index of color to be moved in the color bar.
posThe new postion of color in the color bar.
Note
0:move the last color; 1:remove the penultimate color...
If you place the color where there is already another, the color previously occupied is shifted to be between this and the next color of the bar.
Returns
The position of color. The position may have changed depending on the new position that the color will take on the color bar.

◆ operator=()

te::color::ColorBar& te::color::ColorBar::operator= ( const ColorBar rhs)

Assignment operator.

◆ remove() [1/3]

void te::color::ColorBar::remove ( const RGBAColor color)

It removes a color in the color bar.

Parameters
colorColor to be removed in the color bar.
Note
If you remove the first color, the color next to occupy its place.
If you remove the last color, the previous color will take its place.
The bar should have at least two colors.

◆ remove() [2/3]

void te::color::ColorBar::remove ( const int &  index)

It removes a color in the color bar.

Parameters
indexIndex of color to be removed in the color bar.
Note
0:remove the first color; 1:remove the second color...
If you remove the first color, the color next to occupy its place.
If you remove the last color, the previous color will take its place.
The bar should have at least two colors.

◆ remove() [3/3]

void te::color::ColorBar::remove ( const double &  pos)

It removes a color in the color bar.

Parameters
posPosition of color to be removed in the color bar.
Note
If you remove the first color, the color next to occupy its place.
If you remove the last color, the previous color will take its place.
The bar should have at least two colors.

◆ removeReverse()

void te::color::ColorBar::removeReverse ( const int &  index)

It removes a color in the color bar.

Parameters
indexReverse index of color to be removed in the color bar.
Note
0:remove the last color; 1:remove the penultimate color...
If you remove the first color, the color next to occupy its place.
If you remove the last color, the previous color will take its place.
The bar should have at least two colors.

◆ setBarSize()

void te::color::ColorBar::setBarSize ( const int &  size)

It sets number of colors in the color bar.

Parameters
sizeNumber of colors in the color bar.

◆ setName()

void te::color::ColorBar::setName ( const std::string &  name)

It sets the color bar name and adjust its entry in the scheme group if needed.

Parameters
nameThe new color bar name.

Member Data Documentation

◆ m_barSize

int te::color::ColorBar::m_barSize
private

Size of color bar (number of colors in the color bar).

Definition at line 293 of file ColorBar.h.

◆ m_colorBarVec

std::vector<RGBAColor> te::color::ColorBar::m_colorBarVec
private

Color vector.

Definition at line 290 of file ColorBar.h.

◆ m_colorMap

std::map<double, RGBAColor> te::color::ColorBar::m_colorMap
private

Color map.

Definition at line 294 of file ColorBar.h.

◆ m_colorSliceVec

std::vector<RGBAColor> te::color::ColorBar::m_colorSliceVec
private

Color step vector.

Definition at line 291 of file ColorBar.h.

◆ m_name

std::string te::color::ColorBar::m_name
private

Color bar name.

Definition at line 292 of file ColorBar.h.


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