VTK  9.3.1
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 
68  void SetHandle(vtkPolyData*);
69  vtkPolyData* GetHandle();
71 
73 
76  void SetProperty(vtkProperty*);
77  void SetSelectedProperty(vtkProperty*);
78  vtkGetObjectMacro(Property, vtkProperty);
79  vtkGetObjectMacro(SelectedProperty, vtkProperty);
81 
86  virtual vtkAbstractTransform* GetTransform();
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;
105  void ReleaseGraphicsResources(vtkWindow*) override;
106  int RenderOpaqueGeometry(vtkViewport* viewport) override;
107  int RenderTranslucentPolygonalGeometry(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 
208  void CreateDefaultProperties();
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 co-ordinates 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.
219  void MoveFocusRequest(
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
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:45
virtual void SetWorldPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:40
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:30
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:56
virtual void StartWidgetInteraction(double eventPos[2])
transform points and associated normals and vectors for polygonal dataset
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
double * GetBounds() override
Methods to make this class behave as a vtkProp.
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
virtual void SetDisplayPosition(double pos[2])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
represent a user defined handle geometry in 3D while maintaining a fixed orientation w...
superclass for all geometric transformations
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
virtual void WidgetInteraction(double newEventPos[2])
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
virtual void DeepCopy(vtkProp *prop)
Methods to make this class properly act like a vtkWidgetRepresentation.
map vtkPolyData to graphics primitives
a subclass of actor that always faces the camera
Definition: vtkFollower.h:32
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:61
void ShallowCopy(vtkProp *prop) override
Methods to make this class properly act like a vtkWidgetRepresentation.
virtual void Highlight(int vtkNotUsed(highlightOn))
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes...
virtual void Translate(const double *p1, const double *p2)
Translates world position by vector p1p2 projected on the constraint axis if any. ...
convert a matrix to a transform
create polygonal text
Definition: vtkVectorText.h:36
void SetLabelTextScale(double x, double y, double z)
Scale text (font size along each dimension).