Fraxinus  18.10
An IGT application
cxRenderWindowFactory.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 
12 #ifndef CXRENDERWINDOWFACTORY_H
13 #define CXRENDERWINDOWFACTORY_H
14 
15 #include "cxResourceVisualizationExport.h"
16 
17 #include <map>
18 #include <QString>
19 #include <boost/smart_ptr.hpp>
20 #include "vtkForwardDeclarations.h"
21 #include "cxForwardDeclarations.h"
23 
24 class QVTKWidget;
25 
26 namespace cx
27 {
28 typedef boost::shared_ptr<class RenderWindowFactory> RenderWindowFactoryPtr;
29 
38 class cxResourceVisualization_EXPORT RenderWindowFactory : public QObject
39 {
40  Q_OBJECT
41 public:
43  vtkRenderWindowPtr getRenderWindow(QString uid, bool offScreenRendering = false);
44  vtkRenderWindowPtr getSharedRenderWindow() const;
45 
46  SharedOpenGLContextPtr getSharedOpenGLContext() const;
47  bool renderWindowExists(QString uid);
48 
49 private:
50  //Important: keep private, only the SharedContextCreatedCallback::Execute should be able to set the shared render window.
51  void setSharedRenderWindow(vtkRenderWindowPtr sharedRenderWindow);
52  friend void SharedContextCreatedCallback::Execute(vtkObject *view, unsigned long eventId, void*cbo);
53 
54  vtkRenderWindowPtr createRenderWindow(QString uid, bool offScreenRendering);
55  void preventSharedContextRenderWindowFromBeingShownOnScreen(vtkRenderWindowPtr renderWindow);
56 
57  vtkRenderWindowPtr mSharedRenderWindow;
58  std::map<QString, vtkRenderWindowPtr> mRenderWindows;
59  SharedContextCreatedCallbackPtr mSharedContextCreatedCallback;
60  SharedOpenGLContextPtr mSharedOpenGLContext;
61  QVTKWidget* mQvtkWidgetForHidingSharedContextRenderWindow;
62 
63 };
64 }//cx
65 
66 #endif // CXRENDERWINDOWFACTORY_H
Use to create all vtkRenderWindows, and store a single shared render window.
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
boost::shared_ptr< class SharedOpenGLContext > SharedOpenGLContextPtr
virtual void Execute(vtkObject *view, unsigned long eventId, void *cbo)
vtkSmartPointer< class SharedContextCreatedCallback > SharedContextCreatedCallbackPtr
boost::shared_ptr< class RenderWindowFactory > RenderWindowFactoryPtr
Namespace for all CustusX production code.