VTK
vtkImplicitPlaneWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImplicitPlaneWidget.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 =========================================================================*/
70 #ifndef vtkImplicitPlaneWidget_h
71 #define vtkImplicitPlaneWidget_h
72 
73 #include "vtkInteractionWidgetsModule.h" // For export macro
75 
76 class vtkActor;
77 class vtkPolyDataMapper;
78 class vtkCellPicker;
79 class vtkConeSource;
80 class vtkLineSource;
81 class vtkSphereSource;
82 class vtkTubeFilter;
83 class vtkPlane;
84 class vtkCutter;
85 class vtkProperty;
86 class vtkImageData;
87 class vtkOutlineFilter;
88 class vtkFeatureEdges;
89 class vtkPolyData;
90 class vtkTransform;
91 
92 class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitPlaneWidget : public vtkPolyDataSourceWidget
93 {
94 public:
99 
101  void PrintSelf(ostream& os, vtkIndent indent);
102 
104 
107  virtual void SetEnabled(int);
108  virtual void PlaceWidget(double bounds[6]);
109  void PlaceWidget()
110  {this->Superclass::PlaceWidget();}
111  void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
112  double zmin, double zmax)
113  {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
115 
117 
120  virtual void SetOrigin(double x, double y, double z);
121  virtual void SetOrigin(double x[3]);
122  double* GetOrigin();
123  void GetOrigin(double xyz[3]);
125 
127 
130  void SetNormal(double x, double y, double z);
131  void SetNormal(double x[3]);
132  double* GetNormal();
133  void GetNormal(double xyz[3]);
135 
137 
144  void SetNormalToXAxis(int);
145  vtkGetMacro(NormalToXAxis,int);
146  vtkBooleanMacro(NormalToXAxis,int);
147  void SetNormalToYAxis(int);
148  vtkGetMacro(NormalToYAxis,int);
149  vtkBooleanMacro(NormalToYAxis,int);
150  void SetNormalToZAxis(int);
151  vtkGetMacro(NormalToZAxis,int);
152  vtkBooleanMacro(NormalToZAxis,int);
154 
156 
160  vtkSetMacro(Tubing,int);
161  vtkGetMacro(Tubing,int);
162  vtkBooleanMacro(Tubing,int);
164 
166 
172  void SetDrawPlane(int plane);
173  vtkGetMacro(DrawPlane,int);
174  vtkBooleanMacro(DrawPlane,int);
176 
178 
182  vtkSetMacro(OutlineTranslation,int);
183  vtkGetMacro(OutlineTranslation,int);
184  vtkBooleanMacro(OutlineTranslation,int);
186 
188 
191  vtkSetMacro(OutsideBounds,int);
192  vtkGetMacro(OutsideBounds,int);
193  vtkBooleanMacro(OutsideBounds,int);
195 
197 
200  vtkSetMacro(ScaleEnabled,int);
201  vtkGetMacro(ScaleEnabled,int);
202  vtkBooleanMacro(ScaleEnabled,int);
204 
206 
210  vtkSetMacro(OriginTranslation,int);
211  vtkGetMacro(OriginTranslation,int);
212  vtkBooleanMacro(OriginTranslation,int);
214 
216 
220  vtkSetClampMacro(DiagonalRatio,double,0,2);
221  vtkGetMacro(DiagonalRatio,double);
223 
229 
235 
242  void GetPlane(vtkPlane *plane);
243 
249 
253  virtual void SizeHandles();
254 
256 
259  vtkGetObjectMacro(NormalProperty,vtkProperty);
260  vtkGetObjectMacro(SelectedNormalProperty,vtkProperty);
262 
264 
268  vtkGetObjectMacro(PlaneProperty,vtkProperty);
269  vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
271 
273 
276  vtkGetObjectMacro(OutlineProperty,vtkProperty);
277  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
279 
281 
285  vtkGetObjectMacro(EdgesProperty,vtkProperty);
287 
288 protected:
291 
292  // Manage the state of the widget
293  int State;
295  {
296  Start=0,
303  Outside
304  };
305 
306  //handles the events
307  static void ProcessEvents(vtkObject* object, unsigned long event,
308  void* clientdata, void* calldata);
309 
310  // ProcessEvents() dispatches to these methods.
317  void OnMouseMove();
318 
319  // Controlling ivars
324 
325  // The actual plane which is being manipulated
327 
328  // The bounding box is represented by a single voxel image data
333  void HighlightOutline(int highlight);
334  int OutlineTranslation; //whether the outline can be moved
335  int ScaleEnabled; //whether the widget can be scaled
336  int OutsideBounds; //whether the widget can be moved outside input's bounds
337 
338  // The cut plane is produced with a vtkCutter
343  virtual void HighlightPlane(int highlight);
344 
345  // Optional tubes are represented by extracting boundary edges and tubing
350  int Tubing; //control whether tubing is on
351 
352  // Control final length of the arrow:
354 
355  // The + normal cone
359  void HighlightNormal(int highlight);
360 
361  // The + normal line
365 
366  // The - normal cone
370 
371  // The - normal line
375 
376  // The origin positioning handle
380  int OriginTranslation; //whether the origin (sphere) can be moved
381 
382  // Do the picking
384 
385  // Register internal Pickers within PickingManager
386  virtual void RegisterPickers();
387 
388  // Transform the normal (used for rotation)
390 
391  // Methods to manipulate the plane
392  void ConstrainOrigin(double x[3]);
393  void Rotate(int X, int Y, double *p1, double *p2, double *vpn);
394  void TranslatePlane(double *p1, double *p2);
395  void TranslateOutline(double *p1, double *p2);
396  void TranslateOrigin(double *p1, double *p2);
397  void Push(double *p1, double *p2);
398  void Scale(double *p1, double *p2, int X, int Y);
399 
400  // Properties used to control the appearance of selected objects and
401  // the manipulator in general.
410 
412 
413 private:
414  vtkImplicitPlaneWidget(const vtkImplicitPlaneWidget&) VTK_DELETE_FUNCTION;
415  void operator=(const vtkImplicitPlaneWidget&) VTK_DELETE_FUNCTION;
416 };
417 
418 #endif
virtual void PlaceWidget()
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:70
generate polygonal cone
Definition: vtkConeSource.h:45
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:70
extract boundary, non-manifold, and/or sharp edges from polygonal data
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
3D widget for manipulating an infinite plane
vtkPolyDataMapper * ConeMapper
void GetPlane(vtkPlane *plane)
Get the implicit function for the plane.
void TranslateOutline(double *p1, double *p2)
void SetNormal(double x[3])
vtkPolyDataMapper * CutMapper
void TranslatePlane(double *p1, double *p2)
vtkPolyDataMapper * ConeMapper2
static vtkImplicitPlaneWidget * New()
Instantiate the object.
void Rotate(int X, int Y, double *p1, double *p2, double *vpn)
virtual void HighlightPlane(int highlight)
vtkPolyDataMapper * LineMapper
virtual void PlaceWidget(double bounds[6])
We have to redeclare this abstract, PlaceWidget() requires it.
void SetDrawPlane(int plane)
Enable/disable the drawing of the plane.
vtkPolyDataMapper * SphereMapper
virtual void SizeHandles()
Control widget appearance.
virtual void SetEnabled(int)
Methods that satisfy the superclass' API.
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
void ConstrainOrigin(double x[3])
virtual void SetOrigin(double x, double y, double z)
Get the origin of the plane.
void GetNormal(double xyz[3])
void Scale(double *p1, double *p2, int X, int Y)
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
void HighlightNormal(int highlight)
void SetNormalToXAxis(int)
Force the plane widget to be aligned with one of the x-y-z axes.
void SetNormal(double x, double y, double z)
Get the normal to the plane.
void TranslateOrigin(double *p1, double *p2)
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void UpdatePlacement()
Satisfies the superclass API.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkPolyDataAlgorithm * GetPolyDataAlgorithm()
Satisfies superclass API.
void GetPolyData(vtkPolyData *pd)
Grab the polydata that defines the plane.
vtkPolyDataMapper * OutlineMapper
void GetOrigin(double xyz[3])
void PlaceWidget()
Overrides vtk3DWidget PlaceWidget() so that it doesn't complain if there's no Input and no Prop3D.
virtual void SetOrigin(double x[3])
void HighlightOutline(int highlight)
vtkPolyDataMapper * EdgesMapper
vtkPolyDataMapper * LineMapper2
void Push(double *p1, double *p2)
a simple class to control print indentation
Definition: vtkIndent.h:40
create a line defined by two end points
Definition: vtkLineSource.h:43
abstract base class for most VTK objects
Definition: vtkObject.h:60
create wireframe outline for arbitrary data set
perform various plane computations
Definition: vtkPlane.h:38
Superclass for algorithms that produce only polydata as output.
map vtkPolyData to graphics primitives
abstract PolyDataSource-based 3D widget
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
represent surface properties of a geometric object
Definition: vtkProperty.h:65
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
filter that generates tubes around lines
Definition: vtkTubeFilter.h:84
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.