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
11
12
18class QWT3D_EXPORT Qwt3DAxis : public Qwt3DDrawable
19{
20 QWT_DECLARE_PRIVATE(Qwt3DAxis)
21
22public:
23 // Constructs standard axis
24 Qwt3DAxis();
25 // Constructs a new axis with specified limits
26 Qwt3DAxis(Triple beg, Triple end);
27 // Destructor
28 ~Qwt3DAxis() override;
29
30 // Draws axis
31 void draw(const Qwt3DRenderContext& ctx) override;
32
33 // Positionate axis
34 void setPosition(const Triple& beg, const Triple& end);
35 // Returns axis' position
36 void position(Triple& beg, Triple& end) const;
37 // Returns axis' beginning position
38 Triple begin() const;
39 // Returns axis' ending position
40 Triple end() const;
41 // Returns axis' length
42 double length() const;
43
44 // Sets tics lengths in world coordinates
45 void setTicLength(double majorl, double minorl);
46 // Returns tics lengths
47 void ticLength(double& majorl, double& minorl) const;
48 // Sets tic orientation
49 void setTicOrientation(double tx, double ty, double tz);
50 // Same function as above
51 void setTicOrientation(const Triple& val);
52 // Returns tic orientation
53 Triple ticOrientation() const;
54 // Sets two-sided tics (default is false)
55 void setSymmetricTics(bool b);
56
57 // Sets font for axis label
58 void setLabelFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
59 // Sets font for axis label
60 void setLabelFont(QFont const& font);
61 // Returns current label font
62 QFont const& labelFont() const;
63
64 // Sets label content
65 void setLabelString(QString const& name);
66 // Returns whether the axis title is drawn
67 bool label() const;
68 // Returns label content
69 QString labelString() const;
70 void setLabelPosition(const Triple& pos, ANCHOR);
71 void setLabelColor(RGBA col);
72 // Returns the label color
73 RGBA labelColor() const;
74 // Turns label drawing on or off
75 void setLabel(bool val);
76 // Shifts label in device coordinates dependent on anchor
77 void adjustLabel(int val);
78
79 // Turns scale drawing on or off
80 void setScaling(bool val);
81 // Returns, if scale drawing is on or off
82 bool scaling() const;
83 void setScale(SCALETYPE);
84 void setScale(Qwt3DScale* item);
85 // Returns the active scale object (the clone stored by setScale())
86 const Qwt3DScale* scale() const;
87 // Turns number drawing on or off
88 void setNumbers(bool val);
89 // Returns, if number drawing is on or off
90 bool numbers() const;
91 // Sets the color for axes numbers
92 void setNumberColor(RGBA col);
93 // Returns the color for axes numbers
94 RGBA numberColor() const;
95 // Sets font for numbering
96 void setNumberFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
97 // Overloaded member, works like the above function
98 void setNumberFont(QFont const&);
99 // Returns current numbering font
100 QFont const& numberFont() const;
101 // Sets anchor position for numbers
102 void setNumberAnchor(ANCHOR a);
103 // Shifts axis numbers in device coordinates dependent on anchor
104 void adjustNumbers(int val);
105
106 // Turns Autoscaling on or off
107 void setAutoScale(bool val = true);
108 // actual Autoscaling mode
109 bool autoScale() const;
110
111 // Requests major intervals (maybe changed, if autoscaling is present)
112 void setMajors(int val);
113 // Requests minor intervals
114 void setMinors(int val);
115 // Returns number of major intervals
116 int majors() const;
117 // Returns number of minor intervals
118 int minors() const;
119 // Returns positions for actual major tics (also if invisible)
120 TripleField const& majorPositions() const;
121 // Returns positions for actual minor tics (also if invisible)
122 TripleField const& minorPositions() const;
123
124 // Sets line width for axis components
125 void setLineWidth(double val, double majfac = 0.9, double minfac = 0.5);
126 // Returns line width for axis body
127 double lineWidth() const;
128 // Returns Line width for major tics
129 double majLineWidth() const;
130 // Returns Line width for minor tics
131 double minLineWidth() const;
132
133 // Sets interval
134 void setLimits(double start, double stop);
135 // Returns axis interval
136 void limits(double& start, double& stop) const;
137 // Enforces recalculation of ticmark positions
138 void recalculateTics();
139
140private:
141 void init();
142 void drawBase(const Qwt3DRenderContext& ctx);
143 void drawTics(const Qwt3DRenderContext& ctx);
144 void drawTicLabel(const Qwt3DRenderContext& ctx, Triple Pos, int mtic);
145 Triple drawTic(Triple nadir, double length);
146 void drawLabel(const Qwt3DRenderContext& ctx);
147 bool prepTicCalculation(Triple& startpoint);
148
149 Triple biggestNumberString(const Qwt3DRenderContext& ctx);
150
151 void drawLines(const Qwt3DRenderContext& ctx, const QVector<float>& vertices, double lineWidth);
152};
153
154
155#endif
Definition qwt_clipper.h:41
Autoscalable axis with caption
Definition qwt3d_axis.h:19
Abstract base class for Drawables
Definition qwt3d_drawable.h:18
Non-visual scale class encapsulating tic generation
Definition qwt3d_scale.h:22
Bundles all widget resources that drawables need during rendering
Definition qwt3d_render_context.h:38
Red-Green-Blue-Alpha value
Definition qwt3d_types.h:395
Triple [x,y,z]
Definition qwt3d_types.h:201