VTK
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) VTK_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]) VTK_OVERRIDE;
130  void BuildRepresentation() VTK_OVERRIDE;
131  int ComputeInteractionState(int X, int Y, int modify=0) VTK_OVERRIDE;
132  void StartWidgetInteraction(double e[2]) VTK_OVERRIDE;
133  void WidgetInteraction(double e[2]) VTK_OVERRIDE;
134  double *GetBounds() VTK_OVERRIDE;
136 
138 
141  void ReleaseGraphicsResources(vtkWindow*) VTK_OVERRIDE;
142  int RenderOpaqueGeometry(vtkViewport*) VTK_OVERRIDE;
143  int RenderTranslucentPolygonalGeometry(vtkViewport*) VTK_OVERRIDE;
144  int HasTranslucentPolygonalGeometry() VTK_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 protected:
222  ~vtkFinitePlaneRepresentation() VTK_OVERRIDE;
223 
224  virtual void CreateDefaultProperties();
225 
226  // Size the glyphs representing hot spots (e.g., handles)
227  virtual void SizeHandles();
228 
229  // Register internal Pickers within PickingManager
230  void RegisterPickers() VTK_OVERRIDE;
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
239  int RepresentationState;
240 
241  // the origin
242  vtkSphereSource *OriginGeometry;
243  vtkPolyDataMapper *OriginMapper;
244  vtkActor *OriginActor;
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
257  vtkSphereSource *V1Geometry;
258  vtkPolyDataMapper *V1Mapper;
259  vtkActor *V1Actor;
260  double V1[3];
261 
262  // the Y Vector
263  vtkSphereSource *V2Geometry;
264  vtkPolyDataMapper *V2Mapper;
265  vtkActor *V2Actor;
266  double V2[3];
267 
268  // The + normal cone
269  vtkConeSource *ConeSource;
270  vtkPolyDataMapper *ConeMapper;
271  vtkActor *ConeActor;
272 
273  // The + normal line
274  vtkLineSource *LineSource;
275  vtkPolyDataMapper *LineMapper;
276  vtkActor *LineActor;
277 
278  // The - normal cone
279  vtkConeSource *ConeSource2;
280  vtkPolyDataMapper *ConeMapper2;
281  vtkActor *ConeActor2;
282 
283  // The - normal line
284  vtkLineSource *LineSource2;
285  vtkPolyDataMapper *LineMapper2;
286  vtkActor *LineActor2;
287 
288  // The finite plane
289  vtkPolyData *PlanePolyData;
290  vtkPolyDataMapper *PlaneMapper;
291  vtkActor *PlaneActor;
292 
293  // Optional tubes are represented by extracting boundary edges
295  vtkTubeFilter *EdgesTuber;
296  vtkPolyDataMapper *EdgesMapper;
297  vtkActor *EdgesActor;
298  bool Tubing; //control whether tubing is on
299  bool DrawPlane; //control whether plane is on
300 
301  // Picking objects
302  vtkCellPicker *HandlePicker;
303  vtkActor *CurrentHandle;
304 
305  // Transform the planes (used for rotations)
306  vtkTransform *TransformRotation;
307 
308  // Support GetBounds() method
309  vtkBox *BoundingBox;
310 
311  // Properties used to control the appearance of selected objects and
312  // the manipulator in general.
313  vtkProperty *OriginHandleProperty;
314  vtkProperty *V1HandleProperty;
315  vtkProperty *V2HandleProperty;
316  vtkProperty *SelectedHandleProperty;
317  vtkProperty *PlaneProperty;
318  vtkProperty *SelectedPlaneProperty;
319  vtkProperty *NormalProperty;
320  vtkProperty *SelectedNormalProperty;
321 
322 private:
324  void operator=(const vtkFinitePlaneRepresentation&) VTK_DELETE_FUNCTION;
325 };
326 
327 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
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
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:58
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:79
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
create a polygonal sphere centered at the origin
filter that generates tubes around lines
Definition: vtkTubeFilter.h:77
a simple class to control print indentation
Definition: vtkIndent.h:33
extract boundary, non-manifold, and/or sharp edges from polygonal data
represent the vtkFinitePlaneWidget.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
create a line defined by two end points
Definition: vtkLineSource.h:36
map vtkPolyData to graphics primitives
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:63
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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
Transform
Definition: ADIOSDefs.h:39