fw4spl
fwVtkWheelRepresentation.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWRENDERVTK_VTK_FWVTKWHEELREPRESENTATION_HPP__
8 #define __FWRENDERVTK_VTK_FWVTKWHEELREPRESENTATION_HPP__
9 
10 #include "fwRenderVTK/config.hpp"
11 
12 #include <glm/vec2.hpp>
13 
14 #include <vtkActor2D.h>
15 #include <vtkPoints.h>
16 #include <vtkPropCollection.h>
17 #include <vtkUnsignedCharArray.h>
18 #include <vtkWidgetRepresentation.h>
19 
25 class FWRENDERVTK_CLASS_API fwVtkWheelRepresentation : public vtkWidgetRepresentation
26 {
27 public:
28 
30  FWRENDERVTK_API static fwVtkWheelRepresentation* New();
31 
32  vtkTypeMacro(fwVtkWheelRepresentation, vtkWidgetRepresentation);
33 
35  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
36 
38  FWRENDERVTK_API void BuildRepresentation() VTK_OVERRIDE;
39 
41  FWRENDERVTK_API void UpdateRepresentation();
42 
44  FWRENDERVTK_API void GetActors2D(vtkPropCollection* pc) VTK_OVERRIDE;
45 
47  FWRENDERVTK_API void ReleaseGraphicsResources(vtkWindow*) VTK_OVERRIDE;
48 
50  FWRENDERVTK_API int RenderOverlay(vtkViewport*) VTK_OVERRIDE;
51  FWRENDERVTK_API int RenderOpaqueGeometry(vtkViewport*) VTK_OVERRIDE;
52  FWRENDERVTK_API int RenderTranslucentPolygonalGeometry(vtkViewport*) VTK_OVERRIDE;
53 
55  FWRENDERVTK_API int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
56 
58  FWRENDERVTK_API void SetOrientation(double orientation);
59 
61  FWRENDERVTK_API void SetHovering(bool hover);
62 
64  FWRENDERVTK_API ::glm::dvec2 GetCenterInScreenSpace() const;
65 
67  FWRENDERVTK_API bool isInCenter(int X, int Y) const;
68 
70  FWRENDERVTK_API bool isOnWheel(int X, int Y) const;
71 
72  //------------------------------------------------------------------------------
73 
75  double GetOrientation() const
76  {
77  return m_orientation;
78  }
79 
80  //------------------------------------------------------------------------------
81 
83  vtkActor2D* GetWheelActor() const
84  {
85  return m_wheelActor;
86  }
87 
88 private:
89 
92 
94  ~fwVtkWheelRepresentation() VTK_OVERRIDE;
95 
97  vtkPoints* m_wheelPoints;
98 
100  vtkActor2D* m_wheelActor;
101 
103  vtkUnsignedCharArray* m_colors;
104 
105  fwVtkWheelRepresentation(const fwVtkWheelRepresentation&) VTK_DELETE_FUNCTION;
106  void operator=(const fwVtkWheelRepresentation&) VTK_DELETE_FUNCTION;
107 
109  double m_centerInnerRadius;
110  double m_centerOuterRadius;
111 
113  double m_wheelInnerRadius;
114  double m_wheelOuterRadius;
115 
117  double m_orientation;
118 
119  unsigned int m_nSectors;
120 
121  unsigned int m_nMarkedSectors;
122 
124  ::glm::dvec2 m_center;
125 
127  ::glm::dvec2 m_widgetToCenterTranslation;
128 
130  bool m_hover;
131 };
132 
133 #endif // __FWRENDERVTK_VTK_FWVTKWHEELREPRESENTATION_HPP__
double GetOrientation() const
Returns the orientation in radians.
vtkActor2D * GetWheelActor() const
Get the actor holding the wheel.
Representation of a wheel widget.