VTK  9.4.20241202
vtkFinitePlaneRepresentation.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
22#ifndef vtkFinitePlaneRepresentation_h
23#define vtkFinitePlaneRepresentation_h
24
25#include "vtkInteractionWidgetsModule.h" // For export macro
26#include "vtkNew.h" // For member variable
28#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
29
30VTK_ABI_NAMESPACE_BEGIN
31class vtkActor;
32class vtkBox;
33class vtkCellPicker;
34class vtkConeSource;
35class vtkFeatureEdges;
36class vtkLineSource;
37class vtkPolyData;
39class vtkProperty;
40class vtkSphereSource;
41class vtkTransform;
42class vtkTubeFilter;
43
44class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkFinitePlaneRepresentation
46{
47public:
52
54
58 void PrintSelf(ostream& os, vtkIndent indent) override;
60
66
68
73 vtkGetObjectMacro(V1HandleProperty, vtkProperty);
74 vtkGetObjectMacro(V2HandleProperty, vtkProperty);
75 vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
77
79
84 vtkGetObjectMacro(PlaneProperty, vtkProperty);
85 vtkGetObjectMacro(SelectedPlaneProperty, vtkProperty);
87
89
93 vtkSetMacro(Tubing, bool);
94 vtkGetMacro(Tubing, bool);
95 vtkBooleanMacro(Tubing, bool);
97
99
103 vtkSetMacro(RectangularShape, bool);
104 vtkGetMacro(RectangularShape, bool);
105 vtkBooleanMacro(RectangularShape, bool);
107
109
115 void SetDrawPlane(bool plane);
116 vtkGetMacro(DrawPlane, bool);
117 vtkBooleanMacro(DrawPlane, bool);
119
121
125 void SetHandles(bool handles);
126 virtual void HandlesOn();
127 virtual void HandlesOff();
129
131
134 void PlaceWidget(double bounds[6]) override;
135 void BuildRepresentation() override;
136 int ComputeInteractionState(int X, int Y, int modify = 0) override;
137 void StartWidgetInteraction(double e[2]) override;
138 void WidgetInteraction(double e[2]) override;
139 double* GetBounds() override;
141
143
151
152 vtkSetClampMacro(InteractionState, int, Outside, Pushing);
153
155
158 void SetOrigin(double x, double y, double z);
159 void SetOrigin(double x[3]);
160 vtkGetVector3Macro(Origin, double);
162
164
167 void SetNormal(double x, double y, double z);
168 void SetNormal(double n[3]);
169 vtkGetVector3Macro(Normal, double);
171
173
176 void SetV1(double x, double y);
177 void SetV1(double x[2]);
178 vtkGetVector2Macro(V1, double);
180
182
185 void SetV2(double x, double y);
186 void SetV2(double x[2]);
187 vtkGetVector2Macro(V2, double);
189
191
195 virtual void SetRepresentationState(int);
196 vtkGetMacro(RepresentationState, int);
198
200
203 vtkGetObjectMacro(NormalProperty, vtkProperty);
204 vtkGetObjectMacro(SelectedNormalProperty, vtkProperty);
206
207 // Methods to manipulate the plane
208 void TranslateOrigin(double* p1, double* p2);
209 void MovePoint1(double* p1, double* p2);
210 void MovePoint2(double* p1, double* p2);
211 void Push(double* p1, double* p2);
212 void Rotate(int X, int Y, double* p1, double* p2, double* vpn);
213
215 {
216 Outside = 0,
222 Pushing
223 };
224
225 /*
226 * Register internal Pickers within PickingManager
227 */
228 void RegisterPickers() override;
229
230protected:
233
235
236 // Size the glyphs representing hot spots (e.g., handles)
237 virtual void SizeHandles();
238
239 void SetHighlightNormal(int highlight);
240 void SetHighlightPlane(int highlight);
242
243 double LastEventPosition[3];
244
245 // the representation state
247
248 // the origin
252 double Origin[3];
253
254 // the normal
255 double Normal[3];
256
257 // the previous normal
258 double PreviousNormal[3];
259
260 // the rotation transform
262
263 // the X Vector
267 double V1[3];
268
269 // the Y Vector
273 double V2[3];
274
275 // The + normal cone
279
280 // The + normal line
284
285 // The - normal cone
289
290 // The - normal line
294
295 // The finite plane
299
300 // Optional tubes are represented by extracting boundary edges
305 bool Tubing = true; // control whether tubing is on
306 bool RectangularShape = false; // control whether rectangular shape is enforced
307 bool DrawPlane = true; // control whether plane is on
308
309 // Picking objects
312
313 // Transform the planes (used for rotations)
315
316 // Support GetBounds() method
318
319 // Properties used to control the appearance of selected objects and
320 // the manipulator in general.
329
330private:
332 void operator=(const vtkFinitePlaneRepresentation&) = delete;
333};
334
335VTK_ABI_NAMESPACE_END
336#endif
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
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
represent the vtkFinitePlaneWidget.
vtkNew< vtkPolyDataMapper > EdgesMapper
double * GetBounds() override
These are methods that satisfy vtkWidgetRepresentation's API.
void Rotate(int X, int Y, double *p1, double *p2, double *vpn)
void SetHighlightNormal(int highlight)
void SetDrawPlane(bool plane)
Enable/disable the drawing of the plane.
void SetV2(double x[2])
Set/Get the v2 vector of the plane.
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting, and required by, the rendering process.
static vtkFinitePlaneRepresentation * New()
Instantiate the class.
virtual void CreateDefaultProperties()
void SetHighlightHandle(vtkProp *prop)
void SetOrigin(double x, double y, double z)
Set/Get the origin of the plane.
virtual void HandlesOn()
Switches handles (the spheres) on or off by manipulating the underlying actor visibility.
virtual void SetRepresentationState(int)
Sets the visual appearance of the representation based on the state it is in.
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
void SetNormal(double x, double y, double z)
Set/Get the normal to the plane.
void SetHighlightPlane(int highlight)
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting, and required by, the rendering process.
vtkNew< vtkPolyDataMapper > ConeMapper2
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void SetHandles(bool handles)
Switches handles (the spheres) on or off by manipulating the underlying actor visibility.
void StartWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
void SetNormal(double n[3])
Set/Get the normal to the plane.
void SetOrigin(double x[3])
Set/Get the origin of the plane.
vtkNew< vtkPolyDataMapper > PlaneMapper
vtkNew< vtkPolyDataMapper > OriginMapper
void SetV1(double x[2])
Set/Get the v1 vector of the plane.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting, and required by, the rendering process.
void GetPolyData(vtkPolyData *pd)
Grab the polydata that defines the plane.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting, and required by, the rendering process.
void SetV1(double x, double y)
Set/Get the v1 vector of the plane.
vtkNew< vtkPolyDataMapper > LineMapper2
int ComputeInteractionState(int X, int Y, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
void PlaceWidget(double bounds[6]) override
These are methods that satisfy vtkWidgetRepresentation's API.
void TranslateOrigin(double *p1, double *p2)
void WidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
void MovePoint1(double *p1, double *p2)
virtual void HandlesOff()
Switches handles (the spheres) on or off by manipulating the underlying actor visibility.
void SetV2(double x, double y)
Set/Get the v2 vector of the plane.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard vtkObject methods.
~vtkFinitePlaneRepresentation() override
void MovePoint2(double *p1, double *p2)
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
Allocate and hold a VTK object.
Definition vtkNew.h:167
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
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
abstract specification for Viewports
Definition vtkViewport.h:65
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_MARSHALAUTO