OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
AbstractPlot.h
Go to the documentation of this file.
1#pragma once
2
3#include <qstring.h>
4#include <qcolor.h>
5
6#include <qwt_plot.h>
7#include <qwt_polar.h>
8
9class AbstractPlot;
10class PlotDataset;
11
13public:
14 enum AxisID {
15 yLeft = 0,
16 yRight = 1,
18 xTop = 3
19 };
20
22
23 virtual ~AbstractPlotAxis();
24
25 // #############################################################################
26
27 virtual void setTitle(const QString & _title);
28
29 virtual void setAutoScale(bool _isAutoScale);
30
31 virtual void setLogScale(bool _isLogScale);
32
33 virtual void setMin(double _minValue);
34
35 virtual void setMax(double _maxValue);
36
37 virtual void repaint(void) = 0;
38
39 QwtPlot::Axis xyAxisID(void) const;
40
41 QwtPolar::Axis polarAxisID(void) const;
42
43protected:
45
46 QString m_title;
50 double m_minValue;
51 double m_maxValue;
52
53private:
54 AbstractPlotAxis() = delete;
56 AbstractPlotAxis& operator = (AbstractPlotAxis&) = delete;
57};
58
59// ###########################################################################################
60
61// ###########################################################################################
62
63// ###########################################################################################
64
66public:
68
70 QColor gridColor;
72
74
75};
76
77// ###########################################################################################
78
79// ###########################################################################################
80
81// ###########################################################################################
82
84public:
85
90
91 static std::string plotTypeString(PlotType _type);
92
93 static PlotType plotTypeFromString(const std::string& _string, bool& _isComplex);
94
96
97 virtual ~AbstractPlot();
98
99 // ################################################################
100
101 // Plot
102
103 void SetLegendVisible(bool _isVisible = true, bool _repaint = true);
104
105 virtual void RepaintLegend(void) = 0;
106
107 virtual void RefreshWholePlot(void) = 0;
108
109 virtual void Clear(void) = 0;
110
111 // ################################################################
112
113 // Axis
114
115 void SetAxis(AbstractPlotAxis * _axisXBottom, AbstractPlotAxis * _axisXTop, AbstractPlotAxis * _axisYLeft, AbstractPlotAxis * _axisYRight);
116
118
119 void SetAxisTitle(AbstractPlotAxis::AxisID _axis, const QString & _title);
120
121 void SetAxisAutoScale(AbstractPlotAxis::AxisID _axis, bool _isAutoScale);
122
123 void SetAxisLogScale(AbstractPlotAxis::AxisID _axis, bool _isLogScale);
124
125 void SetAxisMin(AbstractPlotAxis::AxisID _axis, double _minValue);
126
127 void SetAxisMax(AbstractPlotAxis::AxisID _axis, double _maxValue);
128
130
131 // ################################################################
132
133 // Grid
134
135 void SetGridVisible(bool _isVisible, bool _repaint = true);
136
137 void SetGridColor(const QColor & _color, bool _repaint = true);
138
139 void SetGridLineWidth(double _width, bool _repaint = true);
140
141 virtual void RepaintGrid(void) = 0;
142
143 // ################################################################
144
145 // Getter
146
147 PlotType Type(void) const { return m_type; }
148
149protected:
150
155
157
159
160private:
161
162 AbstractPlot() = delete;
163 AbstractPlot(AbstractPlot&) = delete;
164 AbstractPlot& operator = (AbstractPlot&) = delete;
165
166};
167
Definition AbstractPlot.h:12
virtual void setMax(double _maxValue)
Definition AbstractPlot.cpp:28
virtual void setMin(double _minValue)
Definition AbstractPlot.cpp:24
bool m_isLogScale
Definition AbstractPlot.h:48
bool m_isAutoScale
Definition AbstractPlot.h:47
virtual ~AbstractPlotAxis()
Definition AbstractPlot.cpp:8
virtual void setLogScale(bool _isLogScale)
Definition AbstractPlot.cpp:20
bool m_isLogScaleLast
Definition AbstractPlot.h:49
double m_maxValue
Definition AbstractPlot.h:51
AxisID m_id
Definition AbstractPlot.h:44
double m_minValue
Definition AbstractPlot.h:50
QwtPlot::Axis xyAxisID(void) const
Definition AbstractPlot.cpp:32
QwtPolar::Axis polarAxisID(void) const
Definition AbstractPlot.cpp:45
QString m_title
Definition AbstractPlot.h:46
virtual void setAutoScale(bool _isAutoScale)
Definition AbstractPlot.cpp:16
AxisID
Definition AbstractPlot.h:14
@ yRight
Definition AbstractPlot.h:16
@ xBottom
Definition AbstractPlot.h:17
@ xTop
Definition AbstractPlot.h:18
@ yLeft
Definition AbstractPlot.h:15
virtual void repaint(void)=0
virtual void setTitle(const QString &_title)
Definition AbstractPlot.cpp:12
Definition AbstractPlot.h:83
void SetGridVisible(bool _isVisible, bool _repaint=true)
Definition AbstractPlot.cpp:163
PlotConfiguration m_config
Definition AbstractPlot.h:156
virtual void RepaintGrid(void)=0
AbstractPlotAxis * m_axisYRight
Definition AbstractPlot.h:154
void SetAxisMax(AbstractPlotAxis::AxisID _axis, double _maxValue)
Definition AbstractPlot.cpp:151
AbstractPlotAxis * m_axisXTop
Definition AbstractPlot.h:152
static PlotType plotTypeFromString(const std::string &_string, bool &_isComplex)
Definition AbstractPlot.cpp:85
void SetAxisAutoScale(AbstractPlotAxis::AxisID _axis, bool _isAutoScale)
Definition AbstractPlot.cpp:139
static std::string plotTypeString(PlotType _type)
Definition AbstractPlot.cpp:74
void SetAxisLogScale(AbstractPlotAxis::AxisID _axis, bool _isLogScale)
Definition AbstractPlot.cpp:143
AbstractPlotAxis * m_axisYLeft
Definition AbstractPlot.h:153
virtual void RefreshWholePlot(void)=0
void SetAxis(AbstractPlotAxis *_axisXBottom, AbstractPlotAxis *_axisXTop, AbstractPlotAxis *_axisYLeft, AbstractPlotAxis *_axisYRight)
Definition AbstractPlot.cpp:115
void SetGridColor(const QColor &_color, bool _repaint=true)
Definition AbstractPlot.cpp:168
AbstractPlotAxis * GetAxis(AbstractPlotAxis::AxisID _id)
Definition AbstractPlot.cpp:122
void SetGridLineWidth(double _width, bool _repaint=true)
Definition AbstractPlot.cpp:173
void SetAxisTitle(AbstractPlotAxis::AxisID _axis, const QString &_title)
Definition AbstractPlot.cpp:135
virtual ~AbstractPlot()
Definition AbstractPlot.cpp:100
void RepaintAxis(AbstractPlotAxis::AxisID _axis)
Definition AbstractPlot.cpp:155
PlotType
Definition AbstractPlot.h:86
@ Cartesian
Definition AbstractPlot.h:87
@ Polar
Definition AbstractPlot.h:88
void SetLegendVisible(bool _isVisible=true, bool _repaint=true)
Definition AbstractPlot.cpp:106
PlotType m_type
Definition AbstractPlot.h:158
void SetAxisMin(AbstractPlotAxis::AxisID _axis, double _minValue)
Definition AbstractPlot.cpp:147
AbstractPlotAxis * m_axisXBottom
Definition AbstractPlot.h:151
PlotType Type(void) const
Definition AbstractPlot.h:147
virtual void Clear(void)=0
virtual void RepaintLegend(void)=0
Definition AbstractPlot.h:65
QColor gridColor
Definition AbstractPlot.h:70
double gridLineWidth
Definition AbstractPlot.h:71
bool gridIsVisible
Definition AbstractPlot.h:69
bool legendIsVisible
Definition AbstractPlot.h:73
PlotConfiguration()
Definition AbstractPlot.cpp:64