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=========================================================================*/
45#ifndef vtkHandleRepresentation_h
46#define vtkHandleRepresentation_h
47
48#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
49#include "vtkInteractionWidgetsModule.h" // For export macro
51
52class vtkCoordinate;
53class vtkRenderer;
54class vtkPointPlacer;
55
56class VTKINTERACTIONWIDGETS_EXPORT vtkHandleRepresentation : public vtkWidgetRepresentation
57{
58public:
60
64 void PrintSelf(ostream& os, vtkIndent indent) override;
66
68
76 virtual void SetDisplayPosition(double pos[3]);
77 virtual void GetDisplayPosition(double pos[3]);
78 virtual double* GetDisplayPosition() VTK_SIZEHINT(3);
79 virtual void SetWorldPosition(double pos[3]);
80 virtual void GetWorldPosition(double pos[3]);
81 virtual double* GetWorldPosition() VTK_SIZEHINT(3);
83
85
90 vtkSetClampMacro(Tolerance, int, 1, 100);
91 vtkGetMacro(Tolerance, int);
93
95
100 vtkSetMacro(ActiveRepresentation, vtkTypeBool);
101 vtkGetMacro(ActiveRepresentation, vtkTypeBool);
102 vtkBooleanMacro(ActiveRepresentation, vtkTypeBool);
104
105 // Enums define the state of the representation relative to the mouse pointer
106 // position. Used by ComputeInteractionState() to communicate with the
107 // widget. Note that ComputeInteractionState() and several other methods
108 // must be implemented by subclasses.
110 {
111 Outside = 0,
115 Scaling
116 };
117#if !defined(VTK_LEGACY_REMOVE)
118 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
120#endif
121
123
132 vtkSetClampMacro(InteractionState, int, Outside, Scaling);
134
136
141 vtkSetMacro(Constrained, vtkTypeBool);
142 vtkGetMacro(Constrained, vtkTypeBool);
143 vtkBooleanMacro(Constrained, vtkTypeBool);
145
153 virtual int CheckConstraint(vtkRenderer* renderer, double pos[2]);
154
156
159 void ShallowCopy(vtkProp* prop) override;
160 virtual void DeepCopy(vtkProp* prop);
161 void SetRenderer(vtkRenderer* ren) override;
163
169
171
180 vtkGetObjectMacro(PointPlacer, vtkPointPlacer);
182
184
187 virtual void GetTranslationVector(const double* p1, const double* p2, double* v) const;
188
190
193 virtual void Translate(const double* p1, const double* p2);
195
197
200 virtual void Translate(const double* v);
202
204
208 vtkGetMacro(TranslationAxis, int);
209 vtkSetClampMacro(TranslationAxis, int, -1, 2);
211
213
216 void SetXTranslationAxisOn() { this->TranslationAxis = Axis::XAxis; }
217 void SetYTranslationAxisOn() { this->TranslationAxis = Axis::YAxis; }
218 void SetZTranslationAxisOn() { this->TranslationAxis = Axis::ZAxis; }
219 void SetTranslationAxisOff() { this->TranslationAxis = Axis::NONE; }
221
223
226 bool IsTranslationConstrained() { return this->TranslationAxis != Axis::NONE; }
228
229protected:
232
236
237 // Two vtkCoordinates are available to subclasses, one in display
238 // coordinates and the other in world coordinates. These facilitate
239 // the conversion between these two systems. Note that the WorldPosition
240 // is the ultimate maintainer of position.
243
244 // Keep track of when coordinates were changed
247
248 // Constraint the placement of handles.
250
251 // Constraint axis translation
253
254private:
256 void operator=(const vtkHandleRepresentation&) = delete;
257};
258
259#endif
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
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:34
Abstract interface to translate 2D display positions to world coordinates.
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:51
abstract specification for renderers
Definition vtkRenderer.h:67
record modification and/or execution time
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(...)