COPASI API  4.16.103
CQGLLayoutViewer.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 #ifndef CQLAYOUTVIEWER_H__
7 #define CQLAYOUTVIEWER_H__
8 
9 #include <QtGui/QFrame>
10 
11 class QScrollBar;
12 class CQGLLayoutPainter;
13 class CCopasiDataModel;
14 class CLayout;
16 /**
17  * This class is supposed to act as a sort of scrollview for a
18  * CQGLNetworkPainter.
19  */
20 class CQGLLayoutViewer : public QFrame
21 {
22  Q_OBJECT
23 
24 protected:
25  QScrollBar* mpVerticalScrollbar;
26  QScrollBar* mpHorizontalScrollbar;
28 
29 public:
30  /**
31  * Constructor.
32  */
33  CQGLLayoutViewer(QWidget* pParent = 0, Qt::WindowFlags f = 0);
34 
35  /**
36  * Destructor.
37  */
38  virtual ~CQGLLayoutViewer();
39 
40  /**
41  * Sets the zoom factor on the network painter and updates the
42  *scrollbars.
43  */
44  void setZoomFactor(double zoom);
45 
46  void update(const CCopasiDataModel* pDataModel, CLayout* pLayout, const CLRenderInformationBase* pRenderInfo, const QString& baseDir);
47 
48  /**
49  * The default style indicates that the passed in render information is a default style.
50  * The renderer uses this information to determine whether roles for species reference glyphs
51  * need to be deduced.
52  */
53  void change_style(const CLRenderInformationBase* pRenderInfo, bool defaultStyle = false);
54 
55  /**
56  * This method tells the painter to temporarily revert the deduced
57  * object roles.
58  * The painter will however remember the rolls and a call to restoreDeducedRoles
59  * will restore them.
60  */
61  void revertDeducedRoles();
62 
63  /**
64  * Restores te deduced object roles after they have been temporarily reverted by a call to
65  * revertDeducedRoles.
66  */
67  void restoreDeducedRoles();
68 
69  /**
70  * Returns a pointer to the OpenGL painter.
71  */
73 
74  /**
75  * Returns a const pointer to the OpenGL painter.
76  */
77  const CQGLLayoutPainter* getPainter() const;
78 
79  /**
80  * Calculates the ratio that is needed to fit the diagram on the current viewport
81  * and sets this as the zoom factor.
82  * The methods returns the new zoom factor.
83  */
84  double fitToScreen();
85 
86 protected:
87  virtual void resizeEvent(QResizeEvent* e);
88 
89  void updateScrollbars();
90 
91  void resetView();
92 
93 protected slots:
94  void slotVValueChanged(int value);
95  void slotHValueChanged(int value);
96 
97  /**
98  * This slot is called when the layout painter changes
99  * the document (layout).
100  */
101  void slotDocumentChanged();
102 
103  /**
104  * This slot is called when the selection changes.
105  * The value determines whether a single curve is selected or not.
106  */
107  void slotSingleCurveSelected(bool selected);
108 
109 public slots:
110  void updateWidget();
111 
112  /**
113  * This slot is called when the user initiates the action to revert the
114  * currently selected curve.
115  */
116  void slotRevertCurve();
117 
118 signals:
119  void documentChanged();
120  void singleCurveSelected(bool selected);
121 };
122 
123 #endif /* CQLAYOUTVIEWER_H__ */
void singleCurveSelected(bool selected)
virtual ~CQGLLayoutViewer()
CQGLLayoutPainter * getPainter()
void revertDeducedRoles()
void update(const CCopasiDataModel *pDataModel, CLayout *pLayout, const CLRenderInformationBase *pRenderInfo, const QString &baseDir)
void setZoomFactor(double zoom)
CQGLLayoutViewer(QWidget *pParent=0, Qt::WindowFlags f=0)
void restoreDeducedRoles()
void documentChanged()
void slotSingleCurveSelected(bool selected)
CQGLLayoutPainter * mpLayoutPainter
void slotVValueChanged(int value)
QScrollBar * mpVerticalScrollbar
void change_style(const CLRenderInformationBase *pRenderInfo, bool defaultStyle=false)
virtual void resizeEvent(QResizeEvent *e)
void slotHValueChanged(int value)
QScrollBar * mpHorizontalScrollbar