VTK  9.2.6
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 
79  void SetHandle(vtkPolyData*);
80  vtkPolyData* GetHandle();
82 
84 
87  void SetProperty(vtkProperty*);
88  void SetSelectedProperty(vtkProperty*);
89  vtkGetObjectMacro(Property, vtkProperty);
90  vtkGetObjectMacro(SelectedProperty, vtkProperty);
92 
97  virtual vtkAbstractTransform* GetTransform();
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;
116  void ReleaseGraphicsResources(vtkWindow*) override;
117  int RenderOpaqueGeometry(vtkViewport* viewport) override;
118  int RenderTranslucentPolygonalGeometry(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 
219  void CreateDefaultProperties();
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.
230  void MoveFocusRequest(
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
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
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:51
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:55
represent surface properties of a geometric object
Definition: vtkProperty.h:67
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:90
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:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
a simple class to control print indentation
Definition: vtkIndent.h:39
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:43
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:72
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. ...
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
convert a matrix to a transform
create polygonal text
Definition: vtkVectorText.h:47
void SetLabelTextScale(double x, double y, double z)
Scale text (font size along each dimension).