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

#include <CColorScale.h>

Inheritance diagram for CColorScaleAverage:
Inheritance graph
Collaboration diagram for CColorScaleAverage:
Collaboration graph

Public Member Functions

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

Protected Attributes

C_FLOAT64 mFactor
C_FLOAT64 mFloat
C_INT32 mInt
- 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. However the automatic scaling is done using the average of the absolute values of the provided numbers. The average of the absolute values is multiplied by the factor to give the range.

Definition at line 163 of file CColorScale.h.

Constructor & Destructor Documentation

CColorScaleAverage::CColorScaleAverage ( )

Definition at line 162 of file CColorScale.cpp.

163  : CColorScaleSimple(),
164  mFactor(3.0),
165  mFloat(0.0),
166  mInt(0)
167 {}

Member Function Documentation

void CColorScaleAverage::finishAutomaticParameterCalculation ( )

this finishes the calculation of the scaling parameters.

Reimplemented from CColorScaleSimple.

Definition at line 188 of file CColorScale.cpp.

References mFactor, mFloat, mInt, CColorScaleSimple::mMax, and CColorScaleSimple::mMin.

189 {
190  if (mInt)
191  mMax = mFactor * mFloat / mInt;
192  else
193  mMax = mFactor;
195  mMin = -mMax;
197  if (mMin == mMax)
198  {
199  mMin -= 1e-5;
200  mMax += 1e-5;
201  }
202 }
void CColorScaleAverage::passValue ( const C_FLOAT64 )

with this method numbers are passed to the automatic scaling algorithm.

Reimplemented from CColorScaleSimple.

Definition at line 177 of file CColorScale.cpp.

References max, mFloat, and mInt.

178 {
179  if (number != number) return; //NaN
181  if (fabs(number) >= std::numeric_limits< C_FLOAT64 >::max()) return; //Inf
183  ++mInt;
184  mFloat += fabs(number);
185 }
#define max(a, b)
Definition: f2c.h:176
void CColorScaleAverage::setFactor ( C_FLOAT64  f)

Definition at line 171 of file CColorScale.h.

References mFactor.

Referenced by CQSensResultWidget::init().

171 {mFactor = f;};
void CColorScaleAverage::startAutomaticParameterCalculation ( )

this method starts the calculation of the scaling parameters.

Reimplemented from CColorScaleSimple.

Definition at line 170 of file CColorScale.cpp.

References mFloat, and mInt.

171 {
172  mInt = 0;
173  mFloat = 0;
174 }

Member Data Documentation

C_FLOAT64 CColorScaleAverage::mFactor

Definition at line 178 of file CColorScale.h.

Referenced by finishAutomaticParameterCalculation(), and setFactor().

C_FLOAT64 CColorScaleAverage::mFloat
C_INT32 CColorScaleAverage::mInt

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