VTK
vtkImplicitPlaneRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImplicitPlaneRepresentation.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
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 =========================================================================*/
41 #ifndef vtkImplicitPlaneRepresentation_h
42 #define vtkImplicitPlaneRepresentation_h
43 
44 #include "vtkInteractionWidgetsModule.h" // For export macro
46 
47 class vtkActor;
48 class vtkPolyDataMapper;
49 class vtkCellPicker;
50 class vtkConeSource;
51 class vtkLineSource;
52 class vtkSphereSource;
53 class vtkTubeFilter;
54 class vtkPlane;
55 class vtkCutter;
56 class vtkProperty;
57 class vtkImageData;
58 class vtkOutlineFilter;
59 class vtkFeatureEdges;
60 class vtkPolyData;
62 class vtkTransform;
63 class vtkBox;
64 class vtkLookupTable;
65 
66 class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitPlaneRepresentation : public vtkWidgetRepresentation
67 {
68 public:
73 
75 
79  void PrintSelf(ostream& os, vtkIndent indent);
81 
83 
86  void SetOrigin(double x, double y, double z);
87  void SetOrigin(double x[3]);
88  double* GetOrigin();
89  void GetOrigin(double xyz[3]);
91 
93 
96  void SetNormal(double x, double y, double z);
97  void SetNormal(double x[3]);
98  void SetNormalToCamera();
99  double* GetNormal();
100  void GetNormal(double xyz[3]);
102 
104 
111  void SetNormalToXAxis(int);
112  vtkGetMacro(NormalToXAxis,int);
113  vtkBooleanMacro(NormalToXAxis,int);
114  void SetNormalToYAxis(int);
115  vtkGetMacro(NormalToYAxis,int);
116  vtkBooleanMacro(NormalToYAxis,int);
117  void SetNormalToZAxis(int);
118  vtkGetMacro(NormalToZAxis,int);
119  vtkBooleanMacro(NormalToZAxis,int);
121 
123 
128  virtual void SetLockNormalToCamera(int);
129  vtkGetMacro(LockNormalToCamera,int);
130  vtkBooleanMacro(LockNormalToCamera,int);
132 
134 
138  vtkSetMacro(Tubing,int);
139  vtkGetMacro(Tubing,int);
140  vtkBooleanMacro(Tubing,int);
142 
144 
150  void SetDrawPlane(int plane);
151  vtkGetMacro(DrawPlane,int);
152  vtkBooleanMacro(DrawPlane,int);
154 
156 
160  vtkSetMacro(OutlineTranslation,int);
161  vtkGetMacro(OutlineTranslation,int);
162  vtkBooleanMacro(OutlineTranslation,int);
164 
166 
170  vtkSetMacro(OutsideBounds,int);
171  vtkGetMacro(OutsideBounds,int);
172  vtkBooleanMacro(OutsideBounds,int);
174 
176 
182  vtkSetVector6Macro(WidgetBounds, double);
183  vtkGetVector6Macro(WidgetBounds, double);
185 
187 
194  vtkSetMacro(ConstrainToWidgetBounds,int);
195  vtkGetMacro(ConstrainToWidgetBounds,int);
196  vtkBooleanMacro(ConstrainToWidgetBounds,int);
198 
200 
203  vtkSetMacro(ScaleEnabled,int);
204  vtkGetMacro(ScaleEnabled,int);
205  vtkBooleanMacro(ScaleEnabled,int);
207 
212  void GetPolyData(vtkPolyData *pd);
213 
218  vtkPolyDataAlgorithm* GetPolyDataAlgorithm();
219 
227  void GetPlane(vtkPlane *plane);
228 
234  void SetPlane(vtkPlane *plane);
235 
240  void UpdatePlacement(void);
241 
243 
246  vtkGetObjectMacro(NormalProperty,vtkProperty);
247  vtkGetObjectMacro(SelectedNormalProperty,vtkProperty);
249 
251 
255  vtkGetObjectMacro(PlaneProperty,vtkProperty);
256  vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
258 
260 
263  vtkGetObjectMacro(OutlineProperty,vtkProperty);
264  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
266 
268 
272  vtkGetObjectMacro(EdgesProperty,vtkProperty);
274 
275 
278  void SetEdgeColor(vtkLookupTable*);
279  void SetEdgeColor(double, double, double);
280  void SetEdgeColor(double x[3]);
282 
284 
289  vtkSetClampMacro(BumpDistance,double,0.000001,1);
290  vtkGetMacro(BumpDistance,double);
292 
301  void BumpPlane(int dir, double factor);
302 
309  void PushPlane(double distance);
310 
312 
315  virtual int ComputeInteractionState(int X, int Y, int modify=0);
316  virtual void PlaceWidget(double bounds[6]);
317  virtual void BuildRepresentation();
318  virtual void StartWidgetInteraction(double eventPos[2]);
319  virtual void WidgetInteraction(double newEventPos[2]);
320  virtual void EndWidgetInteraction(double newEventPos[2]);
322 
323 
326  virtual double *GetBounds();
327  virtual void GetActors(vtkPropCollection *pc);
328  virtual void ReleaseGraphicsResources(vtkWindow*);
329  virtual int RenderOpaqueGeometry(vtkViewport*);
331  virtual int HasTranslucentPolygonalGeometry();
333 
334  // Manage the state of the widget
336  {
337  Outside=0,
343  Scaling
344  };
345 
347 
356  vtkSetClampMacro(InteractionState,int,Outside,Scaling);
358 
360 
364  virtual void SetRepresentationState(int);
365  vtkGetMacro(RepresentationState, int);
367 
368 protected:
371 
373 
374  // Keep track of event positions
375  double LastEventPosition[3];
376 
377  // Controlling ivars
381 
382  // Locking normal to camera
384 
385  // Controlling the push operation
386  double BumpDistance;
387 
388  // The actual plane which is being manipulated
390 
391  // The bounding box is represented by a single voxel image data
396  void HighlightOutline(int highlight);
397  int OutlineTranslation; //whether the outline can be moved
398  int ScaleEnabled; //whether the widget can be scaled
399  int OutsideBounds; //whether the widget can be moved outside input's bounds
400  double WidgetBounds[6];
402 
403  // The cut plane is produced with a vtkCutter
408  void HighlightPlane(int highlight);
409 
410  // Optional tubes are represented by extracting boundary edges and tubing
415  int Tubing; //control whether tubing is on
416 
417  // The + normal cone
421  void HighlightNormal(int highlight);
422 
423  // The + normal line
427 
428  // The - normal cone
432 
433  // The - normal line
437 
438  // The origin positioning handle
442 
443  // Do the picking
445 
446  // Register internal Pickers within PickingManager
447  virtual void RegisterPickers();
448 
449  // Transform the normal (used for rotation)
451 
452  // Methods to manipulate the plane
453  void Rotate(double X, double Y, double *p1, double *p2, double *vpn);
454  void TranslatePlane(double *p1, double *p2);
455  void TranslateOutline(double *p1, double *p2);
456  void TranslateOrigin(double *p1, double *p2);
457  void Push(double *p1, double *p2);
458  void Scale(double *p1, double *p2, double X, double Y);
459  void SizeHandles();
460 
461  // Properties used to control the appearance of selected objects and
462  // the manipulator in general.
470  void CreateDefaultProperties();
471 
472  void GeneratePlane();
473 
474  // Support GetBounds() method
476 
477 private:
479  void operator=(const vtkImplicitPlaneRepresentation&) VTK_DELETE_FUNCTION;
480 };
481 
482 #endif
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:69
virtual void EndWidgetInteraction(double newEventPos[2])
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:64
virtual void StartWidgetInteraction(double eventPos[2])
map scalar values into colors via a lookup table
generate polygonal cone
Definition: vtkConeSource.h:44
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
a list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
create wireframe outline for arbitrary data set
create a polygonal sphere centered at the origin
virtual double * GetBounds()
Methods to make this class behave as a vtkProp.
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
Definition: vtkTubeFilter.h:83
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
a class defining the representation for a vtkImplicitPlaneWidget2
extract boundary, non-manifold, and/or sharp edges from polygonal data
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
perform various plane computations
Definition: vtkPlane.h:37
virtual void WidgetInteraction(double newEventPos[2])
virtual void GetActors(vtkPropCollection *)
For some exporters and other other operations we must be able to collect all the actors or volumes...
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:42
map vtkPolyData to graphics primitives
virtual int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport))
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:69
void PrintSelf(ostream &os, vtkIndent indent)
Standard methods for instances of this class.
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:41
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport))