Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
vtkMitkRenderProp.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 "vtkMitkRenderProp.h"
18 
19 #include <vtkLODProp3D.h>
20 #include <vtkObjectFactory.h>
21 #include <vtkPropAssembly.h>
22 
23 #include "mitkVtkMapper.h"
24 //#include "mitkGLMapper.h"
25 
27 
29 {
30 }
32 {
33 }
34 
36 {
37  return const_cast<double *>(m_VtkPropRenderer->GetBounds());
38 }
39 
41 {
42  this->m_VtkPropRenderer = propRenderer;
43 }
44 
45 int vtkMitkRenderProp::RenderOpaqueGeometry(vtkViewport * /*viewport*/)
46 {
48 }
49 
50 int vtkMitkRenderProp::RenderOverlay(vtkViewport * /*viewport*/)
51 {
53 }
54 
56 {
57  m_VtkPropRenderer->ReleaseGraphicsResources(window);
58 }
59 
61 {
62  m_VtkPropRenderer->InitPathTraversal();
63 }
64 
66 {
67  return m_VtkPropRenderer->GetNextPath();
68 }
69 
71 {
72  return m_VtkPropRenderer->GetNumberOfPaths();
73 }
74 
75 // BUG (#1551) added method depth peeling
77 {
78  typedef std::map<int, mitk::Mapper *> MappersMapType;
79  const MappersMapType mappersMap = m_VtkPropRenderer->GetMappersMap();
80  for (MappersMapType::const_iterator it = mappersMap.cbegin(); it != mappersMap.cend(); ++it)
81  {
82  mitk::Mapper *mapper = (*it).second;
83 
84  const mitk::VtkMapper::Pointer vtkMapper = dynamic_cast<mitk::VtkMapper *>(mapper);
85  if (vtkMapper)
86  {
87  // Due to VTK 5.2 bug, we need to initialize the Paths object in vtkPropAssembly
88  // manually (see issue #8186 committed to VTK's Mantis issue tracker)
89  // --> VTK bug resolved on 2008-12-01
90  vtkPropAssembly *propAssembly = dynamic_cast<vtkPropAssembly *>(vtkMapper->GetVtkProp(m_VtkPropRenderer));
91  if (propAssembly)
92  {
93  propAssembly->InitPathTraversal();
94  }
95 
96  if (vtkMapper->GetVtkProp(m_VtkPropRenderer)->HasTranslucentPolygonalGeometry() == 1)
97  return 1;
98  }
99  }
100  return 0;
101 }
102 
104 {
106 }
108 {
110 }
mitk::VtkPropRenderer::Pointer m_VtkPropRenderer
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *) override
void SetPropRenderer(mitk::VtkPropRenderer::Pointer propRenderer)
virtual int RenderVolumetricGeometry(vtkViewport *) override
vtkMitkRenderProp
Base class of all Vtk Mappers in order to display primitives by exploiting Vtk functionality.
Definition: mitkVtkMapper.h:53
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:54
int RenderOverlay(vtkViewport *viewport) override
virtual int GetNumberOfPaths() override
virtual void InitPathTraversal() override
Used by vtkPointPicker/vtkPicker. This will query a list of all objects in MITK and provide every vtk...
virtual vtkAssemblyPath * GetNextPath() override
Used by vtkPointPicker/vtkPicker. This will query a list of all objects in MITK and provide every vtk...
int RenderOpaqueGeometry(vtkViewport *viewport) override
double * GetBounds() override
vtkStandardNewMacro(vtkMitkRenderProp)
void ReleaseGraphicsResources(vtkWindow *window) override
virtual int HasTranslucentPolygonalGeometry() override