VTK  9.2.6
vtkPointHandleRepresentation3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPointHandleRepresentation3D.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 =========================================================================*/
30 #ifndef vtkPointHandleRepresentation3D_h
31 #define vtkPointHandleRepresentation3D_h
32 
33 #include "vtkCursor3D.h" // Needed for delegation to cursor3D
35 #include "vtkInteractionWidgetsModule.h" // For export macro
36 
37 class vtkCursor3D;
38 class vtkProperty;
39 class vtkActor;
40 class vtkPolyDataMapper;
41 class vtkCellPicker;
42 
43 class VTKINTERACTIONWIDGETS_EXPORT vtkPointHandleRepresentation3D : public vtkHandleRepresentation
44 {
45 public:
50 
52 
56  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
60 
62 
69  void SetWorldPosition(double p[3]) override;
70  void SetDisplayPosition(double p[3]) override;
72 
76  void SetOutline(int o) { this->Cursor3D->SetOutline(o); }
77  int GetOutline() { return this->Cursor3D->GetOutline(); }
78  void OutlineOn() { this->Cursor3D->OutlineOn(); }
79  void OutlineOff() { this->Cursor3D->OutlineOff(); }
80 
84  void SetXShadows(int o) { this->Cursor3D->SetXShadows(o); }
85  int GetXShadows() { return this->Cursor3D->GetXShadows(); }
86  void XShadowsOn() { this->Cursor3D->XShadowsOn(); }
87  void XShadowsOff() { this->Cursor3D->XShadowsOff(); }
88 
92  void SetYShadows(int o) { this->Cursor3D->SetYShadows(o); }
93  int GetYShadows() { return this->Cursor3D->GetYShadows(); }
94  void YShadowsOn() { this->Cursor3D->YShadowsOn(); }
95  void YShadowsOff() { this->Cursor3D->YShadowsOff(); }
96 
100  void SetZShadows(int o) { this->Cursor3D->SetZShadows(o); }
101  int GetZShadows() { return this->Cursor3D->GetZShadows(); }
102  void ZShadowsOn() { this->Cursor3D->ZShadowsOn(); }
103  void ZShadowsOff() { this->Cursor3D->ZShadowsOff(); }
104 
106 
117  void SetTranslationMode(vtkTypeBool mode);
118  vtkGetMacro(TranslationMode, vtkTypeBool);
119  vtkBooleanMacro(TranslationMode, vtkTypeBool);
121 
123 
126  void AllOn()
127  {
128  this->OutlineOn();
129  this->XShadowsOn();
130  this->YShadowsOn();
131  this->ZShadowsOn();
132  }
133  void AllOff()
134  {
135  this->OutlineOff();
136  this->XShadowsOff();
137  this->YShadowsOff();
138  this->ZShadowsOff();
139  }
141 
143 
146  void SetProperty(vtkProperty*);
147  void SetSelectedProperty(vtkProperty*);
148  vtkGetObjectMacro(Property, vtkProperty);
149  vtkGetObjectMacro(SelectedProperty, vtkProperty);
151 
153 
159  vtkSetClampMacro(HotSpotSize, double, 0.0, 1.0);
160  vtkGetMacro(HotSpotSize, double);
162 
166  void SetHandleSize(double size) override;
167 
169 
172  double* GetBounds() VTK_SIZEHINT(6) override;
173  void BuildRepresentation() override;
174  void StartWidgetInteraction(double eventPos[2]) override;
175  void WidgetInteraction(double eventPos[2]) override;
176  int ComputeInteractionState(int X, int Y, int modify = 0) override;
177  void PlaceWidget(double bounds[6]) override;
178  void StartComplexInteraction(vtkRenderWindowInteractor* iren, vtkAbstractWidget* widget,
179  unsigned long event, void* calldata) override;
180  void ComplexInteraction(vtkRenderWindowInteractor* iren, vtkAbstractWidget* widget,
181  unsigned long event, void* calldata) override;
182  int ComputeComplexInteractionState(vtkRenderWindowInteractor* iren, vtkAbstractWidget* widget,
183  unsigned long event, void* calldata, int modify = 0) override;
185 
187 
190  void ShallowCopy(vtkProp* prop) override;
191  void DeepCopy(vtkProp* prop) override;
192  void GetActors(vtkPropCollection*) override;
193  void ReleaseGraphicsResources(vtkWindow*) override;
194  int RenderOpaqueGeometry(vtkViewport* viewport) override;
195  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
196  vtkTypeBool HasTranslucentPolygonalGeometry() override;
198 
199  void Highlight(int highlight) override;
200 
202 
213  vtkSetMacro(SmoothMotion, vtkTypeBool);
214  vtkGetMacro(SmoothMotion, vtkTypeBool);
215  vtkBooleanMacro(SmoothMotion, vtkTypeBool);
217 
218  /*
219  * Register internal Pickers within PickingManager
220  */
221  void RegisterPickers() override;
222 
229  void SetVisibility(vtkTypeBool visible) override;
230 
231 protected:
233  ~vtkPointHandleRepresentation3D() override;
234 
235  // the cursor3D
236  vtkActor* Actor;
238  vtkCursor3D* Cursor3D;
239 
240  // Do the picking
241  vtkCellPicker* CursorPicker;
242  double LastPickPosition[3];
243  double LastEventPosition[3];
244 
245  // Methods to manipulate the cursor
246  int ConstraintAxis;
247  void Translate(const double* p1, const double* p2) override;
248  void Scale(const double* p1, const double* p2, const double eventPos[2]);
249  void MoveFocus(const double* p1, const double* p2);
250  void SizeBounds();
251 
263  void MoveFocusRequest(
264  const double* p1, const double* p2, const double currPos[2], double center[3]);
265 
266  // Properties used to control the appearance of selected objects and
267  // the manipulator in general.
268  vtkProperty* Property;
269  vtkProperty* SelectedProperty;
270  void CreateDefaultProperties();
271 
272  // The size of the hot spot.
273  double HotSpotSize;
274  int DetermineConstraintAxis(int constraint, double* x, double* startPoint);
275  int WaitingForMotion;
276  int WaitCount;
277 
278  // Current handle sized (may reflect scaling)
279  double CurrentHandleSize;
280 
281  // Control how translation works
282  vtkTypeBool TranslationMode;
283 
284  vtkTypeBool SmoothMotion;
285 
286 private:
287  vtkPointHandleRepresentation3D(const vtkPointHandleRepresentation3D&) = delete;
288  void operator=(const vtkPointHandleRepresentation3D&) = delete;
289 };
290 
291 #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
abstract class for representing widget handles
represent the position of a point in 3D space
abstract specification for Viewports
Definition: vtkViewport.h:55
represent surface properties of a geometric object
Definition: vtkProperty.h:67
void AllOn()
Convenience methods to turn outline and shadows on and off.
virtual void SetHandleSize(double)
Set/Get the factor that controls the size of the handles that appear as part of the widget (if any)...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
void SetYShadows(int o)
Turn on/off the wireframe y-shadows.
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
platform-independent render window interaction including picking and frame rate control.
void SetZShadows(int o)
Turn on/off the wireframe z-shadows.
void SetOutline(int o)
Turn on/off the wireframe bounding box.
a simple class to control print indentation
Definition: vtkIndent.h:39
#define VTK_SIZEHINT(...)
define the API for widget / widget representation
map vtkPolyData to graphics primitives
void AllOff()
Convenience methods to turn outline and shadows on and off.
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:72
generate a 3D cursor representation
Definition: vtkCursor3D.h:39
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void Translate(const double *p1, const double *p2)
Translates world position by vector p1p2 projected on the constraint axis if any. ...
void SetXShadows(int o)
Turn on/off the wireframe x-shadows.
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...