QWT API (English) 7.0.1
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
qwt3d_scale.h
1#ifndef qwt3d_scale_h
2#define qwt3d_scale_h
3
4#include <qstring.h>
5#include "qwt3d_types.h"
6#include "qwt3d_autoscaler.h"
7#include "qwt3d_autoptr.h"
8
9namespace Qwt3D {
10
30class QWT3D_EXPORT Scale
31{
32 friend class Axis;
33 friend class qwt3d_ptr<Scale>;
34
35protected:
36 Scale();
37 virtual ~Scale() { }
38 virtual QString ticLabel(unsigned int idx) const;
39
40 virtual void setLimits(double start, double stop);
41 // Sets number of major intervals
42 virtual void setMajors(int val) { majorintervals_p = val; }
43 // Sets number of minor intervals per major interval
44 virtual void setMinors(int val)
45 {
46 minorintervals_p = val;
47 }
48 virtual void setMajorLimits(double start, double stop);
49
50 // Returns major intervals
51 int majors() const { return majorintervals_p; }
52 // Returns minor intervals
53 int minors() const { return minorintervals_p; }
54
55 // Derived classes should return a new heap based object here
56 virtual Scale *clone() const = 0;
57 // This function should setup the 2 vectors for major and minor positions
58 virtual void calculate() = 0;
59 virtual int autoscale(double &a, double &b, double start, double stop, int ivals);
60
61 std::vector<double> majors_p, minors_p;
62 double start_p, stop_p;
63 int majorintervals_p, minorintervals_p;
64 double mstart_p, mstop_p;
65
66private:
67 void destroy() const { delete this; }
68};
69
79class QWT3D_EXPORT LinearScale : public Scale
80{
81 friend class Axis;
82 friend class qwt3d_ptr<Scale>;
83
84protected:
85 int autoscale(double &a, double &b, double start, double stop, int ivals);
86 // Returns a new heap based object utilized from qwt3d_ptr
87 Scale *clone() const { return new LinearScale(*this); }
88 void calculate();
89 LinearAutoScaler autoscaler_p;
90};
91
101class QWT3D_EXPORT LogScale : public Scale
102{
103 friend class Axis;
104 friend class qwt3d_ptr<Scale>;
105
106protected:
107 QString ticLabel(unsigned int idx) const;
108 void setMinors(int val);
109 // Standard ctor
110 LogScale();
111 // Returns a new heap based object utilized from qwt3d_ptr
112 Scale *clone() const { return new LogScale; }
113 void calculate();
114
115private:
116 void setupCounter(double &k, int &step);
117};
118
119} // namespace Qwt3D
120
121#endif /* include guarded */
Autoscalable axis with caption.
Definition qwt3d_axis.h:26
Automatic beautifying of linear scales .
Definition qwt3d_autoscaler.h:42
The standard (1:1) mapping class for axis numbering .
Definition qwt3d_scale.h:80
Log10 scale .
Definition qwt3d_scale.h:102
Non-visual scale class encapsulating tic generation.
Definition qwt3d_scale.h:31
Simple auto pointer providing deep copies for raw pointer.
Definition qwt3d_autoptr.h:31