VTK  9.0.1
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 
70  void GetPolyData(vtkPolyData* pd);
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 
141  void ReleaseGraphicsResources(vtkWindow*) override;
142  int RenderOpaqueGeometry(vtkViewport*) override;
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 x[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:
227  ~vtkFinitePlaneRepresentation() override;
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);
236  void SetHighlightHandle(vtkProp* prop);
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
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
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:45
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:61
virtual void StartWidgetInteraction(double eventPos[2])
generate polygonal cone
Definition: vtkConeSource.h:38
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
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:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
create a polygonal sphere centered at the origin
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
filter that generates tubes around lines
Definition: vtkTubeFilter.h:77
a simple class to control print indentation
Definition: vtkIndent.h:33
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:60
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...
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:66
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:38