VTK  9.4.20250509
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
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]);
91 void SetNormalToCamera();
92 double* GetNormal() VTK_SIZEHINT(3);
93 void GetNormal(double xyz[3]);
95
97
104 void SetNormalToXAxis(vtkTypeBool);
105 vtkGetMacro(NormalToXAxis, vtkTypeBool);
106 vtkBooleanMacro(NormalToXAxis, vtkTypeBool);
107 void SetNormalToYAxis(vtkTypeBool);
108 vtkGetMacro(NormalToYAxis, vtkTypeBool);
109 vtkBooleanMacro(NormalToYAxis, vtkTypeBool);
110 void SetNormalToZAxis(vtkTypeBool);
111 vtkGetMacro(NormalToZAxis, vtkTypeBool);
112 vtkBooleanMacro(NormalToZAxis, vtkTypeBool);
114
116
121 virtual void SetLockNormalToCamera(vtkTypeBool);
122 vtkGetMacro(LockNormalToCamera, vtkTypeBool);
123 vtkBooleanMacro(LockNormalToCamera, vtkTypeBool);
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
153 vtkGetMacro(DrawOutline, vtkTypeBool);
154 vtkBooleanMacro(DrawOutline, vtkTypeBool);
156
158
163 void SetDrawIntersectionEdges(vtkTypeBool intersectionEdges);
164 vtkGetMacro(DrawIntersectionEdges, vtkTypeBool);
165 vtkBooleanMacro(DrawIntersectionEdges, vtkTypeBool);
167
169
173 vtkSetMacro(OutlineTranslation, vtkTypeBool);
174 vtkGetMacro(OutlineTranslation, vtkTypeBool);
175 vtkBooleanMacro(OutlineTranslation, vtkTypeBool);
177
179
183 vtkSetMacro(OutsideBounds, vtkTypeBool);
184 vtkGetMacro(OutsideBounds, vtkTypeBool);
185 vtkBooleanMacro(OutsideBounds, vtkTypeBool);
187
189
192 void SetXTranslationAxisOn() { this->TranslationAxis = Axis::XAxis; }
193 void SetYTranslationAxisOn() { this->TranslationAxis = Axis::YAxis; }
194 void SetZTranslationAxisOn() { this->TranslationAxis = Axis::ZAxis; }
195 void SetTranslationAxisOff() { this->TranslationAxis = Axis::NONE; }
197
199
202 bool IsTranslationConstrained() { return this->TranslationAxis != Axis::NONE; }
204
206
212 vtkSetVector6Macro(WidgetBounds, double);
213 vtkGetVector6Macro(WidgetBounds, double);
215
217
224 vtkSetMacro(ConstrainToWidgetBounds, vtkTypeBool);
225 vtkGetMacro(ConstrainToWidgetBounds, vtkTypeBool);
226 vtkBooleanMacro(ConstrainToWidgetBounds, vtkTypeBool);
228
230
237 vtkSetMacro(ConstrainMaximumSizeToWidgetBounds, vtkTypeBool);
238 vtkGetMacro(ConstrainMaximumSizeToWidgetBounds, vtkTypeBool);
239 vtkBooleanMacro(ConstrainMaximumSizeToWidgetBounds, vtkTypeBool);
240
242
245 vtkSetMacro(ScaleEnabled, vtkTypeBool);
246 vtkGetMacro(ScaleEnabled, vtkTypeBool);
247 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
249
255
261
270 void GetPlane(vtkPlane* plane);
271
278 void SetPlane(vtkPlane* plane);
279
284 void UpdatePlacement();
285
287
291 vtkGetObjectMacro(NormalProperty, vtkProperty);
292 vtkGetObjectMacro(SelectedNormalProperty, vtkProperty);
294
296
300 vtkGetObjectMacro(SphereProperty, vtkProperty);
301 vtkGetObjectMacro(SelectedSphereProperty, vtkProperty);
303
305
309 vtkGetObjectMacro(PlaneProperty, vtkProperty);
310 vtkGetObjectMacro(SelectedPlaneProperty, vtkProperty);
312
314
317 vtkGetObjectMacro(OutlineProperty, vtkProperty);
318 vtkGetObjectMacro(SelectedOutlineProperty, vtkProperty);
320
322
326 vtkGetObjectMacro(EdgesProperty, vtkProperty);
327 vtkGetObjectMacro(SelectedEdgesProperty, vtkProperty);
329
331
334 vtkGetObjectMacro(IntersectionEdgesProperty, vtkProperty);
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
352
357 vtkSetClampMacro(BumpDistance, double, 0.000001, 1);
358 vtkGetMacro(BumpDistance, double);
360
369 void BumpPlane(int dir, double factor);
370
377 void PushPlane(double distance);
378
380
384 vtkGetMacro(PickCameraFocalInfo, bool);
385 vtkSetMacro(PickCameraFocalInfo, bool);
386 vtkBooleanMacro(PickCameraFocalInfo, bool);
388
396 bool PickOrigin(int X, int Y, bool snapToMeshPoint = false);
397
405 bool PickNormal(int X, int Y, bool snapToMeshPoint = false);
406
408
411 int ComputeInteractionState(int X, int Y, int modify = 0) override;
412 void PlaceWidget(double bounds[6]) override;
413 void BuildRepresentation() override;
414 void StartWidgetInteraction(double eventPos[2]) override;
415 void WidgetInteraction(double newEventPos[2]) override;
416 void EndWidgetInteraction(double newEventPos[2]) override;
418 unsigned long event, void* calldata) override;
420 unsigned long event, void* calldata) override;
422 unsigned long event, void* calldata, int modify = 0) override;
424 unsigned long event, void* calldata) override;
426
428
431 double* GetBounds() VTK_SIZEHINT(6) override;
432 void GetActors(vtkPropCollection* pc) override;
433 void ReleaseGraphicsResources(vtkWindow*) override;
434 int RenderOpaqueGeometry(vtkViewport*) override;
435 int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
436 vtkTypeBool HasTranslucentPolygonalGeometry() override;
438
439 // Manage the state of the widget
441 {
442 Outside = 0,
449 Scaling
450 };
451
453
462 vtkSetClampMacro(InteractionState, int, Outside, Scaling);
464
466
470 virtual void SetRepresentationState(int);
471 vtkGetMacro(RepresentationState, int);
473
474 // Get the underlying implicit plane object used by this rep
475 // that can be used as a cropping plane in vtkMapper.
476 vtkPlane* GetUnderlyingPlane() { return this->Plane; }
477
479
483 vtkGetMacro(SnapToAxes, bool);
484 vtkSetMacro(SnapToAxes, bool);
485 vtkBooleanMacro(SnapToAxes, bool);
487
489
495 vtkGetMacro(AlwaysSnapToNearestAxis, bool);
496 virtual void SetAlwaysSnapToNearestAxis(bool snap)
497 {
498 this->AlwaysSnapToNearestAxis = snap;
499 this->SetNormal(this->GetNormal());
500 }
502
503protected:
506
508
509 // Keep track of event positions
510 double LastEventPosition[3];
511 double LastEventOrientation[4];
512 double StartEventOrientation[4];
513
514 // Controlling ivars
518
519 double SnappedEventOrientation[4];
522
524
526
527 // Locking normal to camera
529
530 // Controlling the push operation
532
534
535 // The bounding box is represented by a single voxel image data
540 vtkTypeBool OutlineTranslation; // whether the outline can be moved
541 vtkTypeBool ScaleEnabled; // whether the widget can be scaled
542 vtkTypeBool OutsideBounds; // whether the widget can be moved outside input's bounds
543 double WidgetBounds[6];
544 vtkTypeBool ConstrainToWidgetBounds; // whether the widget can be moved outside input's bounds
545 vtkTypeBool ConstrainMaximumSizeToWidgetBounds; // whether the maximum widget size is constrained
546 vtkTypeBool DrawOutline; // whether to draw the outline
547 void HighlightOutline(int highlight);
548
549 // The plane
556 void HighlightPlane(int highlight);
557
558 // plane boundary edges are represented as tubes
563 void HighlightEdges(int highlight);
564
566
570 void SetEdgesColor(double, double, double);
571 void SetEdgesColor(double c[3]);
573
574 // The intersection edges with the outline
581
583
587 void SetIntersectionEdgesColor(double, double, double);
588 void SetIntersectionEdgesColor(double c[3]);
590
591 // The + normal cone
595 void HighlightNormal(int highlight);
596
597 // The normal line
601
602 // The - normal cone
606
607 // The origin positioning handle
611 void HighlightSphere(int highlight);
612
613 // Do the picking
614 vtkNew<vtkHardwarePicker> HardwarePicker; // Used for picking rendered props (screen)
615 vtkNew<vtkCellPicker> CellPicker; // Used for picking widget props (screen and VR)
616 // Compute Cell Picker tolerance
618
619 // Register internal Pickers within PickingManager
620 void RegisterPickers() override;
621
622 // Transform the normal (used for rotation)
624
625 // Methods to manipulate the plane
626 void Rotate(double X, double Y, double* p1, double* p2, double* vpn);
627 void Rotate3D(double* p1, double* p2);
628 void TranslateOutline(double* p1, double* p2);
629 void TranslateOrigin(double* p1, double* p2);
630 void UpdatePose(double* p1, double* d1, double* p2, double* d2);
631 void Push(double* p1, double* p2);
632 void ResizeRadius(double* p1, double* p2, double* vpn);
633 void ResizeRadius3D(double* p1, double* p2);
634 void Scale(double* p1, double* p2, double X, double Y);
636
637 // Properties used to control the appearance of selected objects and
638 // the manipulator in general.
651
652 // Support GetBounds() method
654
655private:
658 void operator=(const vtkDisplaySizedImplicitPlaneRepresentation&) = delete;
659};
660
661VTK_ABI_NAMESPACE_END
662#endif
define the API for widget / widget representation
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
implicit function for a bounding box
Definition vtkBox.h:110
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
Cut vtkDataSet with user-specified implicit function.
Definition vtkCutter.h:161
create a disk with hole in center
a class defining the representation for a vtkDisplaySizedImplicitPlaneWidget
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.
void ResizeRadius(double *p1, double *p2, double *vpn)
void SetTranslationAxisOff()
Toggles constraint translation axis on/off.
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 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.
double * GetOrigin()
Set/Get the origin of the plane.
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 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)
void BuildRepresentation() override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
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 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.
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 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...
void WidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
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 SetEdgesColor(double, double, double)
Set color to the edges.
void EndWidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkDisplaySizedImplicitPlaneWidget.
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:108
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:167
create wireframe outline for an arbitrary data set or composite dataset
perform various plane computations
Definition vtkPlane.h:140
Superclass for algorithms that produce only polydata as output.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
an ordered list of Props
represent surface properties of a geometric object
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:66
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DOUBLE_MAX
Definition vtkType.h:171
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)