QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt3d_scale.h
1#ifndef QWT3D_SCALE_H
2#define QWT3D_SCALE_H
3
4#include <vector>
5#include <qstring.h>
6#include "qwt3d_types.h"
7#include "qwt3d_autoptr.h"
8
9namespace Qwt3D
10{
11
21class QWT3D_EXPORT Scale
22{
23 friend class Axis;
24 friend class ClonePtr< Scale >;
25
26protected:
27 QWT_DECLARE_PRIVATE(Scale)
28
29 Scale();
30 virtual ~Scale();
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 Scale* 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 Scale base state from another Scale (used by derived clone())
57 void copyFrom(const Scale& other);
58
59private:
60 void destroy() const;
61};
62
66class QWT3D_EXPORT LinearScale : public Scale
67{
68 friend class Axis;
69 friend class ClonePtr< Scale >;
70
71protected:
72 QWT_DECLARE_PRIVATE(LinearScale)
73
75 ~LinearScale() override;
76 int autoscale(double& a, double& b, double start, double stop, int ivals) override;
77 // Returns a new heap based object utilized from ClonePtr
78 Scale* clone() const override;
79 void calculate() override;
80};
81
85class QWT3D_EXPORT LogScale : public Scale
86{
87 friend class Axis;
88 friend class ClonePtr< Scale >;
89
90protected:
91 QString ticLabel(unsigned int idx) const override;
92 void setMinors(int val) override;
93 // Standard ctor
94 LogScale();
95 ~LogScale() override;
96 // Returns a new heap based object utilized from ClonePtr
97 Scale* clone() const override;
98 void calculate() override;
99
100private:
101 void setupCounter(double& k, int& step);
102};
103
104} // namespace Qwt3D
105
106#endif // QWT3D_SCALE_H
Autoscalable axis with caption
Definition qwt3d_axis.h:20
Simple auto pointer providing deep copies for raw pointer
Definition qwt3d_autoptr.h:19
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:86
Non-visual scale class encapsulating tic generation
Definition qwt3d_scale.h:22