VTK  9.3.0
vtkImplicitPlaneWidget.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 vtkImplicitPlaneWidget_h
56#define vtkImplicitPlaneWidget_h
57
58#include "vtkInteractionWidgetsModule.h" // For export macro
60
61VTK_ABI_NAMESPACE_BEGIN
62class vtkActor;
64class vtkCellPicker;
65class vtkConeSource;
66class vtkLineSource;
67class vtkSphereSource;
68class vtkTubeFilter;
69class vtkPlane;
70class vtkCutter;
71class vtkProperty;
72class vtkImageData;
74class vtkFeatureEdges;
75class vtkPolyData;
76class vtkTransform;
77
78class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitPlaneWidget : public vtkPolyDataSourceWidget
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
104
107 virtual void SetOrigin(double x, double y, double z);
108 virtual void SetOrigin(double x[3]);
110 void GetOrigin(double xyz[3]);
112
114
117 void SetNormal(double x, double y, double z);
118 void SetNormal(double n[3]);
119 double* GetNormal() VTK_SIZEHINT(3);
120 void GetNormal(double xyz[3]);
122
124
131 void SetNormalToXAxis(vtkTypeBool);
132 vtkGetMacro(NormalToXAxis, vtkTypeBool);
133 vtkBooleanMacro(NormalToXAxis, vtkTypeBool);
134 void SetNormalToYAxis(vtkTypeBool);
135 vtkGetMacro(NormalToYAxis, vtkTypeBool);
136 vtkBooleanMacro(NormalToYAxis, vtkTypeBool);
137 void SetNormalToZAxis(vtkTypeBool);
138 vtkGetMacro(NormalToZAxis, vtkTypeBool);
139 vtkBooleanMacro(NormalToZAxis, vtkTypeBool);
141
143
147 vtkSetMacro(Tubing, vtkTypeBool);
148 vtkGetMacro(Tubing, vtkTypeBool);
149 vtkBooleanMacro(Tubing, vtkTypeBool);
151
153
159 void SetDrawPlane(vtkTypeBool plane);
160 vtkGetMacro(DrawPlane, vtkTypeBool);
161 vtkBooleanMacro(DrawPlane, vtkTypeBool);
163
165
169 vtkSetMacro(OutlineTranslation, vtkTypeBool);
170 vtkGetMacro(OutlineTranslation, vtkTypeBool);
171 vtkBooleanMacro(OutlineTranslation, vtkTypeBool);
173
175
178 vtkSetMacro(OutsideBounds, vtkTypeBool);
179 vtkGetMacro(OutsideBounds, vtkTypeBool);
180 vtkBooleanMacro(OutsideBounds, vtkTypeBool);
182
184
187 vtkSetMacro(ScaleEnabled, vtkTypeBool);
188 vtkGetMacro(ScaleEnabled, vtkTypeBool);
189 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
191
193
197 vtkSetMacro(OriginTranslation, vtkTypeBool);
198 vtkGetMacro(OriginTranslation, vtkTypeBool);
199 vtkBooleanMacro(OriginTranslation, vtkTypeBool);
201
203
207 vtkSetClampMacro(DiagonalRatio, double, 0, 2);
208 vtkGetMacro(DiagonalRatio, double);
210
215 void GetPolyData(vtkPolyData* pd);
216
221 vtkPolyDataAlgorithm* GetPolyDataAlgorithm() override;
222
229 void GetPlane(vtkPlane* plane);
230
235 void UpdatePlacement() override;
236
240 void SizeHandles() override;
241
243
246 vtkGetObjectMacro(NormalProperty, vtkProperty);
247 vtkGetObjectMacro(SelectedNormalProperty, vtkProperty);
249
251
255 vtkGetObjectMacro(PlaneProperty, vtkProperty);
256 vtkGetObjectMacro(SelectedPlaneProperty, vtkProperty);
258
260
263 vtkGetObjectMacro(OutlineProperty, vtkProperty);
264 vtkGetObjectMacro(SelectedOutlineProperty, vtkProperty);
266
268
272 vtkGetObjectMacro(EdgesProperty, vtkProperty);
274
275protected:
278
279 // Manage the state of the widget
280 int State;
282 {
283 Start = 0,
290 Outside
291 };
292
293 // handles the events
294 static void ProcessEvents(
295 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
296
297 // ProcessEvents() dispatches to these methods.
305
306 // Controlling ivars
311
312 // The actual plane which is being manipulated
314
315 // The bounding box is represented by a single voxel image data
320 void HighlightOutline(int highlight);
321 vtkTypeBool OutlineTranslation; // whether the outline can be moved
322 vtkTypeBool ScaleEnabled; // whether the widget can be scaled
323 vtkTypeBool OutsideBounds; // whether the widget can be moved outside input's bounds
324
325 // The cut plane is produced with a vtkCutter
330 virtual void HighlightPlane(int highlight);
331
332 // Optional tubes are represented by extracting boundary edges and tubing
337 vtkTypeBool Tubing; // control whether tubing is on
338
339 // Control final length of the arrow:
341
342 // The + normal cone
346 void HighlightNormal(int highlight);
347
348 // The + normal line
352
353 // The - normal cone
357
358 // The - normal line
362
363 // The origin positioning handle
367 vtkTypeBool OriginTranslation; // whether the origin (sphere) can be moved
368
369 // Do the picking
371
372 // Register internal Pickers within PickingManager
373 void RegisterPickers() override;
374
375 // Transform the normal (used for rotation)
377
378 // Methods to manipulate the plane
379 void ConstrainOrigin(double x[3]);
380 void Rotate(int X, int Y, double* p1, double* p2, double* vpn);
381 void TranslatePlane(double* p1, double* p2);
382 void TranslateOutline(double* p1, double* p2);
383 void TranslateOrigin(double* p1, double* p2);
384 void Push(double* p1, double* p2);
385 void Scale(double* p1, double* p2, int X, int Y);
386
387 // Properties used to control the appearance of selected objects and
388 // the manipulator in general.
397
399
400private:
402 void operator=(const vtkImplicitPlaneWidget&) = delete;
403};
404
405VTK_ABI_NAMESPACE_END
406#endif
virtual void PlaceWidget()
This method is used to initially place the widget.
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:41
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
Cut vtkDataSet with user-specified implicit function.
Definition vtkCutter.h:61
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
topologically and geometrically regular array of data
3D widget for manipulating an infinite plane
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
Methods that satisfy the superclass' API.
void TranslateOutline(double *p1, double *p2)
void TranslatePlane(double *p1, double *p2)
static vtkImplicitPlaneWidget * New()
Instantiate the object.
vtkPolyDataMapper * ConeMapper2
void Rotate(int X, int Y, double *p1, double *p2, double *vpn)
virtual void HighlightPlane(int highlight)
vtkPolyDataMapper * SphereMapper
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void ConstrainOrigin(double x[3])
virtual void SetOrigin(double x, double y, double z)
Get the origin of the plane.
void Scale(double *p1, double *p2, int X, int Y)
void HighlightNormal(int highlight)
void SetEnabled(int) override
Methods that satisfy the superclass' API.
void TranslateOrigin(double *p1, double *p2)
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void PlaceWidget() override
Methods that satisfy the superclass' API.
vtkPolyDataMapper * OutlineMapper
void PlaceWidget(double bounds[6]) override
Methods that satisfy the superclass' API.
double * GetOrigin()
Get the origin of the plane.
virtual void SetOrigin(double x[3])
Get the origin of the plane.
void HighlightOutline(int highlight)
vtkPolyDataMapper * EdgesMapper
vtkPolyDataMapper * LineMapper2
void Push(double *p1, double *p2)
a simple class to control print indentation
Definition vtkIndent.h:29
create a line defined by two end points
abstract base class for most VTK objects
Definition vtkObject.h:49
create wireframe outline for an arbitrary data set or composite dataset
perform various plane computations
Definition vtkPlane.h:26
Superclass for algorithms that produce only polydata as output.
map vtkPolyData to graphics primitives
abstract PolyDataSource-based 3D widget
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
represent surface properties of a geometric object
Definition vtkProperty.h:57
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
filter that generates tubes around lines
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)