Palette Class Reference

Manages the colors palette. More...

#include <palette.h>

List of all members.

Public Slots

void SelectBW ()
 Method receiving the call to the selection of Black and White.
void SelectColor ()
 Method receiving the call to the selection of Color.
void SelectLinear ()
 Method receiving the call to the selection of the linear scale.
void SelectLogarithmic ()
 Method receiving the call to the selection of the logarithmic scale.
void AdjustScale ()
 Method receiving the call to the scale adjustment.
void AdjustAutoScale ()
 Method receiving the call to the automatic scale adjustment.

Signals

void PaletteModified ()
 Signal emitted when the state of the palette changes.

Public Member Functions

 Palette (QWidget *parent=0)
 Constructor for Palette Intialize the various parameters of the palette.
virtual ~Palette ()
QColor GetColor (int i) const
 Returns the color of the palette at a given index.
int GetPal () const
 returns the palette index
int GetMin () const
 returns the palette minimum
int GetMax () const
 returns the palette maximum
bool IsLogScale () const
 Return true if the scale is logarithmic, false otherwise (linear).
QMenu * GetMenu () const
 return the pointer to the palette menu
void ChangeDataMinMax (int min, int max)
 Updates the min and max of the palette.
void ChangeExtrema (int vMin, int vMax)
 Updates the extrema of the palette.
int DataToIndex (int val)
 converts a data value into an index in the palette

Protected Member Functions

void paintEvent (QPaintEvent *)
 Redraw the palette (via an event).
void paintPalette (QPainter *p)
 Redraw the palette.
void CreatePaletteMenu ()
 Create the palette menu.
void mousePressEvent (QMouseEvent *e)
 Receives the mouse event 'mouse pressed'.
void AdjustScaleFactor ()
 Adjust the scale factor.
void ChangePalette (int iPal)
 Changes the type of palette (BW/color).
void ChangeLinLog (bool)
 Changes the palette scale (lin/log).
int GetPalIndex (int i) const
 Returns the index of the palette for a given value.

Protected Attributes

int m_idxPal
 Index of the palette (Black and White, Color ...).
int m_vMin
 Minimum value of the palette.
int m_vMax
 Maximum value of the palette.
float m_fact
 Conversion factor.
int m_dataMin
 Minimum of the data (for the automatic adjustment).
int m_dataMax
 Maximum of the data (for the automatic adjustment).
QMenu * m_menuPalette
 Menus related to the palette.
QMenu * m_menuColors
 Menus related to the colors.
QMenu * m_menuLinLog
 Menus related to the type of the scale.
bool m_isLogScale
 Mode logarithmic or linear.


Detailed Description

Manages the colors palette.

Definition at line 20 of file palette.h.


Constructor & Destructor Documentation

Palette::Palette ( QWidget *  parent = 0  ) 

Constructor for Palette Intialize the various parameters of the palette.

Definition at line 21 of file palette.cpp.

References AdjustScaleFactor(), BW, CreatePaletteMenu(), m_idxPal, m_isLogScale, m_vMax, and m_vMin.

Here is the call graph for this function:

Palette::~Palette (  )  [virtual]

Definition at line 33 of file palette.cpp.


Member Function Documentation

void Palette::PaletteModified (  )  [signal]

Signal emitted when the state of the palette changes.

Definition at line 98 of file moc_palette.cpp.

Referenced by ChangeExtrema(), ChangeLinLog(), and ChangePalette().

void Palette::SelectBW (  )  [slot]

Method receiving the call to the selection of Black and White.

Definition at line 168 of file palette.cpp.

References BW, and ChangePalette().

Referenced by CreatePaletteMenu().

void Palette::SelectColor (  )  [slot]

Method receiving the call to the selection of Color.

Definition at line 173 of file palette.cpp.

References ChangePalette(), and COLOR.

Referenced by CreatePaletteMenu().

void Palette::SelectLinear (  )  [slot]

