VTK  9.5.2
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
54
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 }
101
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]);
120 void GetNormal(double xyz[3]);
122
124
133 vtkBooleanMacro(NormalToXAxis, vtkTypeBool);
136 vtkBooleanMacro(NormalToYAxis, vtkTypeBool);
139 vtkBooleanMacro(NormalToZAxis, vtkTypeBool);
141
143
147 vtkSetMacro(Tubing, vtkTypeBool);
148 vtkGetMacro(Tubing, vtkTypeBool);
149 vtkBooleanMacro(Tubing, vtkTypeBool);
151
153
160 vtkGetMacro(DrawPlane, vtkTypeBool);
161 vtkBooleanMacro(DrawPlane, vtkTypeBool);
163
165
173
175
180 vtkBooleanMacro(OutsideBounds, vtkTypeBool);
182
184
189 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
191
193
201
203
207 vtkSetClampMacro(DiagonalRatio, double, 0, 2);
208 vtkGetMacro(DiagonalRatio, double);
210
216
222
229 void GetPlane(vtkPlane* plane);
230
235 void UpdatePlacement() override;
236
240 void SizeHandles() override;
241
243
246 vtkGetObjectMacro(NormalProperty, vtkProperty);
249
251
255 vtkGetObjectMacro(PlaneProperty, vtkProperty);
258
260
263 vtkGetObjectMacro(OutlineProperty, vtkProperty);
266
268
272 vtkGetObjectMacro(EdgesProperty, vtkProperty);
274
275protected:
278
279 // Manage the state of the widget
280 int State;
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:42
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
Cut vtkDataSet with user-specified implicit function.
Definition vtkCutter.h:62
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
topologically and geometrically regular array of data
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
Methods that satisfy the superclass' API.
void GetPlane(vtkPlane *plane)
Get the implicit function for the plane.
void TranslateOutline(double *p1, double *p2)
void SizeHandles() override
Control widget appearance.
void SetDrawPlane(vtkTypeBool plane)
Enable/disable the drawing of the plane.
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)
void SetNormalToYAxis(vtkTypeBool)
Force the plane widget to be aligned with one of the x-y-z axes.
vtkPolyDataMapper * SphereMapper
void SetNormalToZAxis(vtkTypeBool)
Force the plane widget to be aligned with one of the x-y-z axes.
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.
vtkPolyDataAlgorithm * GetPolyDataAlgorithm() override
Satisfies superclass API.
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 SetNormal(double x, double y, double z)
Get the normal to the plane.
void TranslateOrigin(double *p1, double *p2)
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void GetPolyData(vtkPolyData *pd)
Grab the polydata that defines the plane.
void PlaceWidget() override
Methods that satisfy the superclass' API.
vtkPolyDataMapper * OutlineMapper
void PlaceWidget(double bounds[6]) override
Methods that satisfy the superclass' API.
void UpdatePlacement() override
Satisfies the superclass API.
void SetNormalToXAxis(vtkTypeBool)
Force the plane widget to be aligned with one of the x-y-z axes.
double * GetNormal()
Get the normal to the plane.
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:50
create wireframe outline for an arbitrary data set or composite dataset
perform various plane computations
Definition vtkPlane.h:32
map vtkPolyData to graphics primitives
vtkPolyDataSourceWidget()
Empty constructor that calls the parent constructor.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
represent surface properties of a geometric object
Definition vtkProperty.h:61
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 vtkPolyDataAlgorithm
#define VTK_SIZEHINT(...)