VTK  9.1.0
vtkPointWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPointWidget.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 =========================================================================*/
89 #ifndef vtkPointWidget_h
90 #define vtkPointWidget_h
91 
92 #include "vtk3DWidget.h"
93 #include "vtkCursor3D.h" // Needed for faster access to the Cursor3D
94 #include "vtkInteractionWidgetsModule.h" // For export macro
95 
96 class vtkActor;
97 class vtkPolyDataMapper;
98 class vtkCellPicker;
99 class vtkPolyData;
100 class vtkProperty;
101 
102 class VTKINTERACTIONWIDGETS_EXPORT vtkPointWidget : public vtk3DWidget
103 {
104 public:
108  static vtkPointWidget* New();
109 
110  vtkTypeMacro(vtkPointWidget, vtk3DWidget);
111  void PrintSelf(ostream& os, vtkIndent indent) override;
112 
114 
117  void SetEnabled(int) override;
118  void PlaceWidget(double bounds[6]) override;
119  void PlaceWidget() override { this->Superclass::PlaceWidget(); }
121  double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
122  {
123  this->Superclass::PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax);
124  }
126 
132 
138  void SetPosition(double x, double y, double z) { this->Cursor3D->SetFocalPoint(x, y, z); }
139  void SetPosition(double x[3]) { this->SetPosition(x[0], x[1], x[2]); }
140  double* GetPosition() VTK_SIZEHINT(3) { return this->Cursor3D->GetFocalPoint(); }
141  void GetPosition(double xyz[3]) { this->Cursor3D->GetFocalPoint(xyz); }
142 
146  void SetOutline(int o) { this->Cursor3D->SetOutline(o); }
147  int GetOutline() { return this->Cursor3D->GetOutline(); }
148  void OutlineOn() { this->Cursor3D->OutlineOn(); }
149  void OutlineOff() { this->Cursor3D->OutlineOff(); }
150 
154  void SetXShadows(int o) { this->Cursor3D->SetXShadows(o); }
155  int GetXShadows() { return this->Cursor3D->GetXShadows(); }
156  void XShadowsOn() { this->Cursor3D->XShadowsOn(); }
157  void XShadowsOff() { this->Cursor3D->XShadowsOff(); }
158 
162  void SetYShadows(int o) { this->Cursor3D->SetYShadows(o); }
163  int GetYShadows() { return this->Cursor3D->GetYShadows(); }
164  void YShadowsOn() { this->Cursor3D->YShadowsOn(); }
165  void YShadowsOff() { this->Cursor3D->YShadowsOff(); }
166 
170  void SetZShadows(int o) { this->Cursor3D->SetZShadows(o); }
171  int GetZShadows() { return this->Cursor3D->GetZShadows(); }
172  void ZShadowsOn() { this->Cursor3D->ZShadowsOn(); }
173  void ZShadowsOff() { this->Cursor3D->ZShadowsOff(); }
174 
181  {
182  this->Cursor3D->SetTranslationMode(mode);
183  this->Cursor3D->Update();
184  }
185  int GetTranslationMode() { return this->Cursor3D->GetTranslationMode(); }
186  void TranslationModeOn() { this->SetTranslationMode(1); }
187  void TranslationModeOff() { this->SetTranslationMode(0); }
188 
190 
193  void AllOn()
194  {
195  this->OutlineOn();
196  this->XShadowsOn();
197  this->YShadowsOn();
198  this->ZShadowsOn();
199  }
200  void AllOff()
201  {
202  this->OutlineOff();
203  this->XShadowsOff();
204  this->YShadowsOff();
205  this->ZShadowsOff();
206  }
208 
210 
215  vtkGetObjectMacro(Property, vtkProperty);
216  vtkGetObjectMacro(SelectedProperty, vtkProperty);
218 
220 
226  vtkSetClampMacro(HotSpotSize, double, 0.0, 1.0);
227  vtkGetMacro(HotSpotSize, double);
229 
230 protected:
232  ~vtkPointWidget() override;
233 
234  // Manage the state of the widget
235  friend class vtkLineWidget;
236 
237  int State;
239  {
240  Start = 0,
244  Outside
245  };
246 
247  // Handles the events
248  static void ProcessEvents(
249  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
250 
251  // ProcessEvents() dispatches to these methods.
252  virtual void OnMouseMove();
253  virtual void OnLeftButtonDown();
254  virtual void OnLeftButtonUp();
255  virtual void OnMiddleButtonDown();
256  virtual void OnMiddleButtonUp();
257  virtual void OnRightButtonDown();
258  virtual void OnRightButtonUp();
259 
260  // the cursor3D
264  void Highlight(int highlight);
265 
266  // Do the picking
268 
269  // Register internal Pickers within PickingManager
270  void RegisterPickers() override;
271 
272  // Methods to manipulate the cursor
274  void Translate(double* p1, double* p2);
275  void Scale(double* p1, double* p2, int X, int Y);
276  void MoveFocus(double* p1, double* p2);
278 
279  // Properties used to control the appearance of selected objects and
280  // the manipulator in general.
284 
285  // The size of the hot spot.
286  double HotSpotSize;
287  int DetermineConstraintAxis(int constraint, double* x);
290 
291 private:
292  vtkPointWidget(const vtkPointWidget&) = delete;
293  void operator=(const vtkPointWidget&) = delete;
294 };
295 
296 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:146
vtkPointWidget::GetZShadows
int GetZShadows()
Definition: vtkPointWidget.h:171
vtkPointWidget::PlaceWidget
void PlaceWidget(double bounds[6]) override
Methods that satisfy the superclass' API.
vtkPointWidget::vtkPointWidget
vtkPointWidget()
vtkPointWidget::CreateDefaultProperties
void CreateDefaultProperties()
vtkCursor3D.h
vtkPointWidget::SetPosition
void SetPosition(double x[3])
Definition: vtkPointWidget.h:139
vtkPointWidget::TranslationMode
int TranslationMode
Definition: vtkPointWidget.h:277
vtkPointWidget::GetOutline
int GetOutline()
Definition: vtkPointWidget.h:147
vtkPointWidget::GetYShadows
int GetYShadows()
Definition: vtkPointWidget.h:163
vtkPointWidget::YShadowsOn
void YShadowsOn()
Definition: vtkPointWidget.h:164
vtkPointWidget::Scale
void Scale(double *p1, double *p2, int X, int Y)
vtkPointWidget::RegisterPickers
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
vtkCursor3D
generate a 3D cursor representation
Definition: vtkCursor3D.h:56
vtkPointWidget::GetPolyData
void GetPolyData(vtkPolyData *pd)
Grab the polydata (including points) that defines the point.
vtkPointWidget::WaitingForMotion
int WaitingForMotion
Definition: vtkPointWidget.h:288
vtkPointWidget::PlaceWidget
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
Methods that satisfy the superclass' API.
Definition: vtkPointWidget.h:120
vtkPointWidget::GetPosition
void GetPosition(double xyz[3])
Definition: vtkPointWidget.h:141
vtkLineWidget::Start
@ Start
Definition: vtkLineWidget.h:224
vtkPointWidget::Property
vtkProperty * Property
Definition: vtkPointWidget.h:281
vtkPointWidget::OnLeftButtonDown
virtual void OnLeftButtonDown()
vtkPointWidget::OnMiddleButtonDown
virtual void OnMiddleButtonDown()
vtkPointWidget::SelectedProperty
vtkProperty * SelectedProperty
Definition: vtkPointWidget.h:282
vtkPointWidget::WidgetState
WidgetState
Definition: vtkPointWidget.h:239
vtkPointWidget::ProcessEvents
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkPointWidget::OutlineOn
void OutlineOn()
Definition: vtkPointWidget.h:148
vtkPointWidget
position a point in 3D space
Definition: vtkPointWidget.h:103
vtkPointWidget::Translate
void Translate(double *p1, double *p2)
vtkPointWidget::ZShadowsOff
void ZShadowsOff()
Definition: vtkPointWidget.h:173
vtkPointWidget::OnRightButtonDown
virtual void OnRightButtonDown()
vtkPointWidget::HotSpotSize
double HotSpotSize
Definition: vtkPointWidget.h:286
vtkPointWidget::YShadowsOff
void YShadowsOff()
Definition: vtkPointWidget.h:165
vtkPointWidget::New
static vtkPointWidget * New()
Instantiate this widget.
vtkPointWidget::WaitCount
int WaitCount
Definition: vtkPointWidget.h:289
vtkPointWidget::Translating
@ Translating
Definition: vtkPointWidget.h:243
vtkPointWidget::AllOff
void AllOff()
Convenience methods to turn outline and shadows on and off.
Definition: vtkPointWidget.h:200
vtkPointWidget::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPointWidget::~vtkPointWidget
~vtkPointWidget() override
vtkPointWidget::State
int State
Definition: vtkPointWidget.h:237
vtkPointWidget::SetPosition
void SetPosition(double x, double y, double z)
Set/Get the position of the point.
Definition: vtkPointWidget.h:138
vtkPointWidget::OnLeftButtonUp
virtual void OnLeftButtonUp()
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
vtkLineWidget
3D widget for manipulating a line
Definition: vtkLineWidget.h:113
vtkPointWidget::GetTranslationMode
int GetTranslationMode()
Definition: vtkPointWidget.h:185
vtkPointWidget::Cursor3D
vtkCursor3D * Cursor3D
Definition: vtkPointWidget.h:263
vtkPointWidget::TranslationModeOn
void TranslationModeOn()
Definition: vtkPointWidget.h:186
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
vtkPointWidget::GetPosition
double * GetPosition()
Definition: vtkPointWidget.h:140
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkPointWidget::DetermineConstraintAxis
int DetermineConstraintAxis(int constraint, double *x)
vtkPointWidget::ConstraintAxis
int ConstraintAxis
Definition: vtkPointWidget.h:273
vtkPointWidget::SetXShadows
void SetXShadows(int o)
Turn on/off the wireframe x-shadows.
Definition: vtkPointWidget.h:154
vtkPointWidget::XShadowsOn
void XShadowsOn()
Definition: vtkPointWidget.h:156
vtkLineWidget::Outside
@ Outside
Definition: vtkLineWidget.h:228
vtk3DWidget
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:71
vtkPointWidget::SetOutline
void SetOutline(int o)
Turn on/off the wireframe bounding box.
Definition: vtkPointWidget.h:146
vtkPointWidget::OnMiddleButtonUp
virtual void OnMiddleButtonUp()
vtkPointWidget::Highlight
void Highlight(int highlight)
vtkPointWidget::SetTranslationMode
void SetTranslationMode(int mode)
If translation mode is on, as the widget is moved the bounding box, shadows, and cursor are all trans...
Definition: vtkPointWidget.h:180
vtkPointWidget::PlaceWidget
void PlaceWidget() override
Methods that satisfy the superclass' API.
Definition: vtkPointWidget.h:119
vtkPointWidget::XShadowsOff
void XShadowsOff()
Definition: vtkPointWidget.h:157
vtkPointWidget::SetYShadows
void SetYShadows(int o)
Turn on/off the wireframe y-shadows.
Definition: vtkPointWidget.h:162
vtkPointWidget::CursorPicker
vtkCellPicker * CursorPicker
Definition: vtkPointWidget.h:267
vtkPointWidget::Mapper
vtkPolyDataMapper * Mapper
Definition: vtkPointWidget.h:262
vtkPointWidget::Scaling
@ Scaling
Definition: vtkPointWidget.h:242
vtkPointWidget::Actor
vtkActor * Actor
Definition: vtkPointWidget.h:261
vtkPointWidget::SetEnabled
void SetEnabled(int) override
Methods that satisfy the superclass' API.
vtkPointWidget::SetZShadows
void SetZShadows(int o)
Turn on/off the wireframe z-shadows.
Definition: vtkPointWidget.h:170
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
vtkPointWidget::MoveFocus
void MoveFocus(double *p1, double *p2)
vtkPointWidget::OnMouseMove
virtual void OnMouseMove()
vtkX3D::mode
@ mode
Definition: vtkX3D.h:253
vtkPointWidget::ZShadowsOn
void ZShadowsOn()
Definition: vtkPointWidget.h:172
vtk3DWidget.h
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:171
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:96
vtkPointWidget::AllOn
void AllOn()
Convenience methods to turn outline and shadows on and off.
Definition: vtkPointWidget.h:193
vtkPointWidget::Moving
@ Moving
Definition: vtkPointWidget.h:241
vtkPointWidget::GetXShadows
int GetXShadows()
Definition: vtkPointWidget.h:155
vtkPointWidget::TranslationModeOff
void TranslationModeOff()
Definition: vtkPointWidget.h:187
vtkPointWidget::OutlineOff
void OutlineOff()
Definition: vtkPointWidget.h:149
vtkPointWidget::OnRightButtonUp
virtual void OnRightButtonUp()