COPASI API  4.16.103
Public Member Functions | Protected Attributes | List of all members
CColorScaleAdvanced Class Reference

#include <CColorScale.h>

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

Public Member Functions

 CColorScaleAdvanced ()
 
virtual QColor getColor (const C_FLOAT64 &number)
 
void setColorMax (QColor col)
 
void setColorMin (QColor col)
 
- Public Member Functions inherited from CColorScaleSimple
 CColorScaleSimple ()
 
virtual void finishAutomaticParameterCalculation ()
 
virtual void passValue (const C_FLOAT64 &number)
 
void setLog (bool l)
 
void setMinMax (const C_FLOAT64 &min, const C_FLOAT64 &max)
 
void setSymmetric (bool s)
 
virtual void startAutomaticParameterCalculation ()
 
- Public Member Functions inherited from CColorScale
 CColorScale ()
 
bool isUsed () const
 
void setIsUsed (bool f)
 
virtual ~CColorScale ()
 

Protected Attributes

QColor mColorMax
 
QColor mColorMin
 
- Protected Attributes inherited from CColorScaleSimple
bool mLog
 
C_FLOAT64 mMax
 
C_FLOAT64 mMin
 
bool mSym
 

Detailed Description

The same mapping as in the base class. Option to set user defined colors for the min and max value.

Definition at line 140 of file CColorScale.h.

Constructor & Destructor Documentation

CColorScaleAdvanced::CColorScaleAdvanced ( )

Definition at line 127 of file CColorScale.cpp.

References mColorMax, and mColorMin.

129 {
130  mColorMax = QColor(0, 255, 0);
131  mColorMin = QColor(240, 240, 240);
132 }

Member Function Documentation

QColor CColorScaleAdvanced::getColor ( const C_FLOAT64 number)
virtual

this method maps a number to a color.

Reimplemented from CColorScaleSimple.

Definition at line 144 of file CColorScale.cpp.

References C_FLOAT64, mColorMax, mColorMin, CColorScaleSimple::mMax, and CColorScaleSimple::mMin.

145 {
146  C_FLOAT64 tmp = (number - mMin) / (mMax - mMin); //scale to 0..1
147 
148  if (tmp > 1) tmp = 1;
149 
150  if (tmp < 0) tmp = 0;
151 
152  int r = (int)(mColorMin.red() * (1 - tmp) + mColorMax.red() * tmp);
153  int g = (int)(mColorMin.green() * (1 - tmp) + mColorMax.green() * tmp);
154  int b = (int)(mColorMin.blue() * (1 - tmp) + mColorMax.blue() * tmp);
155 
156  QColor color(r, g, b);
157  return color;
158 }
#define C_FLOAT64
Definition: copasi.h:92
void CColorScaleAdvanced::setColorMax ( QColor  col)

Definition at line 139 of file CColorScale.cpp.

References mColorMax.

Referenced by CQTSSAResultSubWidget::init().

140 {
141  mColorMax = col;
142 }
void CColorScaleAdvanced::setColorMin ( QColor  col)

Definition at line 134 of file CColorScale.cpp.

References mColorMin.

Referenced by CQTSSAResultSubWidget::init().

135 {
136  mColorMin = col;
137 }

Member Data Documentation

QColor CColorScaleAdvanced::mColorMax
protected

Definition at line 154 of file CColorScale.h.

Referenced by CColorScaleAdvanced(), getColor(), and setColorMax().

QColor CColorScaleAdvanced::mColorMin
protected

Definition at line 153 of file CColorScale.h.

Referenced by CColorScaleAdvanced(), getColor(), and setColorMin().


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