Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkVtkLayerController.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkVtkLayerController_h
18 #define mitkVtkLayerController_h
19 
20 #include <MitkCoreExports.h>
21 #include <map>
22 #include <vector>
23 #include <vtkSmartPointer.h>
24 
25 class vtkRenderWindow;
26 class vtkRenderer;
27 
28 namespace mitk
29 {
30 #ifdef _MSC_VER
31 #pragma warning(push)
32 #pragma warning(disable : 4251)
33 #endif
34 
44  {
45  public:
46  static VtkLayerController *GetInstance(vtkSmartPointer<vtkRenderWindow> renWin);
47  static void AddInstance(vtkSmartPointer<vtkRenderWindow> renWin, vtkSmartPointer<vtkRenderer> mitkSceneRenderer);
48  static void RemoveInstance(vtkSmartPointer<vtkRenderWindow> renWin);
49 
50  VtkLayerController(vtkSmartPointer<vtkRenderWindow> renderWindow);
51  virtual ~VtkLayerController();
52 
56  vtkSmartPointer<vtkRenderer> GetSceneRenderer();
57 
63  void InsertBackgroundRenderer(vtkSmartPointer<vtkRenderer> renderer, bool forceAbsoluteBackground);
64 
70  void InsertForegroundRenderer(vtkSmartPointer<vtkRenderer> renderer, bool forceAbsoluteForeground);
71 
76  void InsertSceneRenderer(vtkSmartPointer<vtkRenderer> renderer);
77 
81  void SetRenderWindow(vtkSmartPointer<vtkRenderWindow> renwin);
82 
87  void RemoveRenderer(vtkSmartPointer<vtkRenderer> renderer);
88 
92  bool IsRendererInserted(vtkSmartPointer<vtkRenderer> renderer);
93 
97  unsigned int GetNumberOfRenderers();
98 
99  void SetEraseForAllRenderers(int i);
100 
101  protected:
102  vtkSmartPointer<vtkRenderWindow> m_RenderWindow;
103 
104  private:
110  void UpdateLayers();
111 
112  // Layer Management
113  typedef std::vector<vtkSmartPointer<vtkRenderer>> RendererVectorType;
114  RendererVectorType m_BackgroundRenderers;
115  RendererVectorType m_SceneRenderers;
116  RendererVectorType m_ForegroundRenderers;
117 
118  typedef std::map<const vtkSmartPointer<vtkRenderWindow>, mitk::VtkLayerController *> vtkLayerControllerMapType;
119  static vtkLayerControllerMapType s_LayerControllerMap;
120  };
121 
122 #ifdef _MSC_VER
123 #pragma warning(pop)
124 #endif
125 
126 } // Namespace MITK
127 #endif /* mitkVtkLayerController_h */
#define MITKCORE_EXPORT
vtkSmartPointer< vtkRenderWindow > m_RenderWindow
DataCollection - Class to facilitate loading/accessing structured data.