QWT API (English) 7.3.0
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 <vector>
5#include <qstring.h>
6#include <QVector>
7#include "qwt3d_types.h"
8#include "qwt3d_autoptr.h"
9
10
11
21class QWT3D_EXPORT Qwt3DScale
22{
23 friend class Qwt3DAxis;
24 friend class Qwt3DClonePtr< Qwt3DScale >;
25
26protected:
27 QWT_DECLARE_PRIVATE(Qwt3DScale)
28
29 Qwt3DScale();
30 virtual ~Qwt3DScale();
31 virtual QString ticLabel(unsigned int idx) const;
32
33 virtual void setLimits(double start, double stop);
34 // Sets number of major intervals
35 virtual void setMajors(int val);
36 // Sets number of minor intervals per major interval
37 virtual void setMinors(int val);
38 virtual void setMajorLimits(double start, double stop);
39
40 // Returns major intervals
41 int majors() const;
42 // Returns minor intervals
43 int minors() const;
44
45 // Derived classes should return a new heap based object here
46 virtual Qwt3DScale* clone() const = 0;
47 // This function should setup the 2 vectors for major and minor positions
48 virtual void calculate() = 0;
49 virtual int autoscale(double& a, double& b, double start, double stop, int ivals);
50
51 // Returns const reference to major tic positions
52 const std::vector< double >& majorTicks() const;
53 // Returns const reference to minor tic positions
54 const std::vector< double >& minorTicks() const;
55
56 // Copies Qwt3DScale base state from another Qwt3DScale (used by derived clone())
57 void copyFrom(const Qwt3DScale& other);
58
59private:
60 void destroy() const;
61};
62
66class QWT3D_EXPORT Qwt3DLinearScale : public Qwt3DScale
67{
68 friend class Qwt3DAxis;
69 friend class Qwt3DClonePtr< Qwt3DScale >;
70
71protected:
72 QWT_DECLARE_PRIVATE(Qwt3DLinearScale)
73
75 ~Qwt3DLinearScale() override;
76 int autoscale(double& a, double& b, double start, double stop, int ivals) override;
77 // Returns a new heap based object utilized from Qwt3DClonePtr
78 Qwt3DScale* clone() const override;
79 void calculate() override;
80
81 // Copies the linear autoscaler state (for derived clone() implementations)
82 void copyLinearScaleState(const Qwt3DLinearScale& other);
83};
84
88class QWT3D_EXPORT Qwt3DLogScale : public Qwt3DScale
89{
90 friend class Qwt3DAxis;
91 friend class Qwt3DClonePtr< Qwt3DScale >;
92
93protected:
94 QString ticLabel(unsigned int idx) const override;
95 void setMinors(int val) override;
96 // Standard ctor
98 ~Qwt3DLogScale() override;
99 // Returns a new heap based object utilized from Qwt3DClonePtr
100 Qwt3DScale* clone() const override;
101 void calculate() override;
102
103private:
104 void setupCounter(double& k, int& step);
105};
106
126class QWT3D_EXPORT Qwt3DTextScale : public Qwt3DLinearScale
127{
128 friend class Qwt3DAxis;
129 friend class Qwt3DClonePtr< Qwt3DScale >;
130
131public:
133
135 void setLabels(const QVector<QString>& labels);
137 QVector<QString> labels() const;
138
139protected:
140 QString ticLabel(unsigned int idx) const override;
141 // Must override: Qwt3DAxis::setScale() clones the object via Qwt3DClonePtr
142 Qwt3DScale* clone() const override;
143
144private:
145 QVector<QString> m_labels;
146};
147
148
149#endif // QWT3D_SCALE_H
Definition qwt_clipper.h:41
Autoscalable axis with caption.
Definition qwt3d_axis.h:19
Simple auto pointer providing deep copies for raw pointer.
Definition qwt3d_autoptr.h:18
The standard (1:1) mapping class for axis numbering.
Definition qwt3d_scale.h:67
int autoscale(double &a, double &b, double start, double stop, int ivals) override
Autoscales the axis.
Log10 scale.
Definition qwt3d_scale.h:89
Non-visual scale class encapsulating tic generation.
Definition qwt3d_scale.h:22
Linear scale whose major tic labels come from a user supplied string list.
Definition qwt3d_scale.h:127