Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkIRenderingManager.cpp
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 #include "mitkIRenderingManager.h"
18 
19 namespace mitk {
20 struct RenderingManagerInterface : public IRenderingManager
21 {
22  RenderingManagerInterface(RenderingManager::Pointer manager)
23  : m_RM(manager)
24  {}
25 
26  QList<vtkRenderWindow*> GetAllRegisteredVtkRenderWindows() const override
27  {
28  RenderingManager::RenderWindowVector vec(m_RM->GetAllRegisteredRenderWindows());
29  QList<vtkRenderWindow*> result;
30  for (auto i = vec.begin();
31  i != vec.end(); ++i)
32  {
33  result.append(*i);
34  }
35  return result;
36  }
37 
38  void RequestUpdate( vtkRenderWindow *renderWindow ) override
39  {
40  m_RM->RequestUpdate(renderWindow);
41  }
42 
43  void ForceImmediateUpdate( vtkRenderWindow *renderWindow ) override
44  {
45  m_RM->ForceImmediateUpdate(renderWindow);
46  }
47 
48  void RequestUpdateAll( RenderingManager::RequestType type ) override
49  {
50  m_RM->RequestUpdateAll(type);
51  }
52 
53  void ForceImmediateUpdateAll( RenderingManager::RequestType type ) override
54  {
55  m_RM->ForceImmediateUpdateAll(type);
56  }
57 
58  bool InitializeViews( const BaseGeometry *geometry,
60  bool preserveRoughOrientationInWorldSpace = false ) override
61  {
62  return m_RM->InitializeViews( geometry, type, preserveRoughOrientationInWorldSpace);
63  }
64 
65  bool InitializeViews( const TimeGeometry *geometry,
67  bool preserveRoughOrientationInWorldSpace = false ) override
68  {
69  return m_RM->InitializeViews( geometry, type, preserveRoughOrientationInWorldSpace);
70  }
71 
72  bool InitializeViews( RenderingManager::RequestType type ) override
73  {
74  return m_RM->InitializeViews(type);
75  }
76 
77  bool InitializeView( vtkRenderWindow *renderWindow, const BaseGeometry *geometry,
78  bool initializeGlobalTimeSNC = false) override
79  {
80  return m_RM->InitializeView(renderWindow, geometry, initializeGlobalTimeSNC);
81  }
82 
83  bool InitializeView( vtkRenderWindow *renderWindow ) override
84  {
85  return m_RM->InitializeView(renderWindow);
86  }
87 
88  const SliceNavigationController *GetTimeNavigationController() const override
89  {
90  return m_RM->GetTimeNavigationController();
91  }
92 
93  SliceNavigationController *GetTimeNavigationController() override
94  {
95  return m_RM->GetTimeNavigationController();
96  }
97 
98  bool IsRendering() const override
99  {
100  return m_RM->IsRendering();
101  }
102 
103  void AbortRendering() override
104  {
105  m_RM->AbortRendering();
106  }
107 
108  void SetLODIncreaseBlocked(bool blocked) override
109  {
110  m_RM->SetLODIncreaseBlocked(blocked);
111  }
112 
113  bool GetLODIncreaseBlocked() const override
114  {
115  return m_RM->GetLODIncreaseBlocked();
116  }
117 
118  void SetLODAbortMechanismEnabled(bool abort) override
119  {
120  m_RM->SetLODAbortMechanismEnabled(abort);
121  }
122 
123  bool GetLODAbortMechanismEnabled() const override
124  {
125  return m_RM->GetLODAbortMechanismEnabled();
126  }
127 
128  int GetNextLOD( BaseRenderer* renderer ) const override
129  {
130  return m_RM->GetNextLOD(renderer);
131  }
132 
133  void SetMaximumLOD( unsigned int max ) override
134  {
135  m_RM->SetMaximumLOD(max);
136  }
137 
138  void SetShading( bool state, unsigned int lod ) override
139  {
140  m_RM->SetShading(state, lod);
141  }
142 
143  bool GetShading( unsigned int lod ) override
144  {
145  return m_RM->GetShading(lod);
146  }
147 
148  void SetClippingPlaneStatus( bool status ) override
149  {
150  m_RM->SetClippingPlaneStatus(status);
151  }
152 
153  bool GetClippingPlaneStatus() override
154  {
155  return m_RM->GetClippingPlaneStatus();
156  }
157 
158  void SetShadingValues( float ambient, float diffuse,
159  float specular, float specpower ) override
160  {
161  m_RM->SetShadingValues(ambient, diffuse, specular, specpower);
162  }
163 
164  QList<float> GetShadingValues() const override
165  {
166  RenderingManager::FloatVector vec(m_RM->GetShadingValues());
167  QList<float> result;
168  for (auto i = vec.begin();
169  i != vec.end(); ++i)
170  {
171  result.push_back(*i);
172  }
173  return result;
174  }
175 
176  const RenderingManager::Pointer m_RM;
177 };
178 
180 {
181  return new RenderingManagerInterface(manager);
182 }
183 }
IRenderingManager * MakeRenderingManagerInterface(RenderingManager::Pointer manager)
std::vector< float > FloatVector
DataCollection - Class to facilitate loading/accessing structured data.
itk::SmartPointer< Self > Pointer
static T max(T x, T y)
Definition: svm.cpp:70
std::vector< vtkRenderWindow * > RenderWindowVector
An interface for accessing a mitk::RenderingManager instance.