QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
qwt3d_coordsys.h
1#ifndef QWT3D_COORDSYS_H
2#define QWT3D_COORDSYS_H
3
4#include "qwt3d_axis.h"
5#include "qwt3d_colorlegend.h"
6
7
8
12class QWT3D_EXPORT Qwt3DCoordinateSystem : public Qwt3DDrawable
13{
14 QWT_DECLARE_PRIVATE(Qwt3DCoordinateSystem)
15
16public:
17 explicit Qwt3DCoordinateSystem(Triple blb = Triple(0, 0, 0),
18 Triple ftr = Triple(0, 0, 0),
19 COORDSTYLE = BOX);
20 ~Qwt3DCoordinateSystem() override;
21
22 void init(Triple beg = Triple(0, 0, 0), Triple end = Triple(0, 0, 0));
23 // Set style for the coordinate system (NOCOORD, FRAME or BOX)
24 void setStyle(COORDSTYLE s,
25 AXIS frame_1 = X1,
26 AXIS frame_2 = Y1,
27 AXIS frame_3 = Z1);
28 // Return style of the coordinate system
29 COORDSTYLE style() const;
30 // first == front_left_bottom, second == back_right_top
31 void setPosition(Triple first, Triple second);
32
33 // Set common color for all axes
34 void setAxesColor(RGBA val);
35 // Returns the common axes color
36 RGBA axesColor() const;
37 // Set common font for all axis numberings
38 void setNumberFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
39 // Set common font for all axis numberings
40 void setNumberFont(QFont const& font);
41 // Returns the common number font (delegates to first axis)
42 QFont numberFont() const;
43 // Set common color for all axis numberings
44 void setNumberColor(RGBA val);
45 // Returns the common number color
46 RGBA numberColor() const;
47 // Sets an linear axis with real number items
48 void setStandardScale();
49
50 // Fine tunes distance between axis numbering and axis body
51 void adjustNumbers(int val);
52 // Fine tunes distance between axis label and axis body
53 void adjustLabels(int val);
54
55 // Sets color for the grid lines
56 void setGridLinesColor(RGBA val);
57 // Returns the grid lines color
58 RGBA gridLinesColor() const;
59
60 // Set common font for all axis labels
61 void setLabelFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
62 // Set common font for all axis labels
63 void setLabelFont(QFont const& font);
64 // Returns the common label font (delegates to first axis)
65 QFont labelFont() const;
66 // Set common color for all axis labels
67 void setLabelColor(RGBA val);
68 // Returns the common label color
69 RGBA labelColor() const;
70
71 // Set line width for tic marks and axes
72 void setLineWidth(double val, double majfac = 0.9, double minfac = 0.5);
73 // Set length for tic marks (explicit override; persists across data changes)
74 void setTicLength(double major, double minor);
75 // Returns the explicit tic lengths (only meaningful after setTicLength(); use ticLengthScale() to check if auto)
76 void ticLength(double& major, double& minor) const;
77 // Set the automatic tic-length scale: fraction of the per-axis data range in
78 // the tick's own pointing direction (default 0.015). Switches back to automatic
79 // per-axis derivation, clearing any explicit length set via setTicLength().
80 void setTicLengthScale(double scale);
81 // Returns the automatic tic-length scale
82 double ticLengthScale() const;
83 // Switch to automatic per-axis tic-length derivation (clears explicit override)
84 void setAutoTicLength();
85
86 // Switch autoscaling of axes
87 void setAutoScale(bool val = true);
88 // Returns true if autoscaling is enabled (delegates to first axis)
89 bool autoScale() const;
90
91 Triple first() const;
92 Triple second() const;
93
94 void setAutoDecoration(bool val = true);
95 bool autoDecoration() const;
96
97 // Set tick position preference for auto-decorated axes
98 // TICK_BOTTOM (default): ticks on visually lower axis; TICK_TOP: ticks on visually upper axis
99 void setTickPosition(TICKPOSITION val);
100 // Returns tick position preference
101 TICKPOSITION tickPosition() const;
102
103 // Draw smooth axes
104 void setLineSmooth(bool val = true);
105 // Smooth axes enabled?
106 bool lineSmooth() const;
107
108 void draw(const Qwt3DRenderContext& ctx) override;
109
110 // Defines whether a grid between the major and/or minor tics should be drawn
111 void setGridLines(bool majors, bool minors, int sides = NOSIDEGRID);
112 // Returns grids switched on
113 int grids() const;
114
115 // Set interior grid lines through the box volume
116 void setInteriorGridLines(bool majors, bool minors, int directions = NO_INTERIOR);
117 // Returns interior grid directions switched on
118 int interiorGrids() const;
119 // Sets color for the interior grid lines
120 void setInteriorGridLinesColor(RGBA val);
121 // Returns the interior grid lines color
122 RGBA interiorGridLinesColor() const;
123 // Sets line width for interior grid lines
124 void setInteriorGridLinesWidth(double major, double minor);
125
126 // The vector of all 12 axes - use them to set axis properties individually
127 std::vector< Qwt3DAxis > axes;
128
129private:
130 void destroy();
131 void chooseAxes(const Qwt3DRenderContext& ctx);
132 void autoDecorateExposedAxis(const Qwt3DRenderContext& ctx, Qwt3DAxis& ax, bool left);
133 void drawMajorGridLines(const Qwt3DRenderContext& ctx);
134 void drawMinorGridLines(const Qwt3DRenderContext& ctx);
135 void drawMajorGridLines(Qwt3DAxis&, Qwt3DAxis&, QVector<float>& verts);
136 void drawMinorGridLines(Qwt3DAxis&, Qwt3DAxis&, QVector<float>& verts);
137 void drawInteriorMajorGridLines(const Qwt3DRenderContext& ctx);
138 void drawInteriorMinorGridLines(const Qwt3DRenderContext& ctx);
139 void drawInteriorGridLines(Qwt3DAxis& axisA, Qwt3DAxis& axisB,
140 int dirAxis, bool major, QVector<float>& verts);
141 void recalculateAxesTics();
142 // Applies the current tic-length model (auto per-axis, or explicit manual) to all axes
143 void applyTicLengths();
144 void drawGridLines(const Qwt3DRenderContext& ctx, const QVector<float>& vertices, double lineWidth, const RGBA& color);
145};
146
147
148#endif
Definition qwt_clipper.h:41
Autoscalable axis with caption.
Definition qwt3d_axis.h:19
A coordinate system with different styles (BOX, FRAME)
Definition qwt3d_coordsys.h:13
Abstract base class for Drawables.
Definition qwt3d_drawable.h:18
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