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

#include <qwt3dColor.h>

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

Public Member Functions

 BarColor (Qwt3D::Plot3D *data, unsigned size=100, double min=0, double max=0)
 Initializes with data and set up a ColorVector with a size of 100 z values (default);. More...
 
Qwt3D::ColorVector & createVector (Qwt3D::ColorVector &vec)
 
Qwt3D::RGBA operator() (double x, double y, double z) const
 Receives z-dependend color from ColorVector. More...
 
void reset (unsigned size=100)
 Resets the standard colors;. More...
 
void setAlpha (double a)
 Sets unitary alpha value for all colors. More...
 
void setColorVector (Qwt3D::ColorVector const &cv)
 

Public Attributes

double maxZ
 
double minZ
 

Protected Attributes

Qwt3D::ColorVector colors_
 
Qwt3D::Plot3D * data_
 

Detailed Description

Definition at line 18 of file qwt3dColor.h.

Constructor & Destructor Documentation

BarColor::BarColor ( Qwt3D::Plot3D *  data,
unsigned  size = 100,
double  min = 0,
double  max = 0 
)
explicit

Initializes with data and set up a ColorVector with a size of 100 z values (default);.

Definition at line 16 of file qwt3dColor.cpp.

References data_, max, maxZ, min, minZ, and reset().

17  : data_(data)
18 {
19  Q_ASSERT(data_);
20  reset(size);
21 
22  minZ = min;
23  maxZ = max;
24 }
Qwt3D::Plot3D * data_
Definition: qwt3dColor.h:39
double maxZ
Definition: qwt3dColor.h:35
double minZ
Definition: qwt3dColor.h:36
void reset(unsigned size=100)
Resets the standard colors;.
Definition: qwt3dColor.cpp:26
#define min(a, b)
Definition: f2c.h:175
#define max(a, b)
Definition: f2c.h:176

Member Function Documentation

Qwt3D::ColorVector& BarColor::createVector ( Qwt3D::ColorVector &  vec)
inline

Creates a color vector used by ColorLegend. This is essentially a copy from the internal used vector.

Returns
The vector created

Definition at line 33 of file qwt3dColor.h.

33 {vec = colors_; return vec;}
Qwt3D::ColorVector colors_
Definition: qwt3dColor.h:38
Qwt3D::RGBA BarColor::operator() ( double  x,
double  y,
double  z 
) const

Receives z-dependend color from ColorVector.

Definition at line 69 of file qwt3dColor.cpp.

References colors_, data_, maxZ, and minZ.

70  {
71  Q_ASSERT(data_);
72 
73  int index = (int)((colors_.size() - 1) * (z - minZ) / (maxZ - minZ));
74  if (index < 0)
75  index = 0;
76  if ((unsigned int)index > colors_.size() - 1)
77  index = (int)(colors_.size() - 1);
78  return colors_[index];
79  }
Qwt3D::Plot3D * data_
Definition: qwt3dColor.h:39
double maxZ
Definition: qwt3dColor.h:35
Qwt3D::ColorVector colors_
Definition: qwt3dColor.h:38
double minZ
Definition: qwt3dColor.h:36
void BarColor::reset ( unsigned  size = 100)

Resets the standard colors;.

Definition at line 26 of file qwt3dColor.cpp.

References colors_.

Referenced by BarColor().

27 {
28  unsigned int i;
29  colors_ = Qwt3D::ColorVector(size);
30  Qwt3D::RGBA elem;
31 
32  double dsize = size;
33 
34  for (i = 0; i != size; ++i)
35  {
36  elem.r = i / dsize;
37  elem.g = i / dsize / 4;
38  elem.b = 1 - i / dsize;
39  elem.a = 1.0;
40  colors_[i] = elem;
41  }
42 }
Qwt3D::ColorVector colors_
Definition: qwt3dColor.h:38
void BarColor::setAlpha ( double  a)

Sets unitary alpha value for all colors.

Definition at line 52 of file qwt3dColor.cpp.

References colors_.

53 {
54  unsigned int i;
55 
56  if (a < 0 || a > 1)
57  return;
58 
59  Qwt3D::RGBA elem;
60 
61  for (i = 0; i != colors_.size(); ++i)
62  {
63  elem = colors_[i];
64  elem.a = a;
65  colors_[i] = elem;
66  }
67 }
Qwt3D::ColorVector colors_
Definition: qwt3dColor.h:38
void BarColor::setColorVector ( Qwt3D::ColorVector const &  cv)

Assigns a new ColorVector (Also overwrites the constructors size argument)

Definition at line 47 of file qwt3dColor.cpp.

References colors_.

Referenced by CQBarChart::setColors().

48 {
49  colors_ = cv;
50 }
Qwt3D::ColorVector colors_
Definition: qwt3dColor.h:38

Member Data Documentation

Qwt3D::ColorVector BarColor::colors_
protected

Definition at line 38 of file qwt3dColor.h.

Referenced by operator()(), reset(), setAlpha(), and setColorVector().

Qwt3D::Plot3D* BarColor::data_
protected

Definition at line 39 of file qwt3dColor.h.

Referenced by BarColor(), and operator()().

double BarColor::maxZ

Definition at line 35 of file qwt3dColor.h.

Referenced by BarColor(), and operator()().

double BarColor::minZ

Definition at line 36 of file qwt3dColor.h.

Referenced by BarColor(), and operator()().


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