1 | #ifndef __COORDSYS_H__
|
---|
2 | #define __COORDSYS_H__
|
---|
3 |
|
---|
4 | #include "qwt3d_axis.h"
|
---|
5 | #include "qwt3d_colorlegend.h"
|
---|
6 |
|
---|
7 | namespace Qwt3D
|
---|
8 | {
|
---|
9 |
|
---|
10 | //! A coordinate system with different styles (BOX, FRAME)
|
---|
11 | class QWT3D_EXPORT CoordinateSystem : public Drawable
|
---|
12 | {
|
---|
13 |
|
---|
14 | public:
|
---|
15 | explicit CoordinateSystem(Qwt3D::Triple blb = Qwt3D::Triple(0,0,0), Qwt3D::Triple ftr = Qwt3D::Triple(0,0,0), Qwt3D::COORDSTYLE = Qwt3D::BOX);
|
---|
16 | ~CoordinateSystem();
|
---|
17 |
|
---|
18 | void init(Qwt3D::Triple beg = Qwt3D::Triple(0,0,0), Qwt3D::Triple end = Qwt3D::Triple(0,0,0));
|
---|
19 | //! Set style for the coordinate system (NOCOORD, FRAME or BOX)
|
---|
20 | void setStyle(Qwt3D::COORDSTYLE s, Qwt3D::AXIS frame_1 = Qwt3D::X1,
|
---|
21 | Qwt3D::AXIS frame_2 = Qwt3D::Y1,
|
---|
22 | Qwt3D::AXIS frame_3 = Qwt3D::Z1);
|
---|
23 | Qwt3D::COORDSTYLE style() const { return style_;} //!< Return style oft the coordinate system
|
---|
24 | void setPosition(Qwt3D::Triple first, Qwt3D::Triple second); //!< first == front_left_bottom, second == back_right_top
|
---|
25 |
|
---|
26 | void setAxesColor(Qwt3D::RGBA val); //!< Set common color for all axes
|
---|
27 | //! Set common font for all axis numberings
|
---|
28 | void setNumberFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
|
---|
29 | //! Set common font for all axis numberings
|
---|
30 | void setNumberFont(QFont const& font);
|
---|
31 | //! Set common color for all axis numberings
|
---|
32 | void setNumberColor(Qwt3D::RGBA val);
|
---|
33 | void setStandardScale(); //!< Sets an linear axis with real number items
|
---|
34 |
|
---|
35 | void adjustNumbers(int val); //!< Fine tunes distance between axis numbering and axis body
|
---|
36 | void adjustLabels(int val); //!< Fine tunes distance between axis label and axis body
|
---|
37 |
|
---|
38 | //! Sets color for the grid lines
|
---|
39 | void setGridLinesColor(Qwt3D::RGBA val) {gridlinecolor_ = val;}
|
---|
40 |
|
---|
41 | //! Set common font for all axis labels
|
---|
42 | void setLabelFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
|
---|
43 | //! Set common font for all axis labels
|
---|
44 | void setLabelFont(QFont const& font);
|
---|
45 | //! Set common color for all axis labels
|
---|
46 | void setLabelColor(Qwt3D::RGBA val);
|
---|
47 |
|
---|
48 | //! Set line width for tic marks and axes
|
---|
49 | void setLineWidth(double val, double majfac = 0.9, double minfac = 0.5);
|
---|
50 | //! Set length for tic marks
|
---|
51 | void setTicLength(double major, double minor);
|
---|
52 |
|
---|
53 | //! Switch autoscaling of axes
|
---|
54 | void setAutoScale(bool val = true);
|
---|
55 |
|
---|
56 | Qwt3D::Triple first() const { return first_;}
|
---|
57 | Qwt3D::Triple second() const { return second_;}
|
---|
58 |
|
---|
59 | void setAutoDecoration(bool val = true) {autodecoration_ = val;}
|
---|
60 | bool autoDecoration() const { return autodecoration_;}
|
---|
61 |
|
---|
62 | void setLineSmooth(bool val = true) {smooth_ = val;} //!< draw smooth axes
|
---|
63 | bool lineSmooth() const {return smooth_;} //!< smooth axes ?
|
---|
64 |
|
---|
65 | void draw();
|
---|
66 |
|
---|
67 | //! Defines whether a grid between the major and/or minor tics should be drawn
|
---|
68 | void setGridLines(bool majors, bool minors, int sides = Qwt3D::NOSIDEGRID);
|
---|
69 | int grids() const {return sides_;} //!< Returns grids switched on
|
---|
70 |
|
---|
71 | //! The vector of all12 axes - use them to set axis properties individually.
|
---|
72 | std::vector<Axis> axes;
|
---|
73 |
|
---|
74 |
|
---|
75 | private:
|
---|
76 | void destroy();
|
---|
77 |
|
---|
78 | Qwt3D::Triple first_, second_;
|
---|
79 | Qwt3D::COORDSTYLE style_;
|
---|
80 |
|
---|
81 | Qwt3D::RGBA gridlinecolor_;
|
---|
82 |
|
---|
83 | bool smooth_;
|
---|
84 |
|
---|
85 | void chooseAxes();
|
---|
86 | void autoDecorateExposedAxis(Axis& ax, bool left);
|
---|
87 | void drawMajorGridLines(); //!< Draws a grid between the major tics on the site
|
---|
88 | void drawMinorGridLines(); //!< Draws a grid between the minor tics on the site
|
---|
89 | void drawMajorGridLines(Qwt3D::Axis&, Qwt3D::Axis&); //! Helper
|
---|
90 | void drawMinorGridLines(Qwt3D::Axis&, Qwt3D::Axis&); //! Helper
|
---|
91 | void recalculateAxesTics();
|
---|
92 |
|
---|
93 | bool autodecoration_;
|
---|
94 | bool majorgridlines_, minorgridlines_;
|
---|
95 | int sides_;
|
---|
96 | };
|
---|
97 |
|
---|
98 | } // ns
|
---|
99 |
|
---|
100 | #endif
|
---|