QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt3d_axis.h
1#ifndef __AXIS_H__
2#define __AXIS_H__
3
4#include "qwt3d_autoptr.h"
5#include "qwt3d_label.h"
6#include "qwt3d_scale.h"
7#include "qwt3d_autoscaler.h"
8
9
10namespace Qwt3D
11{
12
25class QWT3D_EXPORT Axis : public Drawable
26{
27
28public:
29 // Constructs standard axis
30 Axis();
31 // Constructs a new axis with specified limits
33 // Destructor
34 virtual ~Axis();
35
36 // Draws axis
37 virtual void draw();
38
39 // Positionate axis
40 void setPosition(const Qwt3D::Triple& beg, const Qwt3D::Triple& end);
41 // Returns axis' position
42 void position(Qwt3D::Triple& beg, Qwt3D::Triple& end) const
43 {
44 beg = beg_;
45 end = end_;
46 }
47 // Returns axis' beginning position
48 Qwt3D::Triple begin() const
49 {
50 return beg_;
51 }
52 // Returns axis' ending position
53 Qwt3D::Triple end() const
54 {
55 return end_;
56 }
57 // Returns axis' length
58 double length() const
59 {
60 return (end_ - beg_).length();
61 }
62
63 // Sets tics lengths in world coordinates
64 void setTicLength(double majorl, double minorl);
65 // Returns tics lengths
66 void ticLength(double& majorl, double& minorl) const
67 {
68 majorl = lmaj_;
69 minorl = lmin_;
70 }
71 // Sets tic orientation
72 void setTicOrientation(double tx, double ty, double tz);
73 // Same function as above
74 void setTicOrientation(const Qwt3D::Triple& val);
75 // Returns tic orientation
76 Qwt3D::Triple ticOrientation() const
77 {
78 return orientation_;
79 }
80 // Sets two-sided tics (default is false)
81 void setSymmetricTics(bool b)
82 {
83 symtics_ = b;
84 }
85
86 // Sets font for axis label
87 void setLabelFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
88 // Sets font for axis label
89 void setLabelFont(QFont const& font);
90 // Returns current label font
91 QFont const& labelFont() const
92 {
93 return labelfont_;
94 }
95
96 // Sets label content
97 void setLabelString(QString const& name);
98 void setLabelPosition(const Qwt3D::Triple& pos, Qwt3D::ANCHOR);
99 void setLabelColor(Qwt3D::RGBA col);
100 // Turns label drawing on or off
101 void setLabel(bool d)
102 {
103 drawLabel_ = d;
104 }
105 // Shifts label in device coordinates dependent on anchor
106 void adjustLabel(int val)
107 {
108 labelgap_ = val;
109 }
110
111 // Turns scale drawing on or off
112 void setScaling(bool d)
113 {
114 drawTics_ = d;
115 }
116 // Returns, if scale drawing is on or off
117 bool scaling() const
118 {
119 return drawTics_;
120 }
121 void setScale(Qwt3D::SCALETYPE);
122 void setScale(Scale* item);
123 // Turns number drawing on or off
124 void setNumbers(bool d)
125 {
126 drawNumbers_ = d;
127 }
128 // Returns, if number drawing is on or off
129 bool numbers() const
130 {
131 return drawNumbers_;
132 }
133 // Sets the color for axes numbers
134 void setNumberColor(Qwt3D::RGBA col);
135 // Returns the color for axes numbers
136 Qwt3D::RGBA numberColor() const
137 {
138 return numbercolor_;
139 }
140 // Sets font for numbering
141 void setNumberFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
142 // Overloaded member, works like the above function
143 void setNumberFont(QFont const&);
144 // Returns current numbering font
145 QFont const& numberFont() const
146 {
147 return numberfont_;
148 }
149 // Sets anchor position for numbers
150 void setNumberAnchor(Qwt3D::ANCHOR a)
151 {
152 scaleNumberAnchor_ = a;
153 }
154 // Shifts axis numbers in device coordinates dependent on anchor
155 void adjustNumbers(int val)
156 {
157 numbergap_ = val;
158 }
159
160 // Turns Autoscaling on or off
161 void setAutoScale(bool val = true)
162 {
163 autoscale_ = val;
164 }
165 // actual Autoscaling mode
166 bool autoScale() const
167 {
168 return autoscale_;
169 }
170
171 // Requests major intervals (maybe changed, if autoscaling is present)
172 void setMajors(int val);
173 // Requests minor intervals
174 void setMinors(int val);
175 // Returns number of major intervals
176 int majors() const
177 {
178 return majorintervals_;
179 }
180 // Returns number of minor intervals
181 int minors() const
182 {
183 return minorintervals_;
184 }
185 // Returns positions for actual major tics (also if invisible)
186 Qwt3D::TripleField const& majorPositions() const
187 {
188 return majorpos_;
189 }
190 // Returns positions for actual minor tics (also if invisible)
191 Qwt3D::TripleField const& minorPositions() const
192 {
193 return minorpos_;
194 }
195
196 // Sets line width for axis components
197 void setLineWidth(double val, double majfac = 0.9, double minfac = 0.5);
198 // Returns line width for axis body
199 double lineWidth() const
200 {
201 return lineWidth_;
202 }
203 // Returns Line width for major tics
204 double majLineWidth() const
205 {
206 return majLineWidth_;
207 }
208 // Returns Line width for minor tics
209 double minLineWidth() const
210 {
211 return minLineWidth_;
212 }
213
214 // Sets interval
215 void setLimits(double start, double stop)
216 {
217 start_ = start;
218 stop_ = stop;
219 }
220 // Returns axis interval
221 void limits(double& start, double& stop) const
222 {
223 start = start_;
224 stop = stop_;
225 }
226 // Enforces recalculation of ticmark positions
227 void recalculateTics();
228
229private:
230 void init();
231 void drawBase();
232 void drawTics();
233 void drawTicLabel(Qwt3D::Triple Pos, int mtic);
234 Qwt3D::Triple drawTic(Qwt3D::Triple nadir, double length);
235 void drawLabel();
236 bool prepTicCalculation(Triple& startpoint);
237
238 Qwt3D::Triple biggestNumberString();
239
240 Qwt3D::ANCHOR scaleNumberAnchor_;
241 Qwt3D::Label label_;
242 std::vector< Qwt3D::Label > markerLabel_;
243
244 Qwt3D::Triple beg_, end_;
245 Qwt3D::TripleField majorpos_, minorpos_;
246
247 Qwt3D::Triple ncube_beg_, ncube_end_;
248
249 double start_, stop_, autostart_, autostop_;
250 double lmaj_, lmin_;
251 Qwt3D::Triple orientation_;
252
253 int majorintervals_, minorintervals_;
254
255 double lineWidth_, majLineWidth_, minLineWidth_;
256 bool symtics_;
257 bool drawNumbers_, drawTics_, drawLabel_;
258 bool autoscale_;
259 QFont numberfont_, labelfont_;
260 Qwt3D::RGBA numbercolor_;
261
262 int numbergap_, labelgap_;
263
265};
266
267} // ns
268
269#endif
带标题的自动缩放坐标轴
Definition qwt3d_axis.h:26
可绘制对象的抽象基类
Definition qwt3d_drawable.h:21
Qt 字符串或输出设备依赖的字符串
Definition qwt3d_label.h:27
非可视化刻度类,封装刻度线生成
Definition qwt3d_scale.h:31
红-绿-蓝-透明度值
Definition qwt3d_types.h:480
三元组 [x,y,z]
Definition qwt3d_types.h:240