MPSolve  3.2.1
rootsrenderer.h
1 #ifndef xmpsolve_ROOTSRENDERER_H
2 #define xmpsolve_ROOTSRENDERER_H
3 
4 #include "root.h"
5 #include "rootsmodel.h"
6 #include <QPainter>
7 #include <QPaintEvent>
8 
9 namespace xmpsolve {
10 
12 {
13 
14 public:
15  explicit RootsRenderer();
16 
17  void handlePaintEvent(QPainter& painter, int w, int h, QPaintEvent *);
18 
22  void zoomIn();
23 
27  void zoomOut();
28 
34  void setCenter(double x, double y);
35 
41  QPointF center() { return mCenter; }
42 
43 protected:
44 
48  void reloadRoots();
49 
59  QPointF scalePoint(QPointF point, int width, int height);
60 
61  QPointF scaleVector(QPointF point, int width, int height);
62  QPointF scaleVectorInverse(QPointF point, int width, int height);
63 
67  void drawTicks(QPainter& painter, double w, double h);
68 
72  QList<QPointF> m_roots;
73 
78 
83 
88 
89 private:
90  QPointF mCenter;
91 
92 };
93 
94 } // namespace xmpsolve
95 
96 #endif // xmpsolve_ROOTSRENDERER_H
Definition: rootsmodel.h:10
Definition: rootsrenderer.h:12
void zoomOut()
zoomOut changes the zoom to see a wider range.
Definition: rootsrenderer.cpp:43
QList< QPointF > m_roots
Points that should be displayed.
Definition: rootsrenderer.h:72
void setCenter(double x, double y)
setCenter selects the current centered point.
Definition: rootsrenderer.cpp:50
RootsModel * m_model
m_model is the model containing the roots that should be displayed.
Definition: rootsrenderer.h:87
void reloadRoots()
reloadRoots reloads the roots from the model.
Definition: rootsrenderer.cpp:17
QPointF center()
center returns the current center point of the plot.
Definition: rootsrenderer.h:41
double m_maxImagModule
m_maxImagModule is the maximum module of the imaginary parts of the roots.
Definition: rootsrenderer.h:82
double m_maxRealModule
m_maxRealModule is the maximum module of the real parts of the roots.
Definition: rootsrenderer.h:77
void zoomIn()
zoomIn changes the zoom to magnify more.
Definition: rootsrenderer.cpp:36
QPointF scalePoint(QPointF point, int width, int height)
scalePoint is used internally to scale, flip and translate a point in a such a way that is plotted pr...
Definition: rootsrenderer.cpp:56
void drawTicks(QPainter &painter, double w, double h)
drawTicks is used internally to draw ticks on the axis.
Definition: rootsrenderer.cpp:93