Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkGizmoMapper2D.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 mitkGizmoMapper2D_h
18 #define mitkGizmoMapper2D_h
19 
20 #include <mitkVtkMapper.h>
21 
22 #include <vtkPainterPolyDataMapper.h>
23 
24 namespace mitk
25 {
26  // forward declaration
27  class Gizmo;
28 
40  {
41  public:
43  itkFactorylessNewMacro(Self);
44  itkCloneMacro(Self);
45 
51  static void SetDefaultProperties(mitk::DataNode *node,
52  mitk::BaseRenderer *renderer = nullptr,
53  bool overwrite = false);
54 
56  vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override { return m_LSH.GetLocalStorage(renderer)->m_Actor; }
58  void ResetMapper(mitk::BaseRenderer *renderer) override;
59 
62  vtkPolyData *GetVtkPolyData(mitk::BaseRenderer *renderer);
63 
64  private:
66  const Gizmo *GetInput();
67 
69  virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
70 
72  void ApplyVisualProperties(BaseRenderer *renderer);
73 
75  class LocalStorage : public Mapper::BaseLocalStorage
76  {
77  public:
79  vtkSmartPointer<vtkActor> m_Actor;
80 
83  vtkSmartPointer<vtkPainterPolyDataMapper> m_VtkPolyDataMapper;
84 
86  itk::TimeStamp m_LastUpdateTime;
87 
88  LocalStorage();
89  };
90 
92  LocalStorageHandler<LocalStorage> m_LSH;
93  };
94 
95 } // namespace
96 
97 #endif
L * GetLocalStorage(mitk::BaseRenderer *forRenderer)
Retrieves a LocalStorage for a specific BaseRenderer.
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer=nullptr, bool overwrite=false)
Base class for mapper specific rendering ressources.
Definition: mitkMapper.h:200
Organizes the rendering process.
DataCollection - Class to facilitate loading/accessing structured data.
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
vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
Return the vtkProp that represents the "rendering result".
void ResetMapper(mitk::BaseRenderer *renderer) override
"Resets" the mapper, setting its result to invisible.
vtkPolyData * GetVtkPolyData(mitk::BaseRenderer *renderer)
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66
mitkClassMacro(GizmoMapper2D, VtkMapper)