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
55class vtkCoordinate;
56class vtkRenderer;
57class vtkPointPlacer;
58
59class VTKINTERACTIONWIDGETS_EXPORT vtkHandleRepresentation : public vtkWidgetRepresentation
60{
61public:
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
172
174
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
232protected:
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
257private:
259 void operator=(const vtkHandleRepresentation&) = delete;
260};
261
262#endif
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:80
abstract class for representing widget handles
virtual void SetPointPlacer(vtkPointPlacer *)
Set/Get the point placer.
void SetZTranslationAxisOn()
Toggles constraint translation axis on/off.
void SetYTranslationAxisOn()
Toggles constraint translation axis on/off.
~vtkHandleRepresentation() override
void SetXTranslationAxisOn()
Toggles constraint translation axis on/off.
virtual double * GetDisplayPosition()
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
void SetTranslationAxisOff()
Toggles constraint translation axis on/off.
virtual void DeepCopy(vtkProp *prop)
Methods to make this class properly act like a vtkWidgetRepresentation.
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
vtkMTimeType GetMTime() override
Overload the superclasses' GetMTime() because the internal vtkCoordinates are used to keep the state ...
virtual void GetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
virtual void Translate(const double *v)
Translates world position by vector v projected on the constraint axis if any.
void ShallowCopy(vtkProp *prop) override
Methods to make this class properly act like a vtkWidgetRepresentation.
virtual int CheckConstraint(vtkRenderer *renderer, double pos[2])
Method has to be overridden in the subclasses which has constraints on placing the handle (Ex.
virtual void Translate(const double *p1, const double *p2)
Translates world position by vector p1p2 projected on the constraint axis if any.
virtual void GetTranslationVector(const double *p1, const double *p2, double *v) const
Gets the translation vector.
void SetRenderer(vtkRenderer *ren) override
Methods to make this class properly act like a vtkWidgetRepresentation.
bool IsTranslationConstrained()
Returns true if ContrainedAxis.
a simple class to control print indentation
Definition: vtkIndent.h:40
Abstract interface to translate 2D display positions to world coordinates.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:57
abstract specification for renderers
Definition: vtkRenderer.h:73
record modification and/or execution time
Definition: vtkTimeStamp.h:36
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DEPRECATED_IN_9_2_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)