VTK  9.2.6
vtkDisplaySizedImplicitPlaneRepresentation.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkDisplaySizedImplicitPlaneRepresentation.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
36
37#ifndef vtkDisplaySizedImplicitPlaneRepresentation_h
38#define vtkDisplaySizedImplicitPlaneRepresentation_h
39
40#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
41#include "vtkInteractionWidgetsModule.h" // For export macro
42#include "vtkNew.h" // For vtkNew command
44
45class vtkActor;
46class vtkBox;
47class vtkCellPicker;
48class vtkConeSource;
49class vtkCutter;
50class vtkDiskSource;
51class vtkFeatureEdges;
53class vtkImageData;
54class vtkLineSource;
55class vtkLookupTable;
57class vtkPlane;
58class vtkPolyData;
61class vtkProperty;
62class vtkSphereSource;
63class vtkTransform;
64class vtkTubeFilter;
65
66class VTKINTERACTIONWIDGETS_EXPORT vtkDisplaySizedImplicitPlaneRepresentation
68{
69public:
74
76
80 void PrintSelf(ostream& os, vtkIndent indent) override;
82
84
87 void SetOrigin(double x, double y, double z);
88 void SetOrigin(double x[3]);
89 double* GetOrigin() VTK_SIZEHINT(3);
90 void GetOrigin(double xyz[3]);
92
94
97 void SetNormal(double x, double y, double z);
98 void SetNormal(double n[3]);
101 void GetNormal(double xyz[3]);
103
105
114 vtkBooleanMacro(NormalToXAxis, vtkTypeBool);
117 vtkBooleanMacro(NormalToYAxis, vtkTypeBool);
120 vtkBooleanMacro(NormalToZAxis, vtkTypeBool);
122
124
133
135
138 virtual void SetRadiusMultiplier(double radiusMultiplier);
139 virtual double GetRadiusMultiplierMinValue() { return 0.000001; }
140 virtual double GetRadiusMultiplierMaxValue() { return VTK_DOUBLE_MAX; }
141 vtkGetMacro(RadiusMultiplier, double);
143
145
152 vtkGetMacro(DrawPlane, vtkTypeBool);
153 vtkBooleanMacro(DrawPlane, vtkTypeBool);
155
157
162 vtkBooleanMacro(DrawOutline, vtkTypeBool);
164
166
171 void SetDrawIntersectionEdges(vtkTypeBool intersectionEdges);
175
177
185
187
193 vtkBooleanMacro(OutsideBounds, vtkTypeBool);
195
197
205
207
212
214
220 vtkSetVector6Macro(WidgetBounds, double);
221 vtkGetVector6Macro(WidgetBounds, double);
223
225
236
238
248
250
255 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
257
263
269
277 void GetPlane(vtkPlane* plane);
278
284 void SetPlane(vtkPlane* plane);
285
291
293
297 vtkGetObjectMacro(NormalProperty, vtkProperty);
300
302
306 vtkGetObjectMacro(SphereProperty, vtkProperty);
309
311
315 vtkGetObjectMacro(PlaneProperty, vtkProperty);
318
320
323 vtkGetObjectMacro(OutlineProperty, vtkProperty);
326
328
332 vtkGetObjectMacro(EdgesProperty, vtkProperty);
335
337
342
344
348 void SetSelectedWidgetColor(double, double, double);
349 void SetSelectedWidgetColor(double c[3]);
350 void SetUnselectedWidgetColor(double, double, double);
351 void SetUnselectedWidgetColor(double c[3]);
353
355
360 vtkSetClampMacro(BumpDistance, double, 0.000001, 1);
361 vtkGetMacro(BumpDistance, double);
363
372 void BumpPlane(int dir, double factor);
373
380 void PushPlane(double distance);
381
383
387 vtkGetMacro(PickCameraFocalInfo, bool);
388 vtkSetMacro(PickCameraFocalInfo, bool);
389 vtkBooleanMacro(PickCameraFocalInfo, bool);
391
399 bool PickOrigin(int X, int Y, bool snapToMeshPoint = false);
400
408 bool PickNormal(int X, int Y, bool snapToMeshPoint = false);
409
411
414 int ComputeInteractionState(int X, int Y, int modify = 0) override;
415 void PlaceWidget(double bounds[6]) override;
416 void BuildRepresentation() override;
417 void StartWidgetInteraction(double eventPos[2]) override;
418 void WidgetInteraction(double newEventPos[2]) override;
419 void EndWidgetInteraction(double newEventPos[2]) override;
421 unsigned long event, void* calldata) override;
423 unsigned long event, void* calldata) override;
425 unsigned long event, void* calldata, int modify = 0) override;
427 unsigned long event, void* calldata) override;
429
431
434 double* GetBounds() VTK_SIZEHINT(6) override;
435 void GetActors(vtkPropCollection* pc) override;
441
442 // Manage the state of the widget
454#if !defined(VTK_LEGACY_REMOVE)
455 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
457#endif
458
460
469 vtkSetClampMacro(InteractionState, int, Outside, Scaling);
471
473
477 virtual void SetRepresentationState(int);
478 vtkGetMacro(RepresentationState, int);
480
481 // Get the underlying implicit plane object used by this rep
482 // that can be used as a cropping plane in vtkMapper.
483 vtkPlane* GetUnderlyingPlane() { return this->Plane; }
484
486
490 vtkGetMacro(SnapToAxes, bool);
491 vtkSetMacro(SnapToAxes, bool);
492 vtkBooleanMacro(SnapToAxes, bool);
494
496
502 vtkGetMacro(AlwaysSnapToNearestAxis, bool);
503 virtual void SetAlwaysSnapToNearestAxis(bool snap)
504 {
505 this->AlwaysSnapToNearestAxis = snap;
506 this->SetNormal(this->GetNormal());
507 }
508
509
510protected:
513
515
516 // Keep track of event positions
520
521 // Controlling ivars
525
529
531
533
534 // Locking normal to camera
536
537 // Controlling the push operation
539
541
542 // The bounding box is represented by a single voxel image data
547 vtkTypeBool OutlineTranslation; // whether the outline can be moved
548 vtkTypeBool ScaleEnabled; // whether the widget can be scaled
549 vtkTypeBool OutsideBounds; // whether the widget can be moved outside input's bounds
550 double WidgetBounds[6];
551 vtkTypeBool ConstrainToWidgetBounds; // whether the widget can be moved outside input's bounds
552 vtkTypeBool ConstrainMaximumSizeToWidgetBounds; // whether the maximum widget size is constrained
553 vtkTypeBool DrawOutline; // whether to draw the outline
554 void HighlightOutline(int highlight);
555
556 // The plane
563 void HighlightPlane(int highlight);
564
565 // plane boundary edges are represented as tubes
570 void HighlightEdges(int highlight);
571
573
577 void SetEdgesColor(double, double, double);
578 void SetEdgesColor(double c[3]);
580
581 // The intersection edges with the outline
588
590
594 void SetIntersectionEdgesColor(double, double, double);
595 void SetIntersectionEdgesColor(double c[3]);
597
598 // The + normal cone
602 void HighlightNormal(int highlight);
603
604 // The normal line
608
609 // The - normal cone
613
614 // The origin positioning handle
618 void HighlightSphere(int highlight);
619
620 // Do the picking
621 vtkNew<vtkHardwarePicker> HardwarePicker; // Used for picking rendered props (screen)
622 vtkNew<vtkCellPicker> CellPicker; // Used for picking widget props (screen and VR)
623 // Compute Cell Picker tolerance
625
626 // Register internal Pickers within PickingManager
627 void RegisterPickers() override;
628
629 // Transform the normal (used for rotation)
631
632 // Methods to manipulate the plane
633 void Rotate(double X, double Y, double* p1, double* p2, double* vpn);
634 void Rotate3D(double* p1, double* p2);
635 void TranslateOutline(double* p1, double* p2);
636 void TranslateOrigin(double* p1, double* p2);
637 void UpdatePose(double* p1, double* d1, double* p2, double* d2);
638 void Push(double* p1, double* p2);
639 void ResizeRadius(double* p1, double* p2, double* vpn);
640 void ResizeRadius3D(double* p1, double* p2);
641 void Scale(double* p1, double* p2, double X, double Y);
643
644 // Properties used to control the appearance of selected objects and
645 // the manipulator in general.
658
659 // Support GetBounds() method
661
662private:
665 void operator=(const vtkDisplaySizedImplicitPlaneRepresentation&) = delete;
666};
667
668#endif
define the API for widget / widget representation
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:46
implicit function for a bounding box
Definition vtkBox.h:39
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
Cut vtkDataSet with user-specified implicit function.
Definition vtkCutter.h:71
create a disk with hole in center
void SetSelectedWidgetColor(double, double, double)
Set the color of all the widgets objects (edges, cone1, cone2, line, sphere, except plane) when unsel...
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 SetUnselectedWidgetColor(double c[3])
Set the color of all the widgets objects (edges, cone1, cone2, line, sphere, except plane) when unsel...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
void SetUnselectedWidgetColor(double, double, double)
Set the color of all the widgets objects (edges, cone1, cone2, line, sphere, except plane) when unsel...
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 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...
void SetSelectedWidgetColor(double c[3])
Set the color of all the widgets objects (edges, cone1, cone2, line, sphere, except plane) when unsel...
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 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.
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 SetOrigin(double x, double y, double z)
Set/Get the origin of the plane.
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:34
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:56
create wireframe outline for an arbitrary data set or composite dataset
perform various plane computations
Definition vtkPlane.h:34
Superclass for algorithms that produce only polydata as output.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:85
an ordered list of Props
represent surface properties of a geometric object
Definition vtkProperty.h:62
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:50
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_DEPRECATED_IN_9_2_0(reason)
#define VTK_DOUBLE_MAX
Definition vtkType.h:165
#define VTK_SIZEHINT(...)