VTK
vtkPlaneWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPlaneWidget.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 =========================================================================*/
81 #ifndef vtkPlaneWidget_h
82 #define vtkPlaneWidget_h
83 
84 #include "vtkInteractionWidgetsModule.h" // For export macro
86 
87 class vtkActor;
88 class vtkCellPicker;
89 class vtkConeSource;
90 class vtkLineSource;
91 class vtkPlaneSource;
92 class vtkPoints;
93 class vtkPolyData;
94 class vtkPolyDataMapper;
95 class vtkProp;
96 class vtkProperty;
97 class vtkSphereSource;
98 class vtkTransform;
99 class vtkPlane;
100 
101 #define VTK_PLANE_OFF 0
102 #define VTK_PLANE_OUTLINE 1
103 #define VTK_PLANE_WIREFRAME 2
104 #define VTK_PLANE_SURFACE 3
105 
106 class VTKINTERACTIONWIDGETS_EXPORT vtkPlaneWidget : public vtkPolyDataSourceWidget
107 {
108 public:
112  static vtkPlaneWidget *New();
113 
115  void PrintSelf(ostream& os, vtkIndent indent);
116 
118 
121  virtual void SetEnabled(int);
122  virtual void PlaceWidget(double bounds[6]);
123  void PlaceWidget()
124  {this->Superclass::PlaceWidget();}
125  void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
126  double zmin, double zmax)
127  {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
129 
131 
134  void SetResolution(int r);
137 
139 
142  void SetOrigin(double x, double y, double z);
143  void SetOrigin(double x[3]);
144  double* GetOrigin();
145  void GetOrigin(double xyz[3]);
147 
149 
152  void SetPoint1(double x, double y, double z);
153  void SetPoint1(double x[3]);
154  double* GetPoint1();
155  void GetPoint1(double xyz[3]);
157 
159 
162  void SetPoint2(double x, double y, double z);
163  void SetPoint2(double x[3]);
164  double* GetPoint2();
165  void GetPoint2(double xyz[3]);
167 
169 
172  void SetCenter(double x, double y, double z);
173  void SetCenter(double x[3]);
174  double* GetCenter();
175  void GetCenter(double xyz[3]);
177 
179 
182  void SetNormal(double x, double y, double z);
183  void SetNormal(double x[3]);
184  double* GetNormal();
185  void GetNormal(double xyz[3]);
187 
189 
197  vtkSetClampMacro(Representation,int,VTK_PLANE_OFF,VTK_PLANE_SURFACE);
198  vtkGetMacro(Representation,int);
200  {this->SetRepresentation(VTK_PLANE_OFF);}
202  {this->SetRepresentation(VTK_PLANE_OUTLINE);}
204  {this->SetRepresentation(VTK_PLANE_WIREFRAME);}
206  {this->SetRepresentation(VTK_PLANE_SURFACE);}
208 
210 
216  vtkSetMacro(NormalToXAxis,int);
217  vtkGetMacro(NormalToXAxis,int);
218  vtkBooleanMacro(NormalToXAxis,int);
219  vtkSetMacro(NormalToYAxis,int);
220  vtkGetMacro(NormalToYAxis,int);
221  vtkBooleanMacro(NormalToYAxis,int);
222  vtkSetMacro(NormalToZAxis,int);
223  vtkGetMacro(NormalToZAxis,int);
224  vtkBooleanMacro(NormalToZAxis,int);
226 
236 
244  void GetPlane(vtkPlane *plane);
245 
253 
258  void UpdatePlacement(void);
259 
261 
266  vtkGetObjectMacro(HandleProperty,vtkProperty);
267  vtkGetObjectMacro(SelectedHandleProperty,vtkProperty);
269 
271 
276  vtkGetObjectMacro(PlaneProperty,vtkProperty);
277  vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
279 
280 protected:
283 
284  // Manage the state of the widget
285  int State;
287  {
288  Start=0,
295  Pinching
296  };
297 
298  //handles the events
299  static void ProcessEvents(vtkObject* object,
300  unsigned long event,
301  void* clientdata,
302  void* calldata);
303 
304  // ProcessEvents() dispatches to these methods.
311  void OnMouseMove();
312  void OnStartPinch();
313  void OnPinch();
314  void OnEndPinch();
315 
316  // controlling ivars
322 
323  // the plane
328  void HighlightPlane(int highlight);
329 
330  // glyphs representing hot spots (e.g., handles)
335  void HandlesOn(double length);
336  void HandlesOff();
337  int HighlightHandle(vtkProp *prop); //returns cell id
338  virtual void SizeHandles();
339 
340  // the normal cone
344  void HighlightNormal(int highlight);
345 
346  // the normal line
350 
351  // the normal cone
355 
356  // the normal line
360 
361  // Do the picking
365 
366  // Register internal Pickers within PickingManager
367  virtual void RegisterPickers();
368 
369  // Methods to manipulate the hexahedron.
370  void MoveOrigin(double *p1, double *p2);
371  void MovePoint1(double *p1, double *p2);
372  void MovePoint2(double *p1, double *p2);
373  void MovePoint3(double *p1, double *p2);
374  void Rotate(int X, int Y, double *p1, double *p2, double *vpn);
375  void Spin(double *p1, double *p2);
376  void Scale(double *p1, double *p2, int X, int Y);
377  void Translate(double *p1, double *p2);
378  void Push(double *p1, double *p2);
379 
380  // Plane normal, normalized
381  double Normal[3];
382 
383  // Transform the hexahedral points (used for rotations)
385 
386  // Properties used to control the appearance of selected objects and
387  // the manipulator in general.
393 
395 
398 
399 private:
400  vtkPlaneWidget(const vtkPlaneWidget&) VTK_DELETE_FUNCTION;
401  void operator=(const vtkPlaneWidget&) VTK_DELETE_FUNCTION;
402 };
403 
404 #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
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 an array of quadrilaterals located in a plane
3D widget for manipulating a finite plane
vtkProperty * HandleProperty
void MovePoint3(double *p1, double *p2)
void SetOrigin(double x, double y, double z)
Set/Get the origin of the plane.
vtkConeSource * ConeSource
vtkPlaneSource * PlaneSource
vtkSphereSource ** HandleGeometry
vtkLineSource * LineSource
double * GetOrigin()
void GetPlane(vtkPlane *plane)
Get the planes describing the implicit function defined by the plane widget.
void MovePoint2(double *p1, double *p2)
void UpdatePlacement(void)
Satisfies superclass API.
virtual void PlaceWidget(double bounds[6])
We have to redeclare this abstract, PlaceWidget() requires it.
vtkPolyDataMapper * PlaneMapper
double * GetPoint2()
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
void OnRightButtonUp()
vtkProperty * PlaneProperty
void GetOrigin(double xyz[3])
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void GetPoint1(double xyz[3])
int HighlightHandle(vtkProp *prop)
vtkActor * ConeActor2
vtkActor ** Handle
void SetPoint1(double x, double y, double z)
Set/Get the position of the point defining the first axis of the plane.
void OnStartPinch()
void PlaceWidget()
Overrides vtk3DWidget PlaceWidget() so that it doesn't complain if there's no Input and no Prop3D.
void CreateDefaultProperties()
void OnLeftButtonDown()
void HighlightNormal(int highlight)
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
void GetPolyData(vtkPolyData *pd)
Grab the polydata (including points) that defines the plane.
vtkPolyDataMapper * LineMapper2
void MovePoint1(double *p1, double *p2)
virtual void SizeHandles()
double * GetPoint1()
double * GetNormal()
void SetNormal(double x, double y, double z)
Get the normal to the plane.
void SetCenter(double x, double y, double z)
Get the center of the plane.
void SetPoint2(double x[3])
vtkProperty * SelectedHandleProperty
void GeneratePlane()
vtkPolyDataMapper * ConeMapper2
void Scale(double *p1, double *p2, int X, int Y)
void Push(double *p1, double *p2)
vtkProperty * SelectedPlaneProperty
void OnLeftButtonUp()
void HandlesOn(double length)
void MoveOrigin(double *p1, double *p2)
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void OnMouseMove()
void SetResolution(int r)
Set/Get the resolution (number of subdivisions) of the plane.
vtkPolyDataMapper ** HandleMapper
vtkCellPicker * HandlePicker
vtkPolyDataMapper * LineMapper
vtkActor * ConeActor
void GetPoint2(double xyz[3])
void SetRepresentationToSurface()
void SetRepresentationToOutline()
vtkActor * CurrentHandle
void SelectRepresentation()
double HandleSizeFactor
void SetOrigin(double x[3])
vtkPolyData * PlaneOutline
void GetNormal(double xyz[3])
void SetCenter(double x[3])
vtkTransform * Transform
void PositionHandles()
void OnMiddleButtonDown()
vtkLineSource * LineSource2
void SetPoint2(double x, double y, double z)
Set/Get the position of the point defining the second axis of the plane.
vtkPolyDataMapper * ConeMapper
void OnRightButtonDown()
void SetNormal(double x[3])
vtkCellPicker * PlanePicker
void SetPoint1(double x[3])
static vtkPlaneWidget * New()
Instantiate the object.
virtual void SetPlaneProperty(vtkProperty *)
Get the plane properties.
virtual void SetEnabled(int)
Methods that satisfy the superclass' API.
void Rotate(int X, int Y, double *p1, double *p2, double *vpn)
vtkConeSource * ConeSource2
vtkActor * LineActor
void SetRepresentationToOff()
void Spin(double *p1, double *p2)
void HighlightPlane(int highlight)
double * GetCenter()
vtkActor * PlaneActor
void GetCenter(double xyz[3])
void SetRepresentationToWireframe()
void Translate(double *p1, double *p2)
void OnMiddleButtonUp()
vtkPolyDataAlgorithm * GetPolyDataAlgorithm()
Satisfies superclass API.
vtkActor * LineActor2
perform various plane computations
Definition: vtkPlane.h:38
represent and manipulate 3D points
Definition: vtkPoints.h:40
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
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
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
@ Normal
Definition: vtkX3D.h:45
@ length
Definition: vtkX3D.h:393
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_PLANE_OUTLINE
#define VTK_PLANE_WIREFRAME
#define VTK_PLANE_OFF
#define VTK_PLANE_SURFACE