VTK  9.3.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 "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 
64  void GetPolyData(vtkPolyData* pd);
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 
135  void ReleaseGraphicsResources(vtkWindow*) override;
136  int RenderOpaqueGeometry(vtkViewport*) override;
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:
225  ~vtkFinitePlaneRepresentation() override;
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);
234  void SetHighlightHandle(vtkProp* prop);
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
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:45
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:40
virtual void PlaceWidget(double vtkNotUsed(bounds)[6])
The following is a suggested API for widget representations.
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:56
virtual void StartWidgetInteraction(double eventPos[2])
#define VTK_DEPRECATED_IN_9_2_0(reason)
generate polygonal cone
Definition: vtkConeSource.h:33
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:49
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
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:27
create a polygonal sphere centered at the origin
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
filter that generates tubes around lines
Definition: vtkTubeFilter.h:74
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
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])
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
create a line defined by two end points
Definition: vtkLineSource.h:52
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:61
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