Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkRenderWindowBase.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkRenderWindowBase.h"
14 #include "mitkRenderingManager.h"
15 #include "mitkVtkLayerController.h"
16 #include "vtkRenderer.h"
17 
18 #include "mitkAnnotationUtils.h"
19 
20 mitk::RenderWindowBase::RenderWindowBase() : m_RenderProp(nullptr), m_InResize(false)
21 {
22 }
23 
24 /*
25 * "Member functions, including virtual functions (10.3), can be called during construction or destruction (12.6.2). When
26 a
27 * virtual function is called directly or indirectly from a constructor (including from the mem-initializer for a data
28 member) or from
29 * a destructor, and the object to which the call applies is the object under construction or destruction, the function
30 called is
31 * the one defined in the constructor or destructor's own class or in one of its bases, but not a function overriding it
32 in a class
33 * derived from the constructor or destructor's class, or overriding it in one of the other base classes of the most
34 derived object[..]"
35 
36 * or short: within constructors and destructors classes are not polymorph.
37 */
38 void mitk::RenderWindowBase::Initialize(const char *name)
39 {
40  auto renderingManager = mitk::RenderingManager::GetInstance();
41 
42  if (m_Renderer.IsNull())
44 
45  m_Renderer->InitRenderer(this->GetVtkRenderWindow());
46 
48 
49  renderingManager->AddRenderWindow(GetVtkRenderWindow());
50 
51  // Add previously created overlays to new BaseRenderer
53 
56  m_Renderer->GetVtkRenderer()->AddViewProp(m_RenderProp);
57 
58  if ((this->GetVtkRenderWindow()->GetSize()[0] > 10) && (this->GetVtkRenderWindow()->GetSize()[1] > 10))
59  m_Renderer->InitSize(this->GetVtkRenderWindow()->GetSize()[0], this->GetVtkRenderWindow()->GetSize()[1]);
60 
61  m_InResize = false;
62 }
63 
65 {
66  return m_Renderer->GetDispatcher()->ProcessEvent(interactionEvent);
67 }
68 
70 {
72  m_Renderer->GetVtkRenderer()->RemoveViewProp(m_RenderProp);
73  m_RenderProp->Delete();
75 }
76 
78 {
79 }
80 
82 {
84 }
85 
87 {
89 }
90 
92 {
94  switch (renderer->GetMapperID())
95  {
98 
101 
102  default:
104  }
105 }
106 
108 {
109  return m_Renderer;
110 }
virtual mitk::CameraRotationController * GetCameraRotationController()
virtual bool HandleEvent(InteractionEvent *interactionEvent)
void SetPropRenderer(mitk::VtkPropRenderer::Pointer propRenderer)
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
void RemoveRenderWindow(vtkRenderWindow *renderWindow)
Baseclass for renderer slice-/camera-control.
Organizes the rendering process.
Controls the selection of the slice the associated BaseRenderer will display.
mitk::VtkPropRenderer::Pointer m_Renderer
static RenderingManager * GetInstance()
static void BaseRendererChanged(BaseRenderer *renderer)
BaseRendererChanged has to be called in the case that the actual BaseRenderer object for a BaseRender...
virtual MapperSlotId GetMapperID()
Get the MapperSlotId to use.
virtual CameraRotationController * GetCameraRotationController()
void Initialize(const char *name="unnamed renderer")
virtual mitk::VtkPropRenderer * GetRenderer()
virtual vtkRenderWindow * GetVtkRenderWindow()=0
static vtkMitkRenderProp * New()
vtkMitkRenderProp * m_RenderProp
virtual SliceNavigationController * GetSliceNavigationController()
virtual mitk::SliceNavigationController * GetSliceNavigationController()
static void RemoveInstance(vtkRenderWindow *renWin)
static Pointer New(const char *_arga, vtkRenderWindow *_argb)
static void AddInstance(vtkRenderWindow *renWin, BaseRenderer *baseRenderer)
virtual mitk::BaseController * GetController()