VTK  9.3.0
vtkPointWidget.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
64#ifndef vtkPointWidget_h
65#define vtkPointWidget_h
66
67#include "vtk3DWidget.h"
68#include "vtkCursor3D.h" // Needed for faster access to the Cursor3D
69#include "vtkInteractionWidgetsModule.h" // For export macro
70
71VTK_ABI_NAMESPACE_BEGIN
72class vtkActor;
74class vtkCellPicker;
75class vtkPolyData;
76class vtkProperty;
77
78class VTKINTERACTIONWIDGETS_EXPORT vtkPointWidget : public vtk3DWidget
79{
80public:
85
87 void PrintSelf(ostream& os, vtkIndent indent) override;
88
90
93 void SetEnabled(int) override;
94 void PlaceWidget(double bounds[6]) override;
95 void PlaceWidget() override { this->Superclass::PlaceWidget(); }
97 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
98 {
99 this->Superclass::PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax);
100 }
102
108
114 void SetPosition(double x, double y, double z) { this->Cursor3D->SetFocalPoint(x, y, z); }
115 void SetPosition(double x[3]) { this->SetPosition(x[0], x[1], x[2]); }
116 double* GetPosition() VTK_SIZEHINT(3) { return this->Cursor3D->GetFocalPoint(); }
117 void GetPosition(double xyz[3]) { this->Cursor3D->GetFocalPoint(xyz); }
118
122 void SetOutline(int o) { this->Cursor3D->SetOutline(o); }
123 int GetOutline() { return this->Cursor3D->GetOutline(); }
124 void OutlineOn() { this->Cursor3D->OutlineOn(); }
125 void OutlineOff() { this->Cursor3D->OutlineOff(); }
126
130 void SetXShadows(int o) { this->Cursor3D->SetXShadows(o); }
131 int GetXShadows() { return this->Cursor3D->GetXShadows(); }
132 void XShadowsOn() { this->Cursor3D->XShadowsOn(); }
133 void XShadowsOff() { this->Cursor3D->XShadowsOff(); }
134
138 void SetYShadows(int o) { this->Cursor3D->SetYShadows(o); }
139 int GetYShadows() { return this->Cursor3D->GetYShadows(); }
140 void YShadowsOn() { this->Cursor3D->YShadowsOn(); }
141 void YShadowsOff() { this->Cursor3D->YShadowsOff(); }
142
146 void SetZShadows(int o) { this->Cursor3D->SetZShadows(o); }
147 int GetZShadows() { return this->Cursor3D->GetZShadows(); }
148 void ZShadowsOn() { this->Cursor3D->ZShadowsOn(); }
149 void ZShadowsOff() { this->Cursor3D->ZShadowsOff(); }
150
156 void SetTranslationMode(int mode)
157 {
158 this->Cursor3D->SetTranslationMode(mode);
159 this->Cursor3D->Update();
160 }
161 int GetTranslationMode() { return this->Cursor3D->GetTranslationMode(); }
162 void TranslationModeOn() { this->SetTranslationMode(1); }
163 void TranslationModeOff() { this->SetTranslationMode(0); }
164
166
169 void AllOn()
170 {
171 this->OutlineOn();
172 this->XShadowsOn();
173 this->YShadowsOn();
174 this->ZShadowsOn();
175 }
176 void AllOff()
177 {
178 this->OutlineOff();
179 this->XShadowsOff();
180 this->YShadowsOff();
181 this->ZShadowsOff();
182 }
184
186
191 vtkGetObjectMacro(Property, vtkProperty);
192 vtkGetObjectMacro(SelectedProperty, vtkProperty);
194
196
202 vtkSetClampMacro(HotSpotSize, double, 0.0, 1.0);
203 vtkGetMacro(HotSpotSize, double);
205
206protected:
208 ~vtkPointWidget() override;
209
210 // Manage the state of the widget
211 friend class vtkLineWidget;
212
213 int State;
215 {
216 Start = 0,
220 Outside
221 };
222
223 // Handles the events
224 static void ProcessEvents(
225 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
226
227 // ProcessEvents() dispatches to these methods.
228 virtual void OnMouseMove();
229 virtual void OnLeftButtonDown();
230 virtual void OnLeftButtonUp();
231 virtual void OnMiddleButtonDown();
232 virtual void OnMiddleButtonUp();
233 virtual void OnRightButtonDown();
234 virtual void OnRightButtonUp();
235
236 // the cursor3D
240 void Highlight(int highlight);
241
242 // Do the picking
244
245 // Register internal Pickers within PickingManager
246 void RegisterPickers() override;
247
248 // Methods to manipulate the cursor
250 void Translate(double* p1, double* p2);
251 void Scale(double* p1, double* p2, int X, int Y);
252 void MoveFocus(double* p1, double* p2);
254
255 // Properties used to control the appearance of selected objects and
256 // the manipulator in general.
260
261 // The size of the hot spot.
263 int DetermineConstraintAxis(int constraint, double* x);
266
267private:
268 vtkPointWidget(const vtkPointWidget&) = delete;
269 void operator=(const vtkPointWidget&) = delete;
270};
271
272VTK_ABI_NAMESPACE_END
273#endif
an abstract superclass for 3D widgets
Definition vtk3DWidget.h:57
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:50
ray-cast cell picker for all kinds of Prop3Ds
generate a 3D cursor representation
Definition vtkCursor3D.h:38
a simple class to control print indentation
Definition vtkIndent.h:38
3D widget for manipulating a line
abstract base class for most VTK objects
Definition vtkObject.h:58
position a point in 3D space
void CreateDefaultProperties()
void PlaceWidget(double bounds[6]) override
Methods that satisfy the superclass' API.
double * GetPosition()
virtual void OnMouseMove()
void AllOff()
Convenience methods to turn outline and shadows on and off.
void GetPolyData(vtkPolyData *pd)
Grab the polydata (including points) that defines the point.
vtkPolyDataMapper * Mapper
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void TranslationModeOff()
~vtkPointWidget() override
void Highlight(int highlight)
void SetOutline(int o)
Turn on/off the wireframe bounding box.
void SetZShadows(int o)
Turn on/off the wireframe z-shadows.
vtkCursor3D * Cursor3D
int DetermineConstraintAxis(int constraint, double *x)
virtual void OnRightButtonDown()
void SetTranslationMode(int mode)
If translation mode is on, as the widget is moved the bounding box, shadows, and cursor are all trans...
void SetXShadows(int o)
Turn on/off the wireframe x-shadows.
static vtkPointWidget * New()
Instantiate this widget.
virtual void OnLeftButtonUp()
void GetPosition(double xyz[3])
void Translate(double *p1, double *p2)
virtual void OnRightButtonUp()
void SetEnabled(int) override
Methods that satisfy the superclass' API.
void SetPosition(double x[3])
virtual void OnMiddleButtonUp()
virtual void OnMiddleButtonDown()
void SetPosition(double x, double y, double z)
Set/Get the position of the point.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkProperty * SelectedProperty
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void PlaceWidget() override
Methods that satisfy the superclass' API.
virtual void OnLeftButtonDown()
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
Methods that satisfy the superclass' API.
vtkProperty * Property
void SetYShadows(int o)
Turn on/off the wireframe y-shadows.
vtkCellPicker * CursorPicker
void AllOn()
Convenience methods to turn outline and shadows on and off.
void Scale(double *p1, double *p2, int X, int Y)
void MoveFocus(double *p1, double *p2)
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:89
represent surface properties of a geometric object
Definition vtkProperty.h:66
#define VTK_SIZEHINT(...)