VTK  9.7.1
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 
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 VTK_MARSHALAUTO vtkFinitePlaneRepresentation
46 {
47 public:
52 
54 
58  void PrintSelf(ostream& os, vtkIndent indent) override;
60 
65  void GetPolyData(vtkPolyData* pd);
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 
146  void ReleaseGraphicsResources(vtkWindow*) override;
147  int RenderOpaqueGeometry(vtkViewport*) override;
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 
230 protected:
232  ~vtkFinitePlaneRepresentation() override;
233 
234  virtual void CreateDefaultProperties();
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);
241  void SetHighlightHandle(vtkProp* prop);
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 
330 private:
332  void operator=(const vtkFinitePlaneRepresentation&) = delete;
333 };
334 
335 VTK_ABI_NAMESPACE_END
336 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
virtual void PlaceWidget(double bounds[6])
The following is a suggested API for widget representations.
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkNew< vtkPolyDataMapper > ConeMapper
abstract specification for Viewports
Definition: vtkViewport.h:46
represent surface properties of a geometric object
Definition: vtkProperty.h:59
vtkNew< vtkPolyDataMapper > ConeMapper2
virtual void StartWidgetInteraction(double eventPos[2])
vtkNew< vtkPolyDataMapper > LineMapper2
generate polygonal cone
Definition: vtkConeSource.h:34
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
vtkNew< vtkPolyDataMapper > V1Mapper
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkNew< vtkSphereSource > OriginGeometry
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
double * GetBounds() override
Methods to make this class behave as a vtkProp.
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
vtkNew< vtkPolyDataMapper > LineMapper
create a polygonal sphere centered at the origin
vtkNew< vtkPolyDataMapper > V2Mapper
vtkNew< vtkPolyDataMapper > EdgesMapper
filter that generates tubes around lines
Definition: vtkTubeFilter.h:75
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
vtkNew< vtkPolyDataMapper > OriginMapper
represent the vtkFinitePlaneWidget.
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
virtual void WidgetInteraction(double newEventPos[2])
vtkNew< vtkPolyDataMapper > PlaneMapper
create a line defined by two end points
Definition: vtkLineSource.h:53
map vtkPolyData to graphics primitives
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:62
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
implicit function for a bounding box
Definition: vtkBox.h:30