VTK  9.3.20240418
vtkAbstractPolygonalHandleRepresentation3D.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
23 #ifndef vtkAbstractPolygonalHandleRepresentation3D_h
24 #define vtkAbstractPolygonalHandleRepresentation3D_h
25 
27 #include "vtkInteractionWidgetsModule.h" // For export macro
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkProperty;
31 class vtkPolyDataMapper;
32 class vtkCellPicker;
35 class vtkMatrix4x4;
36 class vtkPolyData;
38 class vtkActor;
39 class vtkFollower;
40 class vtkVectorText;
41 
42 class VTKINTERACTIONWIDGETS_EXPORT vtkAbstractPolygonalHandleRepresentation3D
44 {
45 public:
47 
51  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
57 
60  void SetWorldPosition(double p[3]) override;
61  void SetDisplayPosition(double p[3]) override;
63 
65 
71 
73 
78  vtkGetObjectMacro(Property, vtkProperty);
79  vtkGetObjectMacro(SelectedProperty, vtkProperty);
81 
87 
89 
92  void BuildRepresentation() override;
93  void StartWidgetInteraction(double eventPos[2]) override;
94  void WidgetInteraction(double eventPos[2]) override;
95  int ComputeInteractionState(int X, int Y, int modify = 0) override;
97 
99 
102  void ShallowCopy(vtkProp* prop) override;
103  void DeepCopy(vtkProp* prop) override;
104  void GetActors(vtkPropCollection*) override;
106  int RenderOpaqueGeometry(vtkViewport* viewport) override;
109  double* GetBounds() override;
111 
113 
117  vtkSetMacro(LabelVisibility, vtkTypeBool);
118  vtkGetMacro(LabelVisibility, vtkTypeBool);
119  vtkBooleanMacro(LabelVisibility, vtkTypeBool);
120  virtual void SetLabelText(const char* label);
121  virtual char* GetLabelText();
123 
125 
128  virtual void SetLabelTextScale(double scale[3]);
129  void SetLabelTextScale(double x, double y, double z)
130  {
131  double scale[3] = { x, y, z };
132  this->SetLabelTextScale(scale);
133  }
134  virtual double* GetLabelTextScale();
136 
138 
141  vtkGetObjectMacro(LabelTextActor, vtkFollower);
143 
149  virtual void SetUniformScale(double scale);
150 
152 
155  vtkSetMacro(HandleVisibility, vtkTypeBool);
156  vtkGetMacro(HandleVisibility, vtkTypeBool);
157  vtkBooleanMacro(HandleVisibility, vtkTypeBool);
159 
160  void Highlight(int highlight) override;
161 
163 
174  vtkSetMacro(SmoothMotion, vtkTypeBool);
175  vtkGetMacro(SmoothMotion, vtkTypeBool);
176  vtkBooleanMacro(SmoothMotion, vtkTypeBool);
178 
179  /*
180  * Register internal Pickers within PickingManager
181  */
182  void RegisterPickers() override;
183 
184 protected:
187 
194  double LastPickPosition[3];
195  double LastEventPosition[2];
202 
203  // Methods to manipulate the cursor
204  void Translate(const double* p1, const double* p2) override;
205  virtual void Scale(const double* p1, const double* p2, const double eventPos[2]);
206  virtual void MoveFocus(const double* p1, const double* p2);
207 
209 
210  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
211  // world coordinates), the new display position of the handle center is
212  // populated into requestedDisplayPos. This is again only a request for the
213  // new display position. It is up to the point placer to deduce the
214  // appropriate world coordinates that this display position will map into.
215  // The placer may even disallow such a movement.
216  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
217  // as the event position, ie the location of the mouse cursor. If its OFF,
218  // incremental offsets as described above are used to compute it.
220  const double* p1, const double* p2, const double eventPos[2], double requestedDisplayPos[3]);
221 
222  int DetermineConstraintAxis(int constraint, double* x, double* startPickPos);
223 
233  virtual void UpdateHandle();
234 
238  virtual void UpdateLabel();
239 
240  // Handle the label.
247 
248 private:
251  void operator=(const vtkAbstractPolygonalHandleRepresentation3D&) = delete;
252 };
253 
254 VTK_ABI_NAMESPACE_END
255 #endif
represent a user defined handle geometry in 3D while maintaining a fixed orientation w....
int ComputeInteractionState(int X, int Y, int modify=0) override
Methods to make this class properly act like a vtkWidgetRepresentation.
void MoveFocusRequest(const double *p1, const double *p2, const double eventPos[2], double requestedDisplayPos[3])
virtual void SetLabelTextScale(double scale[3])
Scale text (font size along each dimension).
void Highlight(int highlight) override
double * GetBounds() override
Methods to make this class behave as a vtkProp.
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
virtual void Scale(const double *p1, const double *p2, const double eventPos[2])
void SetLabelTextScale(double x, double y, double z)
Scale text (font size along each dimension).
void StartWidgetInteraction(double eventPos[2]) override
Methods to make this class properly act like a vtkWidgetRepresentation.
void GetActors(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.
virtual char * GetLabelText()
A label may be associated with the seed.
int DetermineConstraintAxis(int constraint, double *x, double *startPickPos)
virtual void MoveFocus(const double *p1, const double *p2)
void SetWorldPosition(double p[3]) override
Set the position of the point in world and display coordinates.
void ReleaseGraphicsResources(vtkWindow *) override
Methods to make this class behave as a vtkProp.
virtual void SetLabelText(const char *label)
A label may be associated with the seed.
void DeepCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
void Translate(const double *p1, const double *p2) override
Translates world position by vector p1p2 projected on the constraint axis if any.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
Methods to make this class behave as a vtkProp.
void ShallowCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
virtual double * GetLabelTextScale()
Scale text (font size along each dimension).
void WidgetInteraction(double eventPos[2]) override
Methods to make this class properly act like a vtkWidgetRepresentation.
void BuildRepresentation() override
Methods to make this class properly act like a vtkWidgetRepresentation.
vtkPolyData * GetHandle()
Set/get the handle polydata.
int RenderOpaqueGeometry(vtkViewport *viewport) override
Methods to make this class behave as a vtkProp.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods to make this class behave as a vtkProp.
virtual void UpdateHandle()
Update the actor position.
virtual void UpdateLabel()
Opportunity to update the label position and text during each render.
void SetSelectedProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
virtual void SetUniformScale(double scale)
The handle may be scaled uniformly in all three dimensions using this API.
void SetDisplayPosition(double p[3]) override
Set the position of the point in world and display coordinates.
virtual vtkAbstractTransform * GetTransform()
Get the transform used to transform the generic handle polydata before placing it in the render windo...
void SetHandle(vtkPolyData *)
Set/get the handle polydata.
void SetProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
superclass for all geometric transformations
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:151
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:91
a subclass of actor that always faces the camera
Definition: vtkFollower.h:92
abstract class for representing widget handles
virtual void Translate(const double *p1, const double *p2)
Translates world position by vector p1p2 projected on the constraint axis if any.
a simple class to control print indentation
Definition: vtkIndent.h:108
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:141
convert a matrix to a transform
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:181
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:66
represent surface properties of a geometric object
Definition: vtkProperty.h:167
transform points and associated normals and vectors for polygonal dataset
create polygonal text
abstract specification for Viewports
Definition: vtkViewport.h:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ scale
Definition: vtkX3D.h:229
int vtkTypeBool
Definition: vtkABI.h:64