VTK  9.2.6
vtkHandleRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHandleRepresentation.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 =========================================================================*/
48 #ifndef vtkHandleRepresentation_h
49 #define vtkHandleRepresentation_h
50 
51 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
52 #include "vtkInteractionWidgetsModule.h" // For export macro
54 
55 class vtkCoordinate;
56 class vtkRenderer;
57 class vtkPointPlacer;
58 
59 class VTKINTERACTIONWIDGETS_EXPORT vtkHandleRepresentation : public vtkWidgetRepresentation
60 {
61 public:
63 
67  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
71 
79  virtual void SetDisplayPosition(double pos[3]);
80  virtual void GetDisplayPosition(double pos[3]);
81  virtual double* GetDisplayPosition() VTK_SIZEHINT(3);
82  virtual void SetWorldPosition(double pos[3]);
83  virtual void GetWorldPosition(double pos[3]);
84  virtual double* GetWorldPosition() VTK_SIZEHINT(3);
86 
88 
93  vtkSetClampMacro(Tolerance, int, 1, 100);
94  vtkGetMacro(Tolerance, int);
96 
98 
103  vtkSetMacro(ActiveRepresentation, vtkTypeBool);
104  vtkGetMacro(ActiveRepresentation, vtkTypeBool);
105  vtkBooleanMacro(ActiveRepresentation, vtkTypeBool);
107 
108  // Enums define the state of the representation relative to the mouse pointer
109  // position. Used by ComputeInteractionState() to communicate with the
110  // widget. Note that ComputeInteractionState() and several other methods
111  // must be implemented by subclasses.
113  {
114  Outside = 0,
118  Scaling
119  };
120 #if !defined(VTK_LEGACY_REMOVE)
121  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
123 #endif
124 
126 
135  vtkSetClampMacro(InteractionState, int, Outside, Scaling);
137 
139 
144  vtkSetMacro(Constrained, vtkTypeBool);
145  vtkGetMacro(Constrained, vtkTypeBool);
146  vtkBooleanMacro(Constrained, vtkTypeBool);
148 
156  virtual int CheckConstraint(vtkRenderer* renderer, double pos[2]);
157 
159 
162  void ShallowCopy(vtkProp* prop) override;
163  virtual void DeepCopy(vtkProp* prop);
164  void SetRenderer(vtkRenderer* ren) override;
166 
171  vtkMTimeType GetMTime() override;
172 
174 
182  virtual void SetPointPlacer(vtkPointPlacer*);
183  vtkGetObjectMacro(PointPlacer, vtkPointPlacer);
185 
187 
190  virtual void GetTranslationVector(const double* p1, const double* p2, double* v) const;
191 
193 
196  virtual void Translate(const double* p1, const double* p2);
198 
200 
203  virtual void Translate(const double* v);
205 
207 
211  vtkGetMacro(TranslationAxis, int);
212  vtkSetClampMacro(TranslationAxis, int, -1, 2);
214 
216 
219  void SetXTranslationAxisOn() { this->TranslationAxis = Axis::XAxis; }
220  void SetYTranslationAxisOn() { this->TranslationAxis = Axis::YAxis; }
221  void SetZTranslationAxisOn() { this->TranslationAxis = Axis::ZAxis; }
222  void SetTranslationAxisOff() { this->TranslationAxis = Axis::NONE; }
224 
226 
229  bool IsTranslationConstrained() { return this->TranslationAxis != Axis::NONE; }
231 
232 protected:
234  ~vtkHandleRepresentation() override;
235 
239 
240  // Two vtkCoordinates are available to subclasses, one in display
241  // coordinates and the other in world coordinates. These facilitate
242  // the conversion between these two systems. Note that the WorldPosition
243  // is the ultimate maintainer of position.
246 
247  // Keep track of when coordinates were changed
250 
251  // Constraint the placement of handles.
253 
254  // Constraint axis translation
256 
257 private:
259  void operator=(const vtkHandleRepresentation&) = delete;
260 };
261 
262 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
void SetTranslationAxisOff()
Toggles constraint translation axis on/off.
abstract class for representing widget handles
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_DEPRECATED_IN_9_2_0(reason)
record modification and/or execution time
Definition: vtkTimeStamp.h:35
virtual void SetRenderer(vtkRenderer *ren)
Subclasses of vtkWidgetRepresentation must implement these methods.
abstract specification for renderers
Definition: vtkRenderer.h:72
void SetYTranslationAxisOn()
Toggles constraint translation axis on/off.
abstract class defines interface between the widget and widget representation classes ...
int vtkTypeBool
Definition: vtkABI.h:69
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual vtkMTimeType GetMTime()
Return this object's modified time.
Abstract interface to translate 2D display positions to world coordinates.
bool IsTranslationConstrained()
Returns true if ContrainedAxis.
#define VTK_SIZEHINT(...)
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems ...
Definition: vtkCoordinate.h:79
void SetZTranslationAxisOn()
Toggles constraint translation axis on/off.
void SetXTranslationAxisOn()
Toggles constraint translation axis on/off.