QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
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 label content
67 QString labelString() const;
68 void setLabelPosition(const Triple& pos, ANCHOR);
69 void setLabelColor(RGBA col);
70 // Returns the label color
71 RGBA labelColor() const;
72 // Turns label drawing on or off
73 void setLabel(bool val);
74 // Shifts label in device coordinates dependent on anchor
75 void adjustLabel(int val);
76
77 // Turns scale drawing on or off
78 void setScaling(bool val);
79 // Returns, if scale drawing is on or off
80 bool scaling() const;
81 void setScale(SCALETYPE);
82 void setScale(Qwt3DScale* item);
83 // Turns number drawing on or off
84 void setNumbers(bool val);
85 // Returns, if number drawing is on or off
86 bool numbers() const;
87 // Sets the color for axes numbers
88 void setNumberColor(RGBA col);
89 // Returns the color for axes numbers
90 RGBA numberColor() const;
91 // Sets font for numbering
92 void setNumberFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
93 // Overloaded member, works like the above function
94 void setNumberFont(QFont const&);
95 // Returns current numbering font
96 QFont const& numberFont() const;
97 // Sets anchor position for numbers
98 void setNumberAnchor(ANCHOR a);
99 // Shifts axis numbers in device coordinates dependent on anchor
100 void adjustNumbers(int val);
101
102 // Turns Autoscaling on or off
103 void setAutoScale(bool val = true);
104 // actual Autoscaling mode
105 bool autoScale() const;
106
107 // Requests major intervals (maybe changed, if autoscaling is present)
108 void setMajors(int val);
109 // Requests minor intervals
110 void setMinors(int val);
111 // Returns number of major intervals
112 int majors() const;
113 // Returns number of minor intervals
114 int minors() const;
115 // Returns positions for actual major tics (also if invisible)
116 TripleField const& majorPositions() const;
117 // Returns positions for actual minor tics (also if invisible)
118 TripleField const& minorPositions() const;
119
120 // Sets line width for axis components
121 void setLineWidth(double val, double majfac = 0.9, double minfac = 0.5);
122 // Returns line width for axis body
123 double lineWidth() const;
124 // Returns Line width for major tics
125 double majLineWidth() const;
126 // Returns Line width for minor tics
127 double minLineWidth() const;
128
129 // Sets interval
130 void setLimits(double start, double stop);
131 // Returns axis interval
132 void limits(double& start, double& stop) const;
133 // Enforces recalculation of ticmark positions
134 void recalculateTics();
135
136private:
137 void init();
138 void drawBase(const Qwt3DRenderContext& ctx);
139 void drawTics(const Qwt3DRenderContext& ctx);
140 void drawTicLabel(const Qwt3DRenderContext& ctx, Triple Pos, int mtic);
141 Triple drawTic(Triple nadir, double length);
142 void drawLabel(const Qwt3DRenderContext& ctx);
143 bool prepTicCalculation(Triple& startpoint);
144
145 Triple biggestNumberString(const Qwt3DRenderContext& ctx);
146
147 void drawLines(const Qwt3DRenderContext& ctx, const QVector<float>& vertices, double lineWidth);
148};
149
150
151#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:21
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