VTK  9.0.1
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 =========================================================================*/
45 #ifndef vtkHandleRepresentation_h
46 #define vtkHandleRepresentation_h
47 
48 #include "vtkInteractionWidgetsModule.h" // For export macro
50 
51 class vtkCoordinate;
52 class vtkRenderer;
53 class vtkPointPlacer;
54 
55 class VTKINTERACTIONWIDGETS_EXPORT vtkHandleRepresentation : public vtkWidgetRepresentation
56 {
57 public:
59 
63  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67 
75  virtual void SetDisplayPosition(double pos[3]);
76  virtual void GetDisplayPosition(double pos[3]);
77  virtual double* GetDisplayPosition() VTK_SIZEHINT(3);
78  virtual void SetWorldPosition(double pos[3]);
79  virtual void GetWorldPosition(double pos[3]);
80  virtual double* GetWorldPosition() VTK_SIZEHINT(3);
82 
84 
89  vtkSetClampMacro(Tolerance, int, 1, 100);
90  vtkGetMacro(Tolerance, int);
92 
94 
99  vtkSetMacro(ActiveRepresentation, vtkTypeBool);
100  vtkGetMacro(ActiveRepresentation, vtkTypeBool);
101  vtkBooleanMacro(ActiveRepresentation, vtkTypeBool);
103 
104  // Enums define the state of the representation relative to the mouse pointer
105  // position. Used by ComputeInteractionState() to communicate with the
106  // widget. Note that ComputeInteractionState() and several other methods
107  // must be implemented by subclasses.
109  {
110  Outside = 0,
114  Scaling
115  };
116 
118 
127  vtkSetClampMacro(InteractionState, int, Outside, Scaling);
129 
131 
136  vtkSetMacro(Constrained, vtkTypeBool);
137  vtkGetMacro(Constrained, vtkTypeBool);
138  vtkBooleanMacro(Constrained, vtkTypeBool);
140 
148  virtual int CheckConstraint(vtkRenderer* renderer, double pos[2]);
149 
151 
154  void ShallowCopy(vtkProp* prop) override;
155  virtual void DeepCopy(vtkProp* prop);
156  void SetRenderer(vtkRenderer* ren) override;
158 
163  vtkMTimeType GetMTime() override;
164 
166 
174  virtual void SetPointPlacer(vtkPointPlacer*);
175  vtkGetObjectMacro(PointPlacer, vtkPointPlacer);
177 
179 
182  virtual void GetTranslationVector(const double* p1, const double* p2, double* v) const;
183 
185 
188  virtual void Translate(const double* p1, const double* p2);
190 
192 
195  virtual void Translate(const double* v);
197 
199 
203  vtkGetMacro(TranslationAxis, int);
204  vtkSetClampMacro(TranslationAxis, int, -1, 2);
206 
208 
211  void SetXTranslationAxisOn() { this->TranslationAxis = Axis::XAxis; }
212  void SetYTranslationAxisOn() { this->TranslationAxis = Axis::YAxis; }
213  void SetZTranslationAxisOn() { this->TranslationAxis = Axis::ZAxis; }
214  void SetTranslationAxisOff() { this->TranslationAxis = Axis::NONE; }
216 
218 
221  bool IsTranslationConstrained() { return this->TranslationAxis != Axis::NONE; }
223 
224 protected:
226  ~vtkHandleRepresentation() override;
227 
231 
232  // Two vtkCoordinates are available to subclasses, one in display
233  // coordinates and the other in world coordinates. These facilitate
234  // the conversion between these two systems. Note that the WorldPosition
235  // is the ultimate maintainer of position.
238 
239  // Keep track of when coordinates were changed
242 
243  // Constraint the placement of handles.
245 
246  // Constraint axis translation
248 
249 private:
251  void operator=(const vtkHandleRepresentation&) = delete;
252 };
253 
254 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
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:293
record modification and/or execution time
Definition: vtkTimeStamp.h:32
virtual void SetRenderer(vtkRenderer *ren)
Subclasses of vtkWidgetRepresentation must implement these methods.
abstract specification for renderers
Definition: vtkRenderer.h:67
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:33
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:76
void SetZTranslationAxisOn()
Toggles constraint translation axis on/off.
void SetXTranslationAxisOn()
Toggles constraint translation axis on/off.