VTK  9.3.0
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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
26 #include "vtkInteractionWidgetsModule.h" // For export macro
27 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkActor;
32 class vtkBox;
33 class vtkCellPicker;
34 class vtkConeSource;
35 class vtkFeatureEdges;
36 class vtkLineSource;
37 class vtkPolyData;
38 class vtkPolyDataMapper;
39 class vtkProperty;
40 class vtkSphereSource;
41 class vtkTransform;
42 class vtkTubeFilter;
43 
44 class VTKINTERACTIONWIDGETS_EXPORT vtkFinitePlaneRepresentation : public vtkWidgetRepresentation
45 {
46 public:
51 
53 
57  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
65 
67 
72  vtkGetObjectMacro(V1HandleProperty, vtkProperty);
73  vtkGetObjectMacro(V2HandleProperty, vtkProperty);
74  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
76 
78 
83  vtkGetObjectMacro(PlaneProperty, vtkProperty);
84  vtkGetObjectMacro(SelectedPlaneProperty, vtkProperty);
86 
88 
92  vtkSetMacro(Tubing, bool);
93  vtkGetMacro(Tubing, bool);
94  vtkBooleanMacro(Tubing, bool);
96 
98 
104  void SetDrawPlane(bool plane);
105  vtkGetMacro(DrawPlane, bool);
106  vtkBooleanMacro(DrawPlane, bool);
108 
110 
114  void SetHandles(bool handles);
115  virtual void HandlesOn();
116  virtual void HandlesOff();
118 
120 
123  void PlaceWidget(double bounds[6]) override;
124  void BuildRepresentation() override;
125  int ComputeInteractionState(int X, int Y, int modify = 0) override;
126  void StartWidgetInteraction(double e[2]) override;
127  void WidgetInteraction(double e[2]) override;
128  double* GetBounds() override;
130 
132 
140 
141  vtkSetClampMacro(InteractionState, int, Outside, Pushing);
142 
144 
147  void SetOrigin(double x, double y, double z);
148  void SetOrigin(double x[3]);
149  vtkGetVector3Macro(Origin, double);
151 
153 
156  void SetNormal(double x, double y, double z);
157  void SetNormal(double n[3]);
158  vtkGetVector3Macro(Normal, double);
160 
162 
165  void SetV1(double x, double y);
166  void SetV1(double x[2]);
167  vtkGetVector2Macro(V1, double);
169 
171 
174  void SetV2(double x, double y);
175  void SetV2(double x[2]);
176  vtkGetVector2Macro(V2, double);
178 
180 
184  virtual void SetRepresentationState(int);
185  vtkGetMacro(RepresentationState, int);
187 
189 
192  vtkGetObjectMacro(NormalProperty, vtkProperty);
193  vtkGetObjectMacro(SelectedNormalProperty, vtkProperty);
195 
196  // Methods to manipulate the plane
197  void TranslateOrigin(double* p1, double* p2);
198  void MovePoint1(double* p1, double* p2);
199  void MovePoint2(double* p1, double* p2);
200  void Push(double* p1, double* p2);
201  void Rotate(int X, int Y, double* p1, double* p2, double* vpn);
202 
204  {
205  Outside = 0,
211  Pushing
212  };
213 #if !defined(VTK_LEGACY_REMOVE)
214  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
216 #endif
217 
218  /*
219  * Register internal Pickers within PickingManager
220  */
221  void RegisterPickers() override;
222 
223 protected:
226 
227  virtual void CreateDefaultProperties();
228 
229  // Size the glyphs representing hot spots (e.g., handles)
230  virtual void SizeHandles();
231 
232  void SetHighlightNormal(int highlight);
233  void SetHighlightPlane(int highlight);
235 
236  double LastEventPosition[3];
237 
238  // the representation state
240 
241  // the origin
245  double Origin[3];
246 
247  // the normal
248  double Normal[3];
249 
250  // the previous normal
251  double PreviousNormal[3];
252 
253  // the rotation transform
255 
256  // the X Vector
260  double V1[3];
261 
262  // the Y Vector
266  double V2[3];
267 
268  // The + normal cone
272 
273  // The + normal line
277 
278  // The - normal cone
282 
283  // The - normal line
287 
288  // The finite plane
292 
293  // Optional tubes are represented by extracting boundary edges
298  bool Tubing; // control whether tubing is on
299  bool DrawPlane; // control whether plane is on
300 
301  // Picking objects
304 
305  // Transform the planes (used for rotations)
307 
308  // Support GetBounds() method
310 
311  // Properties used to control the appearance of selected objects and
312  // the manipulator in general.
321 
322 private:
324  void operator=(const vtkFinitePlaneRepresentation&) = delete;
325 };
326 
327 VTK_ABI_NAMESPACE_END
328 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
implicit function for a bounding box
Definition: vtkBox.h:40
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:71
generate polygonal cone
Definition: vtkConeSource.h:43
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
represent the vtkFinitePlaneWidget.
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.
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.
double * GetBounds() 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.
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.
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.
static vtkFinitePlaneRepresentation * New()
Instantiate the class.
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:38
create a line defined by two end points
Definition: vtkLineSource.h:62
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:55
represent surface properties of a geometric object
Definition: vtkProperty.h:66
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
filter that generates tubes around lines
Definition: vtkTubeFilter.h:84
abstract specification for Viewports
Definition: vtkViewport.h:54
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
@ Normal
Definition: vtkX3D.h:45
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DEPRECATED_IN_9_2_0(reason)