VTK  9.2.5
vtkAbstractPolygonalHandleRepresentation3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAbstractPolygonalHandleRepresentation3D.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 =========================================================================*/
35 #ifndef vtkAbstractPolygonalHandleRepresentation3D_h
36 #define vtkAbstractPolygonalHandleRepresentation3D_h
37 
39 #include "vtkInteractionWidgetsModule.h" // For export macro
40 
41 class vtkProperty;
42 class vtkPolyDataMapper;
43 class vtkCellPicker;
46 class vtkMatrix4x4;
47 class vtkPolyData;
49 class vtkActor;
50 class vtkFollower;
51 class vtkVectorText;
52 
53 class VTKINTERACTIONWIDGETS_EXPORT vtkAbstractPolygonalHandleRepresentation3D
55 {
56 public:
58 
62  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66 
68 
71  void SetWorldPosition(double p[3]) override;
72  void SetDisplayPosition(double p[3]) override;
74 
76 
82 
84 
89  vtkGetObjectMacro(Property, vtkProperty);
90  vtkGetObjectMacro(SelectedProperty, vtkProperty);
92 
98 
100 
103  void BuildRepresentation() override;
104  void StartWidgetInteraction(double eventPos[2]) override;
105  void WidgetInteraction(double eventPos[2]) override;
106  int ComputeInteractionState(int X, int Y, int modify = 0) override;
108 
110 
113  void ShallowCopy(vtkProp* prop) override;
114  void DeepCopy(vtkProp* prop) override;
115  void GetActors(vtkPropCollection*) override;
117  int RenderOpaqueGeometry(vtkViewport* viewport) override;
120  double* GetBounds() override;
122 
124 
128  vtkSetMacro(LabelVisibility, vtkTypeBool);
129  vtkGetMacro(LabelVisibility, vtkTypeBool);
130  vtkBooleanMacro(LabelVisibility, vtkTypeBool);
131  virtual void SetLabelText(const char* label);
132  virtual char* GetLabelText();
134 
136 
139  virtual void SetLabelTextScale(double scale[3]);
140  void SetLabelTextScale(double x, double y, double z)
141  {
142  double scale[3] = { x, y, z };
143  this->SetLabelTextScale(scale);
144  }
145  virtual double* GetLabelTextScale();
147 
149 
152  vtkGetObjectMacro(LabelTextActor, vtkFollower);
154 
160  virtual void SetUniformScale(double scale);
161 
163 
166  vtkSetMacro(HandleVisibility, vtkTypeBool);
167  vtkGetMacro(HandleVisibility, vtkTypeBool);
168  vtkBooleanMacro(HandleVisibility, vtkTypeBool);
170 
171  void Highlight(int highlight) override;
172 
174 
185  vtkSetMacro(SmoothMotion, vtkTypeBool);
186  vtkGetMacro(SmoothMotion, vtkTypeBool);
187  vtkBooleanMacro(SmoothMotion, vtkTypeBool);
189 
190  /*
191  * Register internal Pickers within PickingManager
192  */
193  void RegisterPickers() override;
194 
195 protected:
198 
205  double LastPickPosition[3];
206  double LastEventPosition[2];
213 
214  // Methods to manipulate the cursor
215  void Translate(const double* p1, const double* p2) override;
216  virtual void Scale(const double* p1, const double* p2, const double eventPos[2]);
217  virtual void MoveFocus(const double* p1, const double* p2);
218 
220 
221  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
222  // world coordinates), the new display position of the handle center is
223  // populated into requestedDisplayPos. This is again only a request for the
224  // new display position. It is up to the point placer to deduce the
225  // appropriate world co-ordinates that this display position will map into.
226  // The placer may even disallow such a movement.
227  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
228  // as the event position, ie the location of the mouse cursor. If its OFF,
229  // incremental offsets as described above are used to compute it.
231  const double* p1, const double* p2, const double eventPos[2], double requestedDisplayPos[3]);
232 
233  int DetermineConstraintAxis(int constraint, double* x, double* startPickPos);
234 
244  virtual void UpdateHandle();
245 
249  virtual void UpdateLabel();
250 
251  // Handle the label.
258 
259 private:
262  void operator=(const vtkAbstractPolygonalHandleRepresentation3D&) = delete;
263 };
264 
265 #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:161
ray-cast cell picker for all kinds of Prop3Ds
a subclass of actor that always faces the camera
Definition: vtkFollower.h:123
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:119
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:151
convert a matrix to a transform
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
represent surface properties of a geometric object
Definition: vtkProperty.h:177
transform points and associated normals and vectors for polygonal dataset
create polygonal text
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ scale
Definition: vtkX3D.h:235
int vtkTypeBool
Definition: vtkABI.h:69