VTK  9.2.6
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=========================================================================*/
86#ifndef vtkPointWidget_h
87#define vtkPointWidget_h
88
89#include "vtk3DWidget.h"
90#include "vtkCursor3D.h" // Needed for faster access to the Cursor3D
91#include "vtkInteractionWidgetsModule.h" // For export macro
92
93class vtkActor;
95class vtkCellPicker;
96class vtkPolyData;
97class vtkProperty;
98
99class VTKINTERACTIONWIDGETS_EXPORT vtkPointWidget : public vtk3DWidget
100{
101public:
106
108 void PrintSelf(ostream& os, vtkIndent indent) override;
109
111
114 void SetEnabled(int) override;
115 void PlaceWidget(double bounds[6]) override;
116 void PlaceWidget() override { this->Superclass::PlaceWidget(); }
118 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
119 {
120 this->Superclass::PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax);
121 }
123
129
135 void SetPosition(double x, double y, double z) { this->Cursor3D->SetFocalPoint(x, y, z); }
136 void SetPosition(double x[3]) { this->SetPosition(x[0], x[1], x[2]); }
137 double* GetPosition() VTK_SIZEHINT(3) { return this->Cursor3D->GetFocalPoint(); }
138 void GetPosition(double xyz[3]) { this->Cursor3D->GetFocalPoint(xyz); }
139
143 void SetOutline(int o) { this->Cursor3D->SetOutline(o); }
144 int GetOutline() { return this->Cursor3D->GetOutline(); }
145 void OutlineOn() { this->Cursor3D->OutlineOn(); }
146 void OutlineOff() { this->Cursor3D->OutlineOff(); }
147
151 void SetXShadows(int o) { this->Cursor3D->SetXShadows(o); }
152 int GetXShadows() { return this->Cursor3D->GetXShadows(); }
153 void XShadowsOn() { this->Cursor3D->XShadowsOn(); }
154 void XShadowsOff() { this->Cursor3D->XShadowsOff(); }
155
159 void SetYShadows(int o) { this->Cursor3D->SetYShadows(o); }
160 int GetYShadows() { return this->Cursor3D->GetYShadows(); }
161 void YShadowsOn() { this->Cursor3D->YShadowsOn(); }
162 void YShadowsOff() { this->Cursor3D->YShadowsOff(); }
163
167 void SetZShadows(int o) { this->Cursor3D->SetZShadows(o); }
168 int GetZShadows() { return this->Cursor3D->GetZShadows(); }
169 void ZShadowsOn() { this->Cursor3D->ZShadowsOn(); }
170 void ZShadowsOff() { this->Cursor3D->ZShadowsOff(); }
171
178 {
179 this->Cursor3D->SetTranslationMode(mode);
180 this->Cursor3D->Update();
181 }
182 int GetTranslationMode() { return this->Cursor3D->GetTranslationMode(); }
183 void TranslationModeOn() { this->SetTranslationMode(1); }
184 void TranslationModeOff() { this->SetTranslationMode(0); }
185
187
190 void AllOn()
191 {
192 this->OutlineOn();
193 this->XShadowsOn();
194 this->YShadowsOn();
195 this->ZShadowsOn();
196 }
197 void AllOff()
198 {
199 this->OutlineOff();
200 this->XShadowsOff();
201 this->YShadowsOff();
202 this->ZShadowsOff();
203 }
205
207
212 vtkGetObjectMacro(Property, vtkProperty);
213 vtkGetObjectMacro(SelectedProperty, vtkProperty);
215
217
223 vtkSetClampMacro(HotSpotSize, double, 0.0, 1.0);
224 vtkGetMacro(HotSpotSize, double);
226
227protected:
229 ~vtkPointWidget() override;
230
231 // Manage the state of the widget
232 friend class vtkLineWidget;
233
234 int State;
236 {
237 Start = 0,
241 Outside
242 };
243
244 // Handles the events
245 static void ProcessEvents(
246 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
247
248 // ProcessEvents() dispatches to these methods.
249 virtual void OnMouseMove();
250 virtual void OnLeftButtonDown();
251 virtual void OnLeftButtonUp();
252 virtual void OnMiddleButtonDown();
253 virtual void OnMiddleButtonUp();
254 virtual void OnRightButtonDown();
255 virtual void OnRightButtonUp();
256
257 // the cursor3D
261 void Highlight(int highlight);
262
263 // Do the picking
265
266 // Register internal Pickers within PickingManager
267 void RegisterPickers() override;
268
269 // Methods to manipulate the cursor
271 void Translate(double* p1, double* p2);
272 void Scale(double* p1, double* p2, int X, int Y);
273 void MoveFocus(double* p1, double* p2);
275
276 // Properties used to control the appearance of selected objects and
277 // the manipulator in general.
281
282 // The size of the hot spot.
284 int DetermineConstraintAxis(int constraint, double* x);
287
288private:
289 vtkPointWidget(const vtkPointWidget&) = delete;
290 void operator=(const vtkPointWidget&) = delete;
291};
292
293#endif
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:68
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
ray-cast cell picker for all kinds of Prop3Ds
generate a 3D cursor representation
Definition: vtkCursor3D.h:59
a simple class to control print indentation
Definition: vtkIndent.h:119
3D widget for manipulating a line
abstract base class for most VTK objects
Definition: vtkObject.h:79
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 TranslationModeOn()
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.
vtkActor * Actor
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()
int GetTranslationMode()
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:200
represent surface properties of a geometric object
Definition: vtkProperty.h:177
@ mode
Definition: vtkX3D.h:253
#define VTK_SIZEHINT(...)