1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkHandleSource.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /**
16  * @class   vtkHandleSource
17  * @brief   interface that can be inherited to define handler sources for any kind of interaction.
18  *
19  * vtkHandleSource is a pure abstract class defining an interface for handler sources.
20  * Any child of this class is supposed to define an access to its position, size and direction, if
21  * any. On this purpose, the internal getters/setters are left to be redefined by the subclasses.
22  * It is derived by vtkPointHandleSource for example.
23  * @sa
24  * vtkPointHandleSource, vtkCameraHandleSource
25  */
26 
27 #ifndef vtkHandleSource_h
28 #define vtkHandleSource_h
29 
30 #include "vtkFiltersSourcesModule.h" // For export macro
31 #include "vtkPolyDataAlgorithm.h"
32 
33 class VTKFILTERSSOURCES_EXPORT vtkHandleSource : public vtkPolyDataAlgorithm
34 {
35 public:
36   vtkTypeMacro(vtkHandleSource, vtkPolyDataAlgorithm);
37   void PrintSelf(ostream& os, vtkIndent indent) override;
38 
39   ///@{
40   /**
41    * Set/Get if the handle should take account on this->Direction.
42    * The meaning of this direction varies on
43    * the subclasses implementation.
44    * The default value is false.
45    */
46   vtkSetMacro(Directional, bool);
47   vtkGetMacro(Directional, bool);
48   vtkBooleanMacro(Directional, bool);
49   ///@}
50 
51   ///@{
52   /**
53    * Set the position of the handle.
54    */
SetPosition(const double pos[3])55   void SetPosition(const double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
56   virtual void SetPosition(double xPos, double yPos, double zPos) = 0;
57   ///@}
58 
59   ///@{
60   /**
61    * Get the position of the handle.
62    */
63   void GetPosition(double pos[3]);
64   virtual double* GetPosition() = 0;
65   ///@}
66 
67   ///@{
68   /**
69    * Set the direction of the handle.
70    * The direction meaning depends on subclasses implementations.
71    */
SetDirection(const double dir[3])72   void SetDirection(const double dir[3]) { this->SetDirection(dir[0], dir[1], dir[2]); }
73   virtual void SetDirection(double xDir, double yDir, double zDir) = 0;
74   ///@}
75 
76   ///@{
77   /**
78    * Get the direction of the handle.
79    * The direction meaning depends on subclasses implementations.
80    */
81   void GetDirection(double dir[3]);
82   virtual double* GetDirection() = 0;
83   ///@}
84 
85   ///@{
86   /**
87    * Set/Get the size of the handle.
88    * The size use depends on subclasses implementations.
89    * The default value is 0.5.
90    */
91   vtkSetMacro(Size, double);
92   vtkGetMacro(Size, double);
93   ///@}
94 
95   vtkHandleSource(const vtkHandleSource&) = delete;
96   void operator=(const vtkHandleSource&) = delete;
97 
98 protected:
99   vtkHandleSource();
100   virtual ~vtkHandleSource() override = default;
101 
102   // Flag to indicate if the handle should be aware of any direction.
103   bool Directional = false;
104 
105   double Size = 0.5;
106 };
107 
108 #endif
109