COPASI API  4.16.103
plotwindow.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 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2003 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #include <fstream>
16 #include <string>
17 #include <vector>
18 #include <QtGui/QToolButton>
19 
20 #include "copasi/copasi.h"
24 
25 class CopasiPlot;
26 class CPlotSpecification;
27 class CPlotSpec2Vector;
28 class CCopasiContainer;
29 class COutputHandlerPlot;
30 class CopasiUI3Window;
31 class QMenu;
32 class QAction;
33 
35 {
36  Q_OBJECT
37 
38 private:
39 
40  // points to the plot instance inside this window
44  QMenu* mpWindowMenu;
45 
46  QAction *mpaCloseWindow;
47  QAction *mpaShowAll;
48  QAction *mpaHideAll;
49  QAction *mpaPrint;
50  QAction *mpaSaveImage;
51  QAction *mpaSaveData;
52  QAction *mpaZoomOut;
53  QAction *mpaToggleLogX;
54  QAction *mpaToggleLogY;
55 
57 
58  void createToolBar();
59  void createMenus();
60  void createActions();
61 
62 public:
63  PlotWindow(COutputHandlerPlot * pHandler, const CPlotSpecification* ptrSpec, CopasiUI3Window * pMainWindow);
64 
65  virtual ~PlotWindow();
66 
67  bool initFromSpec(const CPlotSpecification* ptrSpec);
68 
69  CopasiPlot * getPlot() const;
70 
71  /**
72  *
73  * @return a pointer to this plot windows 'window' menu.
74  */
75  virtual QMenu *getWindowMenu() const;
76 
77  /**
78  * compile the object list from name vector
79  * @param std::vector< CCopasiContainer * > listOfContainer
80  * @param const CCopasiDataModel* pDataModel
81  * @return bool success
82  */
83  virtual bool compile(std::vector< CCopasiContainer * > listOfContainer, const CCopasiDataModel* pDataModel);
84 
85  /**
86  * Perform an output event for the current activity
87  * @param const Activity & activity
88  */
89  virtual void output(const Activity & activity);
90 
91  /**
92  * Introduce an additional separator into the output
93  * @param const Activity & activity
94  */
95  virtual void separate(const Activity & activity);
96 
97  /**
98  * Finish the output
99  */
100  virtual void finish();
101 
102  /**
103  * Saves the current plot to the given filename.
104  *
105  * This implementation supports PDF, SVG and PNG
106  */
107  virtual void saveToFile(const QString& fileName) const;
108 
109  /**
110  * Retrieve the list of objects handled by the interface
111  * @return const std::set< const CCopasiObject * > & objects
112  */
113  virtual const std::set< const CCopasiObject * > & getObjects() const;
114 
115 private slots:
116  //void enableZoom();
117 
118  //void mouseReleased(const QMouseEvent &e);
119 
120  // toggle log X
121  void toggleLogX(bool);
122 
123  // toggle log Y
124  void toggleLogY(bool);
125 
126  // Print the plot to printer
127  void printPlot();
128 
129  // Print the plot as an image
130  void printAsImage();
131 
132  /// Save data into a file
133  void slotSaveData();
134 
135  /// Zoom out
136  void slotZoomOut();
137 
138  /**
139  * Show all curves.
140  */
141  void slotSelectAll();
142 
143  /**
144  * Hide all curves.
145  */
146  void slotDeselectAll();
147 
148  /*
149  * Close current window
150  */
151  void slotCloseWindow();
152 
153 protected:
154  virtual void closeEvent(QCloseEvent *closeEvent);
155 };
void slotSaveData()
Save data into a file.
Definition: plotwindow.cpp:371
QAction * mpaCloseWindow
Definition: plotwindow.h:46
QAction * mpaShowAll
Definition: plotwindow.h:47
bool initializing
Definition: plotwindow.h:56
QAction * mpaSaveData
Definition: plotwindow.h:51
virtual void separate(const Activity &activity)
Definition: plotwindow.cpp:441
void slotCloseWindow()
Definition: plotwindow.cpp:467
PlotWindow(COutputHandlerPlot *pHandler, const CPlotSpecification *ptrSpec, CopasiUI3Window *pMainWindow)
Definition: plotwindow.cpp:57
virtual void output(const Activity &activity)
Definition: plotwindow.cpp:438
virtual void closeEvent(QCloseEvent *closeEvent)
Definition: plotwindow.cpp:472
CopasiPlot * mpPlot
Definition: plotwindow.h:41
void createToolBar()
Definition: plotwindow.cpp:171
virtual QMenu * getWindowMenu() const
Definition: plotwindow.cpp:118
void slotSelectAll()
Definition: plotwindow.cpp:455
void printAsImage()
Definition: plotwindow.cpp:311
COutputHandlerPlot * mpHandler
Definition: plotwindow.h:42
void toggleLogX(bool)
Definition: plotwindow.cpp:216
QAction * mpaPrint
Definition: plotwindow.h:49
QAction * mpaToggleLogX
Definition: plotwindow.h:53
QAction * mpaZoomOut
Definition: plotwindow.h:52
virtual void finish()
Definition: plotwindow.cpp:444
virtual void saveToFile(const QString &fileName) const
Definition: plotwindow.cpp:274
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer, const CCopasiDataModel *pDataModel)
Definition: plotwindow.cpp:426
QAction * mpaToggleLogY
Definition: plotwindow.h:54
QAction * mpaHideAll
Definition: plotwindow.h:48
void createActions()
Definition: plotwindow.cpp:123
void slotDeselectAll()
Definition: plotwindow.cpp:461
CopasiUI3Window * mpMainWindow
Definition: plotwindow.h:43
virtual const std::set< const CCopasiObject * > & getObjects() const
Definition: plotwindow.cpp:447
void printPlot()
Definition: plotwindow.cpp:349
bool initFromSpec(const CPlotSpecification *ptrSpec)
Definition: plotwindow.cpp:199
void createMenus()
Definition: plotwindow.cpp:97
QMenu * mpWindowMenu
Definition: plotwindow.h:44
void slotZoomOut()
Zoom out.
Definition: plotwindow.cpp:409
virtual ~PlotWindow()
Definition: plotwindow.cpp:417
QAction * mpaSaveImage
Definition: plotwindow.h:50
void toggleLogY(bool)
Definition: plotwindow.cpp:236
CopasiPlot * getPlot() const
Definition: plotwindow.cpp:478