VTK  9.1.20211023
vtkFinitePlaneRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkFinitePlaneRepresentation.h
5 
6  Copyright (c)
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 =========================================================================*/
31 #ifndef vtkFinitePlaneRepresentation_h
32 #define vtkFinitePlaneRepresentation_h
33 
34 #include "vtkInteractionWidgetsModule.h" // For export macro
36 
37 class vtkActor;
38 class vtkBox;
39 class vtkCellPicker;
40 class vtkConeSource;
41 class vtkFeatureEdges;
42 class vtkLineSource;
43 class vtkPolyData;
44 class vtkPolyDataMapper;
45 class vtkProperty;
46 class vtkSphereSource;
47 class vtkTransform;
48 class vtkTubeFilter;
49 
50 class VTKINTERACTIONWIDGETS_EXPORT vtkFinitePlaneRepresentation : public vtkWidgetRepresentation
51 {
52 public:
57 
59 
63  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
71 
73 
78  vtkGetObjectMacro(V1HandleProperty, vtkProperty);
79  vtkGetObjectMacro(V2HandleProperty, vtkProperty);
80  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
82 
84 
89  vtkGetObjectMacro(PlaneProperty, vtkProperty);
90  vtkGetObjectMacro(SelectedPlaneProperty, vtkProperty);
92 
94 
98  vtkSetMacro(Tubing, bool);
99  vtkGetMacro(Tubing, bool);
100  vtkBooleanMacro(Tubing, bool);
102 
104 
110  void SetDrawPlane(bool plane);
111  vtkGetMacro(DrawPlane, bool);
112  vtkBooleanMacro(DrawPlane, bool);
114 
116 
120  void SetHandles(bool handles);
121  virtual void HandlesOn();
122  virtual void HandlesOff();
124 
126 
129  void PlaceWidget(double bounds[6]) override;
130  void BuildRepresentation() override;
131  int ComputeInteractionState(int X, int Y, int modify = 0) override;
132  void StartWidgetInteraction(double e[2]) override;
133  void WidgetInteraction(double e[2]) override;
134  double* GetBounds() override;
136 
138 
146 
147  vtkSetClampMacro(InteractionState, int, Outside, Pushing);
148 
150 
153  void SetOrigin(double x, double y, double z);
154  void SetOrigin(double x[3]);
155  vtkGetVector3Macro(Origin, double);
157 
159 
162  void SetNormal(double x, double y, double z);
163  void SetNormal(double n[3]);
164  vtkGetVector3Macro(Normal, double);
166 
168 
171  void SetV1(double x, double y);
172  void SetV1(double x[2]);
173  vtkGetVector2Macro(V1, double);
175 
177 
180  void SetV2(double x, double y);
181  void SetV2(double x[2]);
182  vtkGetVector2Macro(V2, double);
184 
186 
190  virtual void SetRepresentationState(int);
191  vtkGetMacro(RepresentationState, int);
193 
195 
198  vtkGetObjectMacro(NormalProperty, vtkProperty);
199  vtkGetObjectMacro(SelectedNormalProperty, vtkProperty);
201 
202  // Methods to manipulate the plane
203  void TranslateOrigin(double* p1, double* p2);
204  void MovePoint1(double* p1, double* p2);
205  void MovePoint2(double* p1, double* p2);
206  void Push(double* p1, double* p2);
207  void Rotate(int X, int Y, double* p1, double* p2, double* vpn);
208 
210  {
211  Outside = 0,
217  Pushing
218  };
219 
220  /*
221  * Register internal Pickers within PickingManager
222  */
223  void RegisterPickers() override;
224 
225 protected:
228 
229  virtual void CreateDefaultProperties();
230 
231  // Size the glyphs representing hot spots (e.g., handles)
232  virtual void SizeHandles();
233 
234  void SetHighlightNormal(int highlight);
235  void SetHighlightPlane(int highlight);
237 
238  double LastEventPosition[3];
239 
240  // the representation state
242 
243  // the origin
247  double Origin[3];
248 
249  // the normal
250  double Normal[3];
251 
252  // the previous normal
253  double PreviousNormal[3];
254 
255  // the rotation transform
257 
258  // the X Vector
262  double V1[3];
263 
264  // the Y Vector
268  double V2[3];
269 
270  // The + normal cone
274 
275  // The + normal line
279 
280  // The - normal cone
284 
285  // The - normal line
289 
290  // The finite plane
294 
295  // Optional tubes are represented by extracting boundary edges
300  bool Tubing; // control whether tubing is on
301  bool DrawPlane; // control whether plane is on
302 
303  // Picking objects
306 
307  // Transform the planes (used for rotations)
309 
310  // Support GetBounds() method
312 
313  // Properties used to control the appearance of selected objects and
314  // the manipulator in general.
323 
324 private:
326  void operator=(const vtkFinitePlaneRepresentation&) = delete;
327 };
328 
329 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
implicit function for a bounding box
Definition: vtkBox.h:138
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:96
generate polygonal cone
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:113
create a line defined by two end points
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:194
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
represent surface properties of a geometric object
Definition: vtkProperty.h:171
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
filter that generates tubes around lines
abstract specification for Viewports
Definition: vtkViewport.h:47
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ Normal
Definition: vtkX3D.h:51
int vtkTypeBool
Definition: vtkABI.h:69