VTK  9.4.20251007
vtkDisplaySizedImplicitPlaneRepresentation.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
27
28#ifndef vtkDisplaySizedImplicitPlaneRepresentation_h
29#define vtkDisplaySizedImplicitPlaneRepresentation_h
30
31#include "vtkInteractionWidgetsModule.h" // For export macro
32#include "vtkNew.h" // For vtkNew command
34#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
35
36VTK_ABI_NAMESPACE_BEGIN
37class vtkActor;
38class vtkBox;
39class vtkCellPicker;
40class vtkConeSource;
41class vtkCutter;
42class vtkDiskSource;
43class vtkFeatureEdges;
45class vtkImageData;
46class vtkLineSource;
47class vtkLookupTable;
49class vtkPlane;
50class vtkPolyData;
53class vtkProperty;
54class vtkSphereSource;
55class vtkTransform;
56class vtkTubeFilter;
57
60{
61public:
66
68
72 void PrintSelf(ostream& os, vtkIndent indent) override;
74
76
79 void SetOrigin(double x, double y, double z);
80 void SetOrigin(double x[3]);
81 double* GetOrigin() VTK_SIZEHINT(3);
82 void GetOrigin(double xyz[3]);
84
86
89 void SetNormal(double x, double y, double z);
90 void SetNormal(double n[3]);
92 double* GetNormal() VTK_SIZEHINT(3);
93 void GetNormal(double xyz[3]);
95
97
106 vtkBooleanMacro(NormalToXAxis, vtkTypeBool);
109 vtkBooleanMacro(NormalToYAxis, vtkTypeBool);
112 vtkBooleanMacro(NormalToZAxis, vtkTypeBool);
114
116
125
127
130 virtual void SetRadiusMultiplier(double radiusMultiplier);
131 virtual double GetRadiusMultiplierMinValue() { return 0.000001; }
132 virtual double GetRadiusMultiplierMaxValue() { return VTK_DOUBLE_MAX; }
133 vtkGetMacro(RadiusMultiplier, double);
135
137
144 vtkGetMacro(DrawPlane, vtkTypeBool);
145 vtkBooleanMacro(DrawPlane, vtkTypeBool);
147
149
154 vtkBooleanMacro(DrawOutline, vtkTypeBool);
156
158
163 void SetDrawIntersectionEdges(vtkTypeBool intersectionEdges);
167
169
177
179
185 vtkBooleanMacro(OutsideBounds, vtkTypeBool);
187
189
197
199
204
206
212 vtkSetVector6Macro(WidgetBounds, double);
213 vtkGetVector6Macro(WidgetBounds, double);
215
217
228
230
240
242
247 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
249
255
261
270 void GetPlane(vtkPlane* plane);
271
278 void SetPlane(vtkPlane* plane);
279
285
287
291 vtkGetObjectMacro(NormalProperty, vtkProperty);
294
296
300 vtkGetObjectMacro(SphereProperty, vtkProperty);
303
305
309 vtkGetObjectMacro(PlaneProperty, vtkProperty);
312
314
317 vtkGetObjectMacro(OutlineProperty, vtkProperty);
320
322
326 vtkGetObjectMacro(EdgesProperty, vtkProperty);
329
331
336
338
343 void SetInteractionColor(double, double, double);
344 void SetInteractionColor(double c[3]) { this->SetInteractionColor(c[0], c[1], c[2]); }
345 void SetHandleColor(double, double, double);
346 void SetHandleColor(double c[3]) { this->SetHandleColor(c[0], c[1], c[2]); }
347 void SetForegroundColor(double, double, double);
348 void SetForegroundColor(double c[3]) { this->SetForegroundColor(c[0], c[1], c[2]); }
350
351 VTK_DEPRECATED_IN_9_3_0("Please use SetInteractionColor instead.")
352 void SetSelectedWidgetColor(double a, double b, double c) { this->SetInteractionColor(a, b, c); }
353 VTK_DEPRECATED_IN_9_3_0("Please use SetInteractionColor instead.")
354 void SetSelectedWidgetColor(double c[3]) { this->SetInteractionColor(c); }
355 VTK_DEPRECATED_IN_9_3_0("Please use SetHandleColor instead.")
356 void SetUnselectedWidgetColor(double a, double b, double c) { this->SetHandleColor(a, b, c); }
357 VTK_DEPRECATED_IN_9_3_0("Please use SetHandleColor instead.")
358 void SetUnselectedWidgetColor(double c[3]) { this->SetHandleColor(c); }
359
361
366 vtkSetClampMacro(BumpDistance, double, 0.000001, 1);
367 vtkGetMacro(BumpDistance, double);
369
378 void BumpPlane(int dir, double factor);
379
386 void PushPlane(double distance);
387
389
393 vtkGetMacro(PickCameraFocalInfo, bool);
394 vtkSetMacro(PickCameraFocalInfo, bool);
395 vtkBooleanMacro(PickCameraFocalInfo, bool);
397
405 bool PickOrigin(int X, int Y, bool snapToMeshPoint = false);
406
414 bool PickNormal(int X, int Y, bool snapToMeshPoint = false);
415
417
420 int ComputeInteractionState(int X, int Y, int modify = 0) override;
421 void PlaceWidget(double bounds[6]) override;
422 void BuildRepresentation() override;
423 void StartWidgetInteraction(double eventPos[2]) override;
424 void WidgetInteraction(double newEventPos[2]) override;
425 void EndWidgetInteraction(double newEventPos[2]) override;
427 unsigned long event, void* calldata) override;
429 unsigned long event, void* calldata) override;
431 unsigned long event, void* calldata, int modify = 0) override;
433 unsigned long event, void* calldata) override;
435
437
440 double* GetBounds() VTK_SIZEHINT(6) override;
441 void GetActors(vtkPropCollection* pc) override;
447
448 // Manage the state of the widget
460
462
471 vtkSetClampMacro(InteractionState, int, Outside, Scaling);
473
475
479 virtual void SetRepresentationState(int);
480 vtkGetMacro(RepresentationState, int);
482
483 // Get the underlying implicit plane object used by this rep
484 // that can be used as a cropping plane in vtkMapper.
485 vtkPlane* GetUnderlyingPlane() { return this->Plane; }
486
488
492 vtkGetMacro(SnapToAxes, bool);
493 vtkSetMacro(SnapToAxes, bool);
494 vtkBooleanMacro(SnapToAxes, bool);
496
498
504 vtkGetMacro(AlwaysSnapToNearestAxis, bool);
505 virtual void SetAlwaysSnapToNearestAxis(bool snap)
506 {
507 this->AlwaysSnapToNearestAxis = snap;
508 this->SetNormal(this->GetNormal());
509 }
510
511
512protected:
515
517
518 // Keep track of event positions
522
523 // Controlling ivars
527
531
533
535
536 // Locking normal to camera
538
539 // Controlling the push operation
541
543
544 // The bounding box is represented by a single voxel image data
549 vtkTypeBool OutlineTranslation; // whether the outline can be moved
550 vtkTypeBool ScaleEnabled; // whether the widget can be scaled
551 vtkTypeBool OutsideBounds; // whether the widget can be moved outside input's bounds
552 double WidgetBounds[6];
553 vtkTypeBool ConstrainToWidgetBounds; // whether the widget can be moved outside input's bounds
554 vtkTypeBool ConstrainMaximumSizeToWidgetBounds; // whether the maximum widget size is constrained
555 vtkTypeBool DrawOutline; // whether to draw the outline
556 void HighlightOutline(int highlight);
557
558 // The plane
565 void HighlightPlane(int highlight);
566
567 // plane boundary edges are represented as tubes
572 void HighlightEdges(int highlight);
573
575
579 void SetEdgesColor(double, double, double);
580 void SetEdgesColor(double c[3]);
582
583 // The intersection edges with the outline
590
592
596 void SetIntersectionEdgesColor(double, double, double);
597 void SetIntersectionEdgesColor(double c[3]);
599
600 // The + normal cone
604 void HighlightNormal(int highlight);
605
606 // The normal line
610
611 // The - normal cone
615
616 // The origin positioning handle
620 void HighlightSphere(int highlight);
621
622 // Do the picking
623 vtkNew<vtkHardwarePicker> HardwarePicker; // Used for picking rendered props (screen)
624 vtkNew<vtkCellPicker> CellPicker; // Used for picking widget props (screen and VR)
625 // Compute Cell Picker tolerance
627
628 // Register internal Pickers within PickingManager
629 void RegisterPickers() override;
630
631 // Transform the normal (used for rotation)
633
634 // Methods to manipulate the plane
635 void Rotate(double X, double Y, double* p1, double* p2, double* vpn);
636 void Rotate3D(double* p1, double* p2);
637 void TranslateOutline(double* p1, double* p2);
638 void TranslateOrigin(double* p1, double* p2);
639 void UpdatePose(double* p1, double* d1, double* p2, double* d2);
640 void Push(double* p1, double* p2);
641 void ResizeRadius(double* p1, double* p2, double* vpn);
642 void ResizeRadius3D(double* p1, double* p2);
643 void Scale(double* p1, double* p2, double X, double Y);
645
646 // Properties used to control the appearance of selected objects and
647 // the manipulator in general.
660
661 // Support GetBounds() method
663
664private:
667 void operator=(const vtkDisplaySizedImplicitPlaneRepresentation&) = delete;
668};
669
670VTK_ABI_NAMESPACE_END
671#endif
define the API for widget / widget representation
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:42
implicit function for a bounding box
Definition vtkBox.h:31
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
Cut vtkDataSet with user-specified implicit function.
Definition vtkCutter.h:62
create a disk with hole in center
void SetHandleColor(double, double, double)
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
void BumpPlane(int dir, double factor)
Translate the plane in the direction of the normal by the specified BumpDistance.
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting the rendering process.
void ResizeRadius(double *p1, double *p2, double *vpn)
void SetTranslationAxisOff()
Toggles constraint translation axis on/off.
virtual void SetLockNormalToCamera(vtkTypeBool)
If enabled, and a vtkCamera is available through the renderer, then LockNormalToCamera will cause the...
void SetNormalToXAxis(vtkTypeBool)
Force the plane widget to be aligned with one of the x-y-z axes.
void Push(double *p1, double *p2)
void SetZTranslationAxisOn()
Toggles constraint translation axis on/off.
void TranslateOutline(double *p1, double *p2)
void SetDrawIntersectionEdges(vtkTypeBool intersectionEdges)
Enable/disable the drawing of the intersection edges.
void Rotate(double X, double Y, double *p1, double *p2, double *vpn)
virtual double GetRadiusMultiplierMinValue()
Set/Get the Radius Multiplier value.
virtual void SetAlwaysSnapToNearestAxis(bool snap)
Forces the plane's normal to be aligned with x, y or z axis.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
void SetIntersectionEdgesColor(double c[3])
Set color to the intersection edges.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting the rendering process.
double * GetOrigin()
Set/Get the origin of the plane.
void SetNormalToCamera()
Set/Get the normal to the plane.
void SetInteractionColor(double, double, double)
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
void Rotate3D(double *p1, double *p2)
virtual void SetRepresentationState(int)
Sets the visual appearance of the representation based on the state it is in.
int ComputeInteractionState(int X, int Y, int modify=0) override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
void SetNormal(double x, double y, double z)
Set/Get the normal to the plane.
void SetOrigin(double x[3])
Set/Get the origin of the plane.
bool PickOrigin(int X, int Y, bool snapToMeshPoint=false)
Given the X, Y display coordinates, pick a new origin for the plane from a point that is on the objec...
void UpdatePose(double *p1, double *d1, double *p2, double *d2)
double * GetNormal()
Set/Get the normal to the plane.
void BuildRepresentation() override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
void GetPlane(vtkPlane *plane)
Get the implicit function for the plane by copying the origin and normal of the cut plane into the pr...
bool PickNormal(int X, int Y, bool snapToMeshPoint=false)
Given the X, Y display coordinates, pick a new normal for the plane from a point that is on the objec...
vtkPolyDataAlgorithm * GetPolyDataAlgorithm()
Satisfies superclass API.
void SetEdgesColor(vtkLookupTable *)
Set color to the edges.
void StartComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata, int modify=0) override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
double * GetBounds() override
Methods supporting the rendering process.
void UpdatePlacement()
Satisfies the superclass API.
void SetNormalToZAxis(vtkTypeBool)
Force the plane widget to be aligned with one of the x-y-z axes.
void SetIntersectionEdgesColor(vtkLookupTable *)
Set color to the intersection edges.
void SetIntersectionEdgesColor(double, double, double)
Set color to the intersection edges.
void PlaceWidget(double bounds[6]) override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
static vtkDisplaySizedImplicitPlaneRepresentation * New()
Instantiate the class.
void SetXTranslationAxisOn()
Toggles constraint translation axis on/off.
virtual void SetRadiusMultiplier(double radiusMultiplier)
Set/Get the Radius Multiplier value.
void TranslateOrigin(double *p1, double *p2)
void SetHandleColor(double c[3])
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
void SetNormalToYAxis(vtkTypeBool)
Force the plane widget to be aligned with one of the x-y-z axes.
void GetPolyData(vtkPolyData *pd)
Grab the polydata that defines the plane.
virtual double GetRadiusMultiplierMaxValue()
Set/Get the Radius Multiplier value.
void SetDrawOutline(vtkTypeBool outline)
Enable/disable the drawing of the outline.
void PushPlane(double distance)
Push the plane the distance specified along the normal.
void SetInteractionColor(double c[3])
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting the rendering process.
void WidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
void SetPlane(vtkPlane *plane)
Alternative way to define the cutting plane.
void SetEdgesColor(double c[3])
Set color to the edges.
void SetDrawPlane(vtkTypeBool plane)
Enable/disable the drawing of the plane.
void ComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
void SetForegroundColor(double, double, double)
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
void SetOrigin(double x, double y, double z)
Set/Get the origin of the plane.
void SetForegroundColor(double c[3])
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
void StartWidgetInteraction(double eventPos[2]) override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
void Scale(double *p1, double *p2, double X, double Y)
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void SetYTranslationAxisOn()
Toggles constraint translation axis on/off.
void ResizeRadius3D(double *p1, double *p2)
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting the rendering process.
void SetEdgesColor(double, double, double)
Set color to the edges.
void EndWidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
void GetActors(vtkPropCollection *pc) override
Methods supporting the rendering process.
void EndComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
pick a point or snap to point of an actor/prop using graphics hardware
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:29
create a line defined by two end points
map scalar values into colors via a lookup table
Allocate and hold a VTK object.
Definition vtkNew.h:58
create wireframe outline for an arbitrary data set or composite dataset
perform various plane computations
Definition vtkPlane.h:29
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
an ordered list of Props
represent surface properties of a geometric object
Definition vtkProperty.h:60
platform-independent render window interaction including picking and frame rate control.
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
filter that generates tubes around lines
abstract specification for Viewports
Definition vtkViewport.h:46
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DEPRECATED_IN_9_3_0(reason)
#define vtkPolyDataAlgorithm
#define VTK_DOUBLE_MAX
Definition vtkType.h:154
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)