VTK  9.0.20201126
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 =========================================================================*/
27 #ifndef vtkPointHandleRepresentation3D_h
28 #define vtkPointHandleRepresentation3D_h
29 
30 #include "vtkCursor3D.h" // Needed for delegation to cursor3D
32 #include "vtkInteractionWidgetsModule.h" // For export macro
33 
34 class vtkCursor3D;
35 class vtkProperty;
36 class vtkActor;
37 class vtkPolyDataMapper;
38 class vtkCellPicker;
39 
40 class VTKINTERACTIONWIDGETS_EXPORT vtkPointHandleRepresentation3D : public vtkHandleRepresentation
41 {
42 public:
47 
49 
53  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
57 
59 
66  void SetWorldPosition(double p[3]) override;
67  void SetDisplayPosition(double p[3]) override;
69 
73  void SetOutline(int o) { this->Cursor3D->SetOutline(o); }
74  int GetOutline() { return this->Cursor3D->GetOutline(); }
75  void OutlineOn() { this->Cursor3D->OutlineOn(); }
76  void OutlineOff() { this->Cursor3D->OutlineOff(); }
77 
81  void SetXShadows(int o) { this->Cursor3D->SetXShadows(o); }
82  int GetXShadows() { return this->Cursor3D->GetXShadows(); }
83  void XShadowsOn() { this->Cursor3D->XShadowsOn(); }
84  void XShadowsOff() { this->Cursor3D->XShadowsOff(); }
85 
89  void SetYShadows(int o) { this->Cursor3D->SetYShadows(o); }
90  int GetYShadows() { return this->Cursor3D->GetYShadows(); }
91  void YShadowsOn() { this->Cursor3D->YShadowsOn(); }
92  void YShadowsOff() { this->Cursor3D->YShadowsOff(); }
93 
97  void SetZShadows(int o) { this->Cursor3D->SetZShadows(o); }
98  int GetZShadows() { return this->Cursor3D->GetZShadows(); }
99  void ZShadowsOn() { this->Cursor3D->ZShadowsOn(); }
100  void ZShadowsOff() { this->Cursor3D->ZShadowsOff(); }
101 
103 
114  void SetTranslationMode(vtkTypeBool mode);
115  vtkGetMacro(TranslationMode, vtkTypeBool);
116  vtkBooleanMacro(TranslationMode, vtkTypeBool);
118 
122  void AllOn()
123  {
124  this->OutlineOn();
125  this->XShadowsOn();
126  this->YShadowsOn();
127  this->ZShadowsOn();
128  }
129  void AllOff()
130  {
131  this->OutlineOff();
132  this->XShadowsOff();
133  this->YShadowsOff();
134  this->ZShadowsOff();
135  }
137 
139 
142  void SetProperty(vtkProperty*);
143  void SetSelectedProperty(vtkProperty*);
144  vtkGetObjectMacro(Property, vtkProperty);
145  vtkGetObjectMacro(SelectedProperty, vtkProperty);
147 
149 
155  vtkSetClampMacro(HotSpotSize, double, 0.0, 1.0);
156  vtkGetMacro(HotSpotSize, double);
158 
162  void SetHandleSize(double size) override;
163 
165 
168  double* GetBounds() VTK_SIZEHINT(6) override;
169  void BuildRepresentation() override;
170  void StartWidgetInteraction(double eventPos[2]) override;
171  void WidgetInteraction(double eventPos[2]) override;
172  int ComputeInteractionState(int X, int Y, int modify = 0) override;
173  void PlaceWidget(double bounds[6]) override;
174  void StartComplexInteraction(vtkRenderWindowInteractor* iren, vtkAbstractWidget* widget,
175  unsigned long event, void* calldata) override;
176  void ComplexInteraction(vtkRenderWindowInteractor* iren, vtkAbstractWidget* widget,
177  unsigned long event, void* calldata) override;
178  int ComputeComplexInteractionState(vtkRenderWindowInteractor* iren, vtkAbstractWidget* widget,
179  unsigned long event, void* calldata, int modify = 0) override;
181 
183 
186  void ShallowCopy(vtkProp* prop) override;
187  void DeepCopy(vtkProp* prop) override;
188  void GetActors(vtkPropCollection*) override;
189  void ReleaseGraphicsResources(vtkWindow*) override;
190  int RenderOpaqueGeometry(vtkViewport* viewport) override;
191  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
192  vtkTypeBool HasTranslucentPolygonalGeometry() override;
194 
195  void Highlight(int highlight) override;
196 
198 
209  vtkSetMacro(SmoothMotion, vtkTypeBool);
210  vtkGetMacro(SmoothMotion, vtkTypeBool);
211  vtkBooleanMacro(SmoothMotion, vtkTypeBool);
213 
214  /*
215  * Register internal Pickers within PickingManager
216  */
217  void RegisterPickers() override;
218 
225  void SetVisibility(vtkTypeBool visible) override;
226 
227 protected:
229  ~vtkPointHandleRepresentation3D() override;
230 
231  // the cursor3D
232  vtkActor* Actor;
234  vtkCursor3D* Cursor3D;
235 
236  // Do the picking
237  vtkCellPicker* CursorPicker;
238  double LastPickPosition[3];
239  double LastEventPosition[3];
240 
241  // Methods to manipulate the cursor
242  int ConstraintAxis;
243  void Translate(const double* p1, const double* p2) override;
244  void Scale(const double* p1, const double* p2, const double eventPos[2]);
245  void MoveFocus(const double* p1, const double* p2);
246  void SizeBounds();
247 
259  void MoveFocusRequest(
260  const double* p1, const double* p2, const double currPos[2], double center[3]);
261 
262  // Properties used to control the appearance of selected objects and
263  // the manipulator in general.
264  vtkProperty* Property;
265  vtkProperty* SelectedProperty;
266  void CreateDefaultProperties();
267 
268  // The size of the hot spot.
269  double HotSpotSize;
270  int DetermineConstraintAxis(int constraint, double* x, double* startPoint);
271  int WaitingForMotion;
272  int WaitCount;
273 
274  // Current handle sized (may reflect scaling)
275  double CurrentHandleSize;
276 
277  // Control how translation works
278  vtkTypeBool TranslationMode;
279 
280  vtkTypeBool SmoothMotion;
281 
282 private:
284  void operator=(const vtkPointHandleRepresentation3D&) = delete;
285 };
286 
287 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:36
vtkCursor3D.h
vtkPointHandleRepresentation3D::XShadowsOff
void XShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:84
vtkPointHandleRepresentation3D::SetXShadows
void SetXShadows(int o)
Turn on/off the wireframe x-shadows.
Definition: vtkPointHandleRepresentation3D.h:81
vtkCursor3D
generate a 3D cursor representation
Definition: vtkCursor3D.h:36
vtkPointHandleRepresentation3D::SetYShadows
void SetYShadows(int o)
Turn on/off the wireframe y-shadows.
Definition: vtkPointHandleRepresentation3D.h:89
vtkPointHandleRepresentation3D
represent the position of a point in 3D space
Definition: vtkPointHandleRepresentation3D.h:40
vtkPointHandleRepresentation3D::GetYShadows
int GetYShadows()
Definition: vtkPointHandleRepresentation3D.h:90
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkPointHandleRepresentation3D::YShadowsOn
void YShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:91
vtkPointHandleRepresentation3D::GetZShadows
int GetZShadows()
Definition: vtkPointHandleRepresentation3D.h:98
vtkHandleRepresentation::SetWorldPosition
virtual void SetWorldPosition(double pos[3])
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:55
vtkX3D::center
Definition: vtkX3D.h:236
vtkHandleRepresentation.h
vtkPointHandleRepresentation3D::AllOn
void AllOn()
Convenience methods to turn outline and shadows on and off.
Definition: vtkPointHandleRepresentation3D.h:122
vtkPointHandleRepresentation3D::SetOutline
void SetOutline(int o)
Turn on/off the wireframe bounding box.
Definition: vtkPointHandleRepresentation3D.h:73
vtkWidgetRepresentation::SetHandleSize
virtual void SetHandleSize(double)
Set/Get the factor that controls the size of the handles that appear as part of the widget (if any).
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkHandleRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:65
vtkPointHandleRepresentation3D::GetXShadows
int GetXShadows()
Definition: vtkPointHandleRepresentation3D.h:82
vtkWidgetRepresentation::GetBounds
double * GetBounds() override
Methods to make this class behave as a vtkProp.
Definition: vtkWidgetRepresentation.h:208
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkPointHandleRepresentation3D::AllOff
void AllOff()
Definition: vtkPointHandleRepresentation3D.h:129
vtkPointHandleRepresentation3D::OutlineOff
void OutlineOff()
Definition: vtkPointHandleRepresentation3D.h:76
vtkX3D::size
Definition: vtkX3D.h:259
vtkPointHandleRepresentation3D::SetZShadows
void SetZShadows(int o)
Turn on/off the wireframe z-shadows.
Definition: vtkPointHandleRepresentation3D.h:97
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:82
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkPointHandleRepresentation3D::ZShadowsOff
void ZShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:100
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
vtkHandleRepresentation::Translate
virtual void Translate(const double *p1, const double *p2)
Translates world position by vector p1p2 projected on the constraint axis if any.
vtkHandleRepresentation::SetDisplayPosition
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
vtkPointHandleRepresentation3D::YShadowsOff
void YShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:92
vtkPointHandleRepresentation3D::XShadowsOn
void XShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:83
vtkPointHandleRepresentation3D::ZShadowsOn
void ZShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:99
vtkX3D::mode
Definition: vtkX3D.h:253
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:61
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:35
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:66
vtkPointHandleRepresentation3D::GetOutline
int GetOutline()
Definition: vtkPointHandleRepresentation3D.h:74
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPointHandleRepresentation3D::OutlineOn
void OutlineOn()
Definition: vtkPointHandleRepresentation3D.h:75