Method receiving the call to the selection of the linear scale.

Definition at line 188 of file palette.cpp.

References ChangeLinLog().

Referenced by CreatePaletteMenu().

void Palette::SelectLogarithmic (  )  [slot]

Method receiving the call to the selection of the logarithmic scale.

Definition at line 192 of file palette.cpp.

References ChangeLinLog().

Referenced by CreatePaletteMenu().

void Palette::AdjustScale (  )  [slot]

Method receiving the call to the scale adjustment.

Definition at line 234 of file palette.cpp.

References ChangeExtrema(), Ui_DqtScale::m_spMax, Ui_DqtScale::m_spMin, m_vMax, m_vMin, and Ui_DqtScale::setupUi().

Referenced by CreatePaletteMenu().

void Palette::AdjustAutoScale (  )  [slot]

Method receiving the call to the automatic scale adjustment.

Definition at line 247 of file palette.cpp.

References ChangeExtrema(), m_dataMax, and m_dataMin.

Referenced by CreatePaletteMenu().

void Palette::paintEvent ( QPaintEvent *   )  [protected]

Redraw the palette (via an event).

Definition at line 37 of file palette.cpp.

References paintPalette().

Here is the call graph for this function:

void Palette::paintPalette ( QPainter *  p  )  [protected]

Redraw the palette.

Definition at line 43 of file palette.cpp.

References GetColor(), GetPalIndex(), m_vMax, m_vMin, and NB_COLORS.

Referenced by paintEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

void Palette::CreatePaletteMenu (  )  [protected]

Create the palette menu.

Definition at line 148 of file palette.cpp.

References AdjustAutoScale(), AdjustScale(), m_menuColors, m_menuLinLog, m_menuPalette, SelectBW(), SelectColor(), SelectLinear(), and SelectLogarithmic().

Referenced by Palette().

Here is the caller graph for this function:

void Palette::mousePressEvent ( QMouseEvent *  e  )  [protected]

Receives the mouse event 'mouse pressed'.

Definition at line 208 of file palette.cpp.

References m_menuPalette.

void Palette::AdjustScaleFactor (  )  [protected]

Adjust the scale factor.

Definition at line 139 of file palette.cpp.

References m_fact, m_isLogScale, m_vMax, and m_vMin.

Referenced by ChangeExtrema(), ChangeLinLog(), and Palette().

Here is the caller graph for this function:

void Palette::ChangePalette ( int  iPal  )  [protected]

Changes the type of palette (BW/color).

Parameters:
iPal type of the palette

Definition at line 178 of file palette.cpp.

References m_idxPal, and PaletteModified().

Referenced by SelectBW(), and SelectColor().

void Palette::ChangeLinLog ( bool  type  )  [protected]

Changes the palette scale (lin/log).

Definition at line 197 of file palette.cpp.

References AdjustScaleFactor(), m_isLogScale, and PaletteModified().

Referenced by SelectLinear(), and SelectLogarithmic().

Here is the call graph for this function:

int Palette::GetPalIndex ( int  i  )  const [protected]

Returns the index of the palette for a given value.

Parameters:
i value of the palette which is looked for.

Definition at line 96 of file palette.cpp.

References m_isLogScale.

Referenced by paintPalette().

Here is the caller graph for this function:

QColor Palette::GetColor ( int  i  )  const

Returns the color of the palette at a given index.

Parameters:
i index for which to retrieve the color

Definition at line 117 of file palette.cpp.

References BW, COLOR, m_idxPal, and NB_COLORS.

Referenced by paintPalette(), and Visu2D::UpdateDataAndPixmap().

Here is the caller graph for this function:

int Palette::GetPal (  )  const

returns the palette index

Definition at line 252 of file palette.cpp.

References m_idxPal.

int Palette::GetMin (  )  const

returns the palette minimum

Definition at line 256 of file palette.cpp.

References m_vMin.

