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

The standard (1:1) mapping class for axis numbering. More...

#include <qwt3dScale.h>

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

Public Member Functions

QString ticLabel (unsigned int idx) const
 

Protected Member Functions

int autoscale (double &a, double &b, double start, double stop, int ivals)
 Applies LinearAutoScaler::execute() More...
 
void calculate ()
 Creates the major and minor vector for the scale. More...
 
Qwt3D::Scale * clone () const
 Returns a new heap based object utilized from qwt3d_ptr. More...
 

Protected Attributes

LinearAutoScaler2 autoscaler_p2
 

Friends

class Qwt3D::Axis
 
class Qwt3D::qwt3d_ptr< Qwt3D::Scale >
 

Detailed Description

The standard (1:1) mapping class for axis numbering.

Definition at line 33 of file qwt3dScale.h.

Member Function Documentation

int ValueScale::autoscale ( double &  a,
double &  b,
double  start,
double  stop,
int  ivals 
)
protected

Applies LinearAutoScaler::execute()

Definition at line 34 of file qwt3dScale.cpp.

35 {
36  return autoscaler_p2.execute2(a, b, start, stop, ivals);
37 }
int execute2(double &a, double &b, double start, double stop, int ivals)
Definition: qwt3dScale.cpp:27
LinearAutoScaler2 autoscaler_p2
Definition: qwt3dScale.h:42
void ValueScale::calculate ( )
protected

Creates the major and minor vector for the scale.

Definition at line 40 of file qwt3dScale.cpp.

41 {
42  int i;
43  int j;
44  majors_p.clear();
45  minors_p.clear();
46 
47  double interval = mstop_p - mstart_p;
48 
49  double runningval;
50 
51  // majors
52 
53  // first tic
54  if (mstart_p < start_p || mstop_p > stop_p)
55  return;
56 
57  majors_p.push_back(mstart_p);
58 
59  // remaining tics
60  for (i = 1; i <= majorintervals_p; ++i)
61  {
62  double t = double(i) / majorintervals_p;
63  runningval = mstart_p + t * interval;
64 
65  if (runningval > stop_p)
66  break;
67 
68  if (isPracticallyZero(mstart_p, -t*interval)) // prevent rounding errors near 0
69  runningval = 0.0;
70 
71  majors_p.push_back(runningval);
72  }
73 
74  majorintervals_p = (int) majors_p.size();
75 
76  if (majorintervals_p)
77  --majorintervals_p;
78 
79  // minors
80  if (!majorintervals_p || !minorintervals_p) // no valid interval
81  {
82  minorintervals_p = 0;
83  return;
84  }
85 
86  // start_p mstart_p
87  // |_____________|_____ _ _ _
88 
89  double step = (majors_p[1] - majors_p[0]) / minorintervals_p;
90 
91  if (isPracticallyZero(step))
92  return;
93 
94  runningval = mstart_p - step;
95 
96  while (runningval > start_p)
97  {
98  minors_p.push_back(runningval);
99  runningval -= step;
100  }
101 
102  // mstart_p mstop_p
103  // ________|_____ _ _ _ _ _ ___|__________
104 
105  for (i = 0; i != majorintervals_p; ++i)
106  {
107  runningval = majors_p[i] + step;
108 
109  for (j = 0; j != minorintervals_p; ++j)
110  {
111  minors_p.push_back(runningval);
112  runningval += step;
113  }
114  }
115 
116  // mstop_p stop_p
117  // _ _ _|_____________|
118 
119  runningval = mstop_p + step;
120 
121  while (runningval < stop_p)
122  {
123  minors_p.push_back(runningval);
124  runningval += step;
125  }
126 }
Qwt3D::Scale* ValueScale::clone ( ) const
inlineprotected

Returns a new heap based object utilized from qwt3d_ptr.

Definition at line 40 of file qwt3dScale.h.

40 {return new ValueScale(*this);}
The standard (1:1) mapping class for axis numbering.
Definition: qwt3dScale.h:33
QString ValueScale::ticLabel ( unsigned int  idx) const

Definition at line 128 of file qwt3dScale.cpp.

129 {
130  if (idx < majors_p.size())
131  {
132  return QString::number(majors_p[idx]);
133  }
134 
135  return QString("");
136 }

Friends And Related Function Documentation

friend class Qwt3D::Axis
friend

Definition at line 35 of file qwt3dScale.h.

friend class Qwt3D::qwt3d_ptr< Qwt3D::Scale >
friend

Definition at line 36 of file qwt3dScale.h.

Member Data Documentation

LinearAutoScaler2 ValueScale::autoscaler_p2
protected

Definition at line 42 of file qwt3dScale.h.


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