VTK  9.5.20251121
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
57
58#ifndef vtkImplicitPlaneWidget_h
59#define vtkImplicitPlaneWidget_h
60
61#include "vtkInteractionWidgetsModule.h" // For export macro
63
64VTK_ABI_NAMESPACE_BEGIN
65class vtkActor;
67class vtkCellPicker;
68class vtkConeSource;
69class vtkLineSource;
70class vtkSphereSource;
71class vtkTubeFilter;
72class vtkPlane;
73class vtkCutter;
74class vtkProperty;
75class vtkImageData;
77class vtkFeatureEdges;
78class vtkPolyData;
79class vtkTransform;
80
81class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitPlaneWidget : public vtkPolyDataSourceWidget
82{
83public:
88
90 void PrintSelf(ostream& os, vtkIndent indent) override;
91
93
96 void SetEnabled(int) override;
97 void PlaceWidget(double bounds[6]) override;
98 void PlaceWidget() override { this->Superclass::PlaceWidget(); }
100 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
101 {
102 this->Superclass::PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax);
103 }
104
105
107
110 virtual void SetOrigin(double x, double y, double z);
111 virtual void SetOrigin(double x[3]);
113 void GetOrigin(double xyz[3]);
115
117
120 void SetNormal(double x, double y, double z);
121 void SetNormal(double n[3]);
123 void GetNormal(double xyz[3]);
125
127
136 vtkBooleanMacro(NormalToXAxis, vtkTypeBool);
139 vtkBooleanMacro(NormalToYAxis, vtkTypeBool);
142 vtkBooleanMacro(NormalToZAxis, vtkTypeBool);
144
146
150 vtkSetMacro(Tubing, vtkTypeBool);
151 vtkGetMacro(Tubing, vtkTypeBool);
152 vtkBooleanMacro(Tubing, vtkTypeBool);
154
156
163 vtkGetMacro(DrawPlane, vtkTypeBool);
164 vtkBooleanMacro(DrawPlane, vtkTypeBool);
166
168
176
178
183 vtkBooleanMacro(OutsideBounds, vtkTypeBool);
185
187
192 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
194
196
204
206
210 vtkSetClampMacro(DiagonalRatio, double, 0, 2);
211 vtkGetMacro(DiagonalRatio, double);
213
219
225
232 void GetPlane(vtkPlane* plane);
233
238 void UpdatePlacement() override;
239
243 void SizeHandles() override;
244
246
249 vtkGetObjectMacro(NormalProperty, vtkProperty);
252
254
258 vtkGetObjectMacro(PlaneProperty, vtkProperty);
261
263
266 vtkGetObjectMacro(OutlineProperty, vtkProperty);
269
271
275 vtkGetObjectMacro(EdgesProperty, vtkProperty);
277
278protected:
281
282 // Manage the state of the widget
283 int State;
295
296 // handles the events
297 static void ProcessEvents(
298 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
299
300 // ProcessEvents() dispatches to these methods.
308
309 // Controlling ivars
314
315 // The actual plane which is being manipulated
317
318 // The bounding box is represented by a single voxel image data
323 void HighlightOutline(int highlight);
324 vtkTypeBool OutlineTranslation; // whether the outline can be moved
325 vtkTypeBool ScaleEnabled; // whether the widget can be scaled
326 vtkTypeBool OutsideBounds; // whether the widget can be moved outside input's bounds
327
328 // The cut plane is produced with a vtkCutter
333 virtual void HighlightPlane(int highlight);
334
335 // Optional tubes are represented by extracting boundary edges and tubing
340 vtkTypeBool Tubing; // control whether tubing is on
341
342 // Control final length of the arrow:
344
345 // The + normal cone
349 void HighlightNormal(int highlight);
350
351 // The + normal line
355
356 // The - normal cone
360
361 // The - normal line
365
366 // The origin positioning handle
370 vtkTypeBool OriginTranslation; // whether the origin (sphere) can be moved
371
372 // Do the picking
374
375 // Register internal Pickers within PickingManager
376 void RegisterPickers() override;
377
378 // Transform the normal (used for rotation)
380
381 // Methods to manipulate the plane
382 void ConstrainOrigin(double x[3]);
383 void Rotate(int X, int Y, double* p1, double* p2, double* vpn);
384 void TranslatePlane(double* p1, double* p2);
385 void TranslateOutline(double* p1, double* p2);
386 void TranslateOrigin(double* p1, double* p2);
387 void Push(double* p1, double* p2);
388 void Scale(double* p1, double* p2, int X, int Y);
389
390 // Properties used to control the appearance of selected objects and
391 // the manipulator in general.
400
402
403private:
405 void operator=(const vtkImplicitPlaneWidget&) = delete;
406};
407
408VTK_ABI_NAMESPACE_END
409#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:151
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
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:108
create a line defined by two end points
abstract base class for most VTK objects
Definition vtkObject.h:162
create wireframe outline for an arbitrary data set or composite dataset
perform various plane computations
Definition vtkPlane.h:141
map vtkPolyData to graphics primitives
vtkPolyDataSourceWidget()
Empty constructor that calls the parent constructor.
concrete dataset represents vertices, lines, polygons, and triangle strips
represent surface properties of a geometric object
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(...)
#define vtkPolyDataAlgorithm
#define vtkCutter
Definition vtkmSlice.h:23