Medical Imaging Interaction Toolkit  2018.4.99-a3d2e8fb
Medical Imaging Interaction Toolkit
mitkBoundingShapeVtkMapper2D.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 (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 #ifndef mitkBoundingShapeVtkMapper2D_h
14 #define mitkBoundingShapeVtkMapper2D_h
15 
16 #include <mitkVtkMapper.h>
17 
19 
20 #include <vtkActor2D.h>
21 #include <vtkCutter.h>
22 #include <vtkPlane.h>
23 #include <vtkPolyDataMapper2D.h>
24 #include <vtkPropAssembly.h>
25 #include <vtkSmartPointer.h>
26 #include <vtkSphereSource.h>
27 
28 namespace mitk
29 {
31  {
32  class LocalStorage : public Mapper::BaseLocalStorage
33  {
34  public:
35  LocalStorage();
36  ~LocalStorage() override;
37 
38  bool IsUpdateRequired(mitk::BaseRenderer *renderer, mitk::Mapper *mapper, mitk::DataNode *dataNode);
39 
40  vtkSmartPointer<vtkActor> m_Actor;
41  vtkSmartPointer<vtkActor2D> m_HandleActor;
42  vtkSmartPointer<vtkActor2D> m_SelectedHandleActor;
43  vtkSmartPointer<vtkPolyDataMapper> m_Mapper;
44  vtkSmartPointer<vtkPolyDataMapper2D> m_HandleMapper;
45  vtkSmartPointer<vtkPolyDataMapper2D> m_SelectedHandleMapper;
46  vtkSmartPointer<vtkCutter> m_Cutter;
47  vtkSmartPointer<vtkPlane> m_CuttingPlane;
48  unsigned int m_LastSliceNumber;
49  std::vector<vtkSmartPointer<vtkSphereSource>> m_Handles;
50  vtkSmartPointer<vtkPropAssembly> m_PropAssembly;
51  double m_ZoomFactor;
52 
53  private:
54  LocalStorage(const LocalStorage &);
55  LocalStorage &operator=(const LocalStorage &);
56  };
57 
58  public:
59  static void SetDefaultProperties(DataNode *node, BaseRenderer *renderer = nullptr, bool overwrite = false);
60 
62  itkFactorylessNewMacro(Self);
63  itkCloneMacro(Self);
64 
65  void ApplyColorAndOpacityProperties(BaseRenderer *, vtkActor *) override;
66  vtkProp *GetVtkProp(BaseRenderer *renderer) override;
67 
68  private:
70  ~BoundingShapeVtkMapper2D() override;
71 
73  Self &operator=(const Self &);
74 
75  void GenerateDataForRenderer(BaseRenderer *renderer) override;
76  void Update(mitk::BaseRenderer *renderer) override;
77 
78  class Impl;
79  Impl *m_Impl;
80  };
81 }
82 
83 #endif
Base class for mapper specific rendering ressources.
Definition: mitkMapper.h:193
#define MITKBOUNDINGSHAPE_EXPORT
Organizes the rendering process.
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:31
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:48
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:49
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57