CustusX  22.04-rc5
An IGT application
cxRenderLoop.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #ifndef CXRENDERLOOP_H
12 #define CXRENDERLOOP_H
13 
14 #include "org_custusx_core_view_Export.h"
15 
16 #include <QObject>
17 #include "cxForwardDeclarations.h"
18 class QTimer;
19 #include <QDateTime>
20 #include <set>
21 
22 namespace cx
23 {
24 class ViewCollectionWidget;
25 
34 class org_custusx_core_view_EXPORT RenderLoop : public QObject
35 {
36  Q_OBJECT
37 public:
38  RenderLoop();
39  void start();
40  void stop();
41  bool isRunning() const;
42  void setRenderingInterval(int interval);
43  void setSmartRender(bool val);
44  void setLogging(bool on);
45 
46  void clearViews();
47  void addLayout(ViewCollectionWidget* layout);
48 
49  CyclicActionLoggerPtr getRenderTimer() { return mCyclicLogger; }
50 
51 //public slots:
52 // void requestPreRenderSignal();
53 
54 signals:
55  void preRender();
56  void fps(int number);
57  void renderFinished();
58 
59 private slots:
60  void timeoutSlot();
61 
62 private:
63  void sendRenderIntervalToTimer(int interval);
64  void emitPreRenderIfRequested();
65  void renderViews();
66  bool pollForSmartRenderingThisCycle();
67  int calculateTimeToNextRender();
68  void emitFPSIfRequired();
69  void dumpStatistics();
70 
71  QTimer* mTimer;
72  QDateTime mLastFullRender;
73  QDateTime mLastBeginRender;
74 
75  CyclicActionLoggerPtr mCyclicLogger;
76 
77  bool mSmartRender;
78 // bool mPreRenderSignalRequested;
79  int mBaseRenderInterval;
80  bool mLogging;
81 
82 // typedef std::set<ViewPtr> ViewSet;
83 // ViewSet mViews;
84  std::vector<QPointer<ViewCollectionWidget> > mLayoutWidgets;
85 };
86 
87 typedef boost::shared_ptr<RenderLoop> RenderLoopPtr;
88 
89 } // namespace cx
90 
91 
92 #endif // CXRENDERLOOP_H
boost::shared_ptr< class CyclicActionLogger > CyclicActionLoggerPtr
CyclicActionLoggerPtr getRenderTimer()
Definition: cxRenderLoop.h:49
boost::shared_ptr< RenderLoop > RenderLoopPtr
Definition: cxRenderLoop.h:87
Namespace for all CustusX production code.