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

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

It initializes a new ColorBar(default constructor)

Definition at line 29 of file ColorBar.cpp.

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.

Definition at line 34 of file ColorBar.cpp.

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.

Definition at line 43 of file ColorBar.cpp.

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

Copy constructor.

Definition at line 50 of file ColorBar.cpp.

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

Destructor.

Definition at line 70 of file ColorBar.cpp.

Member Function Documentation

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.

Definition at line 264 of file ColorBar.cpp.

Referenced by te::sa::GetColorBar(), te::qt::widgets::ColorCatalogWidget::onSchemaComboBoxActivated(), te::qt::widgets::GroupingWidget::updateUi(), and te::qt::widgets::ColorMapWidget::updateUi().

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.

Definition at line 381 of file ColorBar.cpp.

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.

Definition at line 392 of file ColorBar.cpp.

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

It generates legend colors.

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

Definition at line 151 of file ColorBar.cpp.

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

It returns number of colors in the color bar.

Returns
number of colors in the color bar.

Definition at line 259 of file ColorBar.cpp.

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

It generates color bar.

Returns
Generated color bar.

Definition at line 143 of file ColorBar.cpp.

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

It gets color map.

Returns
Generated color bar.

Definition at line 84 of file ColorBar.cpp.

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

Definition at line 202 of file ColorBar.cpp.

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

Definition at line 191 of file ColorBar.cpp.

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

It returns the color bar name.

Returns
The color bar name.

Definition at line 74 of file ColorBar.cpp.

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.

Definition at line 167 of file ColorBar.cpp.

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

Definition at line 228 of file ColorBar.cpp.

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.

Definition at line 409 of file ColorBar.cpp.

References te::color::RGBAColor::getAlpha(), te::color::RGBAColor::getBlue(), te::color::RGBAColor::getGreen(), and te::color::RGBAColor::getRed().

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.

Definition at line 493 of file ColorBar.cpp.

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.

Definition at line 522 of file ColorBar.cpp.

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.

Definition at line 617 of file ColorBar.cpp.

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

Assignment operator.

Definition at line 56 of file ColorBar.cpp.

References m_barSize, m_colorBarVec, m_colorMap, m_colorSliceVec, and m_name.

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.

Definition at line 305 of file ColorBar.cpp.

References te::color::RGBAColor::getAlpha(), te::color::RGBAColor::getBlue(), te::color::RGBAColor::getGreen(), and te::color::RGBAColor::getRed().

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.

Definition at line 326 of file ColorBar.cpp.

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.

Definition at line 346 of file ColorBar.cpp.

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.

Definition at line 361 of file ColorBar.cpp.

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.

Definition at line 252 of file ColorBar.cpp.

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.

Definition at line 79 of file ColorBar.cpp.

Member Data Documentation

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.

Referenced by operator=().

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

Color vector.

Definition at line 290 of file ColorBar.h.

Referenced by operator=().

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

Color map.

Definition at line 294 of file ColorBar.h.

Referenced by operator=().

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

Color step vector.

Definition at line 291 of file ColorBar.h.

Referenced by operator=().

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

Color bar name.

Definition at line 292 of file ColorBar.h.

Referenced by operator=().


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