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
55#ifndef vtkPointWidget_h
56#define vtkPointWidget_h
57
58#include "vtk3DWidget.h"
59#include "vtkCursor3D.h" // Needed for faster access to the Cursor3D
60#include "vtkInteractionWidgetsModule.h" // For export macro
61
62VTK_ABI_NAMESPACE_BEGIN
63class vtkActor;
65class vtkCellPicker;
66class vtkPolyData;
67class vtkProperty;
68
69class VTKINTERACTIONWIDGETS_EXPORT vtkPointWidget : public vtk3DWidget
70{
71public:
76
78 void PrintSelf(ostream& os, vtkIndent indent) override;
79
81
84 void SetEnabled(int) override;
85 void PlaceWidget(double bounds[6]) override;
86 void PlaceWidget() override { this->Superclass::PlaceWidget(); }
88 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
89 {
90 this->Superclass::PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax);
91 }
93
99
105 void SetPosition(double x, double y, double z) { this->Cursor3D->SetFocalPoint(x, y, z); }
106 void SetPosition(double x[3]) { this->SetPosition(x[0], x[1], x[2]); }
107 double* GetPosition() VTK_SIZEHINT(3) { return this->Cursor3D->GetFocalPoint(); }
108 void GetPosition(double xyz[3]) { this->Cursor3D->GetFocalPoint(xyz); }
109
113 void SetOutline(int o) { this->Cursor3D->SetOutline(o); }
114 int GetOutline() { return this->Cursor3D->GetOutline(); }
115 void OutlineOn() { this->Cursor3D->OutlineOn(); }
116 void OutlineOff() { this->Cursor3D->OutlineOff(); }
117
121 void SetXShadows(int o) { this->Cursor3D->SetXShadows(o); }
122 int GetXShadows() { return this->Cursor3D->GetXShadows(); }
123 void XShadowsOn() { this->Cursor3D->XShadowsOn(); }
124 void XShadowsOff() { this->Cursor3D->XShadowsOff(); }
125
129 void SetYShadows(int o) { this->Cursor3D->SetYShadows(o); }
130 int GetYShadows() { return this->Cursor3D->GetYShadows(); }
131 void YShadowsOn() { this->Cursor3D->YShadowsOn(); }
132 void YShadowsOff() { this->Cursor3D->YShadowsOff(); }
133
137 void SetZShadows(int o) { this->Cursor3D->SetZShadows(o); }
138 int GetZShadows() { return this->Cursor3D->GetZShadows(); }
139 void ZShadowsOn() { this->Cursor3D->ZShadowsOn(); }
140 void ZShadowsOff() { this->Cursor3D->ZShadowsOff(); }
141
147 void SetTranslationMode(int mode)
148 {
149 this->Cursor3D->SetTranslationMode(mode);
150 this->Cursor3D->Update();
151 }
152 int GetTranslationMode() { return this->Cursor3D->GetTranslationMode(); }
153 void TranslationModeOn() { this->SetTranslationMode(1); }
154 void TranslationModeOff() { this->SetTranslationMode(0); }
155
157
160 void AllOn()
161 {
162 this->OutlineOn();
163 this->XShadowsOn();
164 this->YShadowsOn();
165 this->ZShadowsOn();
166 }
167 void AllOff()
168 {
169 this->OutlineOff();
170 this->XShadowsOff();
171 this->YShadowsOff();
172 this->ZShadowsOff();
173 }
175
177
182 vtkGetObjectMacro(Property, vtkProperty);
183 vtkGetObjectMacro(SelectedProperty, vtkProperty);
185
187
193 vtkSetClampMacro(HotSpotSize, double, 0.0, 1.0);
194 vtkGetMacro(HotSpotSize, double);
196
197protected:
199 ~vtkPointWidget() override;
200
201 // Manage the state of the widget
202 friend class vtkLineWidget;
203
204 int State;
206 {
207 Start = 0,
211 Outside
212 };
213
214 // Handles the events
215 static void ProcessEvents(
216 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
217
218 // ProcessEvents() dispatches to these methods.
219 virtual void OnMouseMove();
220 virtual void OnLeftButtonDown();
221 virtual void OnLeftButtonUp();
222 virtual void OnMiddleButtonDown();
223 virtual void OnMiddleButtonUp();
224 virtual void OnRightButtonDown();
225 virtual void OnRightButtonUp();
226
227 // the cursor3D
231 void Highlight(int highlight);
232
233 // Do the picking
235
236 // Register internal Pickers within PickingManager
237 void RegisterPickers() override;
238
239 // Methods to manipulate the cursor
241 void Translate(double* p1, double* p2);
242 void Scale(double* p1, double* p2, int X, int Y);
243 void MoveFocus(double* p1, double* p2);
245
246 // Properties used to control the appearance of selected objects and
247 // the manipulator in general.
251
252 // The size of the hot spot.
254 int DetermineConstraintAxis(int constraint, double* x);
257
258private:
259 vtkPointWidget(const vtkPointWidget&) = delete;
260 void operator=(const vtkPointWidget&) = delete;
261};
262
263VTK_ABI_NAMESPACE_END
264#endif
an abstract superclass for 3D widgets
Definition vtk3DWidget.h:57
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:41
ray-cast cell picker for all kinds of Prop3Ds
generate a 3D cursor representation
Definition vtkCursor3D.h:29
a simple class to control print indentation
Definition vtkIndent.h:29
3D widget for manipulating a line
abstract base class for most VTK objects
Definition vtkObject.h:49
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:80
represent surface properties of a geometric object
Definition vtkProperty.h:57
#define VTK_SIZEHINT(...)