VTK  9.3.20240423
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
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 }
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]);
122 double* GetNormal() VTK_SIZEHINT(3);
123 void GetNormal(double xyz[3]);
125
127
134 void SetNormalToXAxis(vtkTypeBool);
135 vtkGetMacro(NormalToXAxis, vtkTypeBool);
136 vtkBooleanMacro(NormalToXAxis, vtkTypeBool);
137 void SetNormalToYAxis(vtkTypeBool);
138 vtkGetMacro(NormalToYAxis, vtkTypeBool);
139 vtkBooleanMacro(NormalToYAxis, vtkTypeBool);
140 void SetNormalToZAxis(vtkTypeBool);
141 vtkGetMacro(NormalToZAxis, vtkTypeBool);
142 vtkBooleanMacro(NormalToZAxis, vtkTypeBool);
144
146
150 vtkSetMacro(Tubing, vtkTypeBool);
151 vtkGetMacro(Tubing, vtkTypeBool);
152 vtkBooleanMacro(Tubing, vtkTypeBool);
154
156
162 void SetDrawPlane(vtkTypeBool plane);
163 vtkGetMacro(DrawPlane, vtkTypeBool);
164 vtkBooleanMacro(DrawPlane, vtkTypeBool);
166
168
172 vtkSetMacro(OutlineTranslation, vtkTypeBool);
173 vtkGetMacro(OutlineTranslation, vtkTypeBool);
174 vtkBooleanMacro(OutlineTranslation, vtkTypeBool);
176
178
181 vtkSetMacro(OutsideBounds, vtkTypeBool);
182 vtkGetMacro(OutsideBounds, vtkTypeBool);
183 vtkBooleanMacro(OutsideBounds, vtkTypeBool);
185
187
190 vtkSetMacro(ScaleEnabled, vtkTypeBool);
191 vtkGetMacro(ScaleEnabled, vtkTypeBool);
192 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
194
196
200 vtkSetMacro(OriginTranslation, vtkTypeBool);
201 vtkGetMacro(OriginTranslation, vtkTypeBool);
202 vtkBooleanMacro(OriginTranslation, vtkTypeBool);
204
206
210 vtkSetClampMacro(DiagonalRatio, double, 0, 2);
211 vtkGetMacro(DiagonalRatio, double);
213
218 void GetPolyData(vtkPolyData* pd);
219
224 vtkPolyDataAlgorithm* GetPolyDataAlgorithm() override;
225
232 void GetPlane(vtkPlane* plane);
233
238 void UpdatePlacement() override;
239
243 void SizeHandles() override;
244
246
249 vtkGetObjectMacro(NormalProperty, vtkProperty);
250 vtkGetObjectMacro(SelectedNormalProperty, vtkProperty);
252
254
258 vtkGetObjectMacro(PlaneProperty, vtkProperty);
259 vtkGetObjectMacro(SelectedPlaneProperty, vtkProperty);
261
263
266 vtkGetObjectMacro(OutlineProperty, vtkProperty);
267 vtkGetObjectMacro(SelectedOutlineProperty, vtkProperty);
269
271
275 vtkGetObjectMacro(EdgesProperty, vtkProperty);
277
278protected:
281
282 // Manage the state of the widget
283 int State;
285 {
286 Start = 0,
293 Outside
294 };
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
Cut vtkDataSet with user-specified implicit function.
Definition vtkCutter.h:161
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: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:135
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
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(...)