int Palette::GetMax (  )  const

returns the palette maximum

Definition at line 260 of file palette.cpp.

References m_vMax.

bool Palette::IsLogScale (  )  const

Return true if the scale is logarithmic, false otherwise (linear).

Definition at line 264 of file palette.cpp.

References m_isLogScale.

QMenu * Palette::GetMenu (  )  const

return the pointer to the palette menu

Definition at line 268 of file palette.cpp.

References m_menuPalette.

Referenced by WFrame::InitMenus().

Here is the caller graph for this function:

void Palette::ChangeDataMinMax ( int  min,
int  max 
)

Updates the min and max of the palette.

Parameters:
min new minimum
max new maximum

Definition at line 227 of file palette.cpp.

References ChangeExtrema(), m_dataMax, and m_dataMin.

Referenced by WFrame::ReadImage().

Here is the call graph for this function:

void Palette::ChangeExtrema ( int  vMin,
int  vMax 
)

Updates the extrema of the palette.

Parameters:
vMin new minimum
vMax new maximum

Definition at line 216 of file palette.cpp.

References AdjustScaleFactor(), m_vMax, m_vMin, and PaletteModified().

Referenced by AdjustAutoScale(), AdjustScale(), and ChangeDataMinMax().

Here is the call graph for this function:

Here is the caller graph for this function:

int Palette::DataToIndex ( int  val  ) 

converts a data value into an index in the palette

Parameters:
val value to convert
Returns:
the palette index

Definition at line 104 of file palette.cpp.

References m_fact, m_isLogScale, m_vMax, and m_vMin.

Referenced by Visu2D::UpdateDataAndPixmap().

Here is the caller graph for this function:


Member Data Documentation

int Palette::m_idxPal [protected]

Index of the palette (Black and White, Color ...).

Definition at line 35 of file palette.h.

Referenced by ChangePalette(), GetColor(), GetPal(), and Palette().

int Palette::m_vMin [protected]

Minimum value of the palette.

Definition at line 38 of file palette.h.

Referenced by AdjustScale(), AdjustScaleFactor(), ChangeExtrema(), DataToIndex(), GetMin(), paintPalette(), and Palette().

int Palette::m_vMax [protected]

Maximum value of the palette.

Definition at line 41 of file palette.h.

Referenced by AdjustScale(), AdjustScaleFactor(), ChangeExtrema(), DataToIndex(), GetMax(), paintPalette(), and Palette().

float Palette::m_fact [protected]

Conversion factor.

Definition at line 44 of file palette.h.

Referenced by AdjustScaleFactor(), and DataToIndex().

int Palette::m_dataMin [protected]

Minimum of the data (for the automatic adjustment).

Definition at line 47 of file palette.h.

Referenced by AdjustAutoScale(), and ChangeDataMinMax().

int Palette::m_dataMax [protected]

Maximum of the data (for the automatic adjustment).

Definition at line 50 of file palette.h.

Referenced by AdjustAutoScale(), and ChangeDataMinMax().

QMenu* Palette::m_menuPalette [protected]

Menus related to the palette.

Definition at line 53 of file palette.h.

Referenced by CreatePaletteMenu(), GetMenu(), and mousePressEvent().

QMenu* Palette::m_menuColors [protected]

Menus related to the colors.

Definition at line 56 of file palette.h.

Referenced by CreatePaletteMenu().

QMenu* Palette::m_menuLinLog [protected]

Menus related to the type of the scale.

Definition at line 59 of file palette.h.

Referenced by CreatePaletteMenu().

bool Palette::m_isLogScale [protected]

Mode logarithmic or linear.

Definition at line 62 of file palette.h.

Referenced by AdjustScaleFactor(), ChangeLinLog(), DataToIndex(), GetPalIndex(), IsLogScale(), and Palette().


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

Generated on Tue Sep 13 10:10:25 2011 for DrawQt by  doxygen 1.5.6