QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt3d_axis.h
1#ifndef QWT3D_AXIS_H
2#define QWT3D_AXIS_H
3
4#include <qwt_global.h>
5
6#include "qwt3d_autoptr.h"
7#include "qwt3d_label.h"
8#include "qwt3d_scale.h"
9#include "qwt3d_autoscaler.h"
10
11namespace Qwt3D
12{
13
19class QWT3D_EXPORT Axis : public Drawable
20{
21 QWT_DECLARE_PRIVATE(Axis)
22
23public:
24 // Constructs standard axis
25 Axis();
26 // Constructs a new axis with specified limits
28 // Destructor
29 ~Axis() override;
30
31 // Draws axis
32 void draw() override;
33
34 // Positionate axis
35 void setPosition(const Qwt3D::Triple& beg, const Qwt3D::Triple& end);
36 // Returns axis' position
37 void position(Qwt3D::Triple& beg, Qwt3D::Triple& end) const;
38 // Returns axis' beginning position
39 Qwt3D::Triple begin() const;
40 // Returns axis' ending position
41 Qwt3D::Triple end() const;
42 // Returns axis' length
43 double length() const;
44
45 // Sets tics lengths in world coordinates
46 void setTicLength(double majorl, double minorl);
47 // Returns tics lengths
48 void ticLength(double& majorl, double& minorl) const;
49 // Sets tic orientation
50 void setTicOrientation(double tx, double ty, double tz);
51 // Same function as above
52 void setTicOrientation(const Qwt3D::Triple& val);
53 // Returns tic orientation
54 Qwt3D::Triple ticOrientation() const;
55 // Sets two-sided tics (default is false)
56 void setSymmetricTics(bool b);
57
58 // Sets font for axis label
59 void setLabelFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
60 // Sets font for axis label
61 void setLabelFont(QFont const& font);
62 // Returns current label font
63 QFont const& labelFont() const;
64
65 // Sets label content
66 void setLabelString(QString const& name);
67 void setLabelPosition(const Qwt3D::Triple& pos, Qwt3D::ANCHOR);
68 void setLabelColor(Qwt3D::RGBA col);
69 // Turns label drawing on or off
70 void setLabel(bool val);
71 // Shifts label in device coordinates dependent on anchor
72 void adjustLabel(int val);
73
74 // Turns scale drawing on or off
75 void setScaling(bool val);
76 // Returns, if scale drawing is on or off
77 bool scaling() const;
78 void setScale(Qwt3D::SCALETYPE);
79 void setScale(Scale* item);
80 // Turns number drawing on or off
81 void setNumbers(bool val);
82 // Returns, if number drawing is on or off
83 bool numbers() const;
84 // Sets the color for axes numbers
85 void setNumberColor(Qwt3D::RGBA col);
86 // Returns the color for axes numbers
87 Qwt3D::RGBA numberColor() const;
88 // Sets font for numbering
89 void setNumberFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
90 // Overloaded member, works like the above function
91 void setNumberFont(QFont const&);
92 // Returns current numbering font
93 QFont const& numberFont() const;
94 // Sets anchor position for numbers
95 void setNumberAnchor(Qwt3D::ANCHOR a);
96 // Shifts axis numbers in device coordinates dependent on anchor
97 void adjustNumbers(int val);
98
99 // Turns Autoscaling on or off
100 void setAutoScale(bool val = true);
101 // actual Autoscaling mode
102 bool autoScale() const;
103
104 // Requests major intervals (maybe changed, if autoscaling is present)
105 void setMajors(int val);
106 // Requests minor intervals
107 void setMinors(int val);
108 // Returns number of major intervals
109 int majors() const;
110 // Returns number of minor intervals
111 int minors() const;
112 // Returns positions for actual major tics (also if invisible)
113 Qwt3D::TripleField const& majorPositions() const;
114 // Returns positions for actual minor tics (also if invisible)
115 Qwt3D::TripleField const& minorPositions() const;
116
117 // Sets line width for axis components
118 void setLineWidth(double val, double majfac = 0.9, double minfac = 0.5);
119 // Returns line width for axis body
120 double lineWidth() const;
121 // Returns Line width for major tics
122 double majLineWidth() const;
123 // Returns Line width for minor tics
124 double minLineWidth() const;
125
126 // Sets interval
127 void setLimits(double start, double stop);
128 // Returns axis interval
129 void limits(double& start, double& stop) const;
130 // Enforces recalculation of ticmark positions
131 void recalculateTics();
132
133private:
134 void init();
135 void drawBase();
136 void drawTics();
137 void drawTicLabel(Qwt3D::Triple Pos, int mtic);
138 Qwt3D::Triple drawTic(Qwt3D::Triple nadir, double length);
139 void drawLabel();
140 bool prepTicCalculation(Triple& startpoint);
141
142 Qwt3D::Triple biggestNumberString();
143};
144
145} // ns
146
147#endif
Autoscalable axis with caption
Definition qwt3d_axis.h:20
Abstract base class for Drawables
Definition qwt3d_drawable.h:15
Non-visual scale class encapsulating tic generation
Definition qwt3d_scale.h:22
Red-Green-Blue-Alpha value
Definition qwt3d_types.h:364
Triple [x,y,z]
Definition qwt3d_types.h:170