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 =========================================================================*/
40 #ifndef vtkImplicitPlaneRepresentation_h
41 #define vtkImplicitPlaneRepresentation_h
42 
43 #include "vtkInteractionWidgetsModule.h" // For export macro
45 
46 class vtkActor;
47 class vtkPolyDataMapper;
48 class vtkCellPicker;
49 class vtkConeSource;
50 class vtkLineSource;
51 class vtkSphereSource;
52 class vtkTubeFilter;
53 class vtkPlane;
54 class vtkCutter;
55 class vtkProperty;
56 class vtkImageData;
57 class vtkOutlineFilter;
58 class vtkFeatureEdges;
59 class vtkPolyData;
61 class vtkTransform;
62 class vtkBox;
63 class vtkLookupTable;
64 
66 {
67 public:
70 
72 
74  void PrintSelf(ostream& os, vtkIndent indent);
76 
78 
79  void SetOrigin(double x, double y, double z);
80  void SetOrigin(double x[3]);
81  double* GetOrigin();
82  void GetOrigin(double xyz[3]);
84 
86 
87  void SetNormal(double x, double y, double z);
88  void SetNormal(double x[3]);
89  void SetNormalToCamera();
90  double* GetNormal();
91  void GetNormal(double xyz[3]);
93 
95 
99  void SetNormalToXAxis(int);
100  vtkGetMacro(NormalToXAxis,int);
101  vtkBooleanMacro(NormalToXAxis,int);
102  void SetNormalToYAxis(int);
103  vtkGetMacro(NormalToYAxis,int);
104  vtkBooleanMacro(NormalToYAxis,int);
105  void SetNormalToZAxis(int);
106  vtkGetMacro(NormalToZAxis,int);
107  vtkBooleanMacro(NormalToZAxis,int);
109 
111 
114  virtual void SetLockNormalToCamera(int);
115  vtkGetMacro(LockNormalToCamera,int);
116  vtkBooleanMacro(LockNormalToCamera,int);
118 
120 
122  vtkSetMacro(Tubing,int);
123  vtkGetMacro(Tubing,int);
124  vtkBooleanMacro(Tubing,int);
126 
128 
132  void SetDrawPlane(int plane);
133  vtkGetMacro(DrawPlane,int);
134  vtkBooleanMacro(DrawPlane,int);
136 
138 
140  vtkSetMacro(OutlineTranslation,int);
141  vtkGetMacro(OutlineTranslation,int);
142  vtkBooleanMacro(OutlineTranslation,int);
144 
146 
148  vtkSetMacro(OutsideBounds,int);
149  vtkGetMacro(OutsideBounds,int);
150  vtkBooleanMacro(OutsideBounds,int);
152 
154 
155  vtkSetMacro(ScaleEnabled,int);
156  vtkGetMacro(ScaleEnabled,int);
157  vtkBooleanMacro(ScaleEnabled,int);
159 
162  void GetPolyData(vtkPolyData *pd);
163 
166  vtkPolyDataAlgorithm* GetPolyDataAlgorithm();
167 
172  void GetPlane(vtkPlane *plane);
173 
177  void UpdatePlacement(void);
178 
180 
181  vtkGetObjectMacro(NormalProperty,vtkProperty);
182  vtkGetObjectMacro(SelectedNormalProperty,vtkProperty);
184 
186 
188  vtkGetObjectMacro(PlaneProperty,vtkProperty);
189  vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
191 
193 
194  vtkGetObjectMacro(OutlineProperty,vtkProperty);
195  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
197 
199 
201  vtkGetObjectMacro(EdgesProperty,vtkProperty);
203 
204 
205  void SetEdgeColor(vtkLookupTable*);
206  void SetEdgeColor(double, double, double);
207  void SetEdgeColor(double x[3]);
209 
211 
214  vtkSetClampMacro(BumpDistance,double,0.000001,1);
215  vtkGetMacro(BumpDistance,double);
217 
223  void BumpPlane(int dir, double factor);
224 
229  void PushPlane(double distance);
230 
232 
233  virtual int ComputeInteractionState(int X, int Y, int modify=0);
234  virtual void PlaceWidget(double bounds[6]);
235  virtual void BuildRepresentation();
236  virtual void StartWidgetInteraction(double eventPos[2]);
237  virtual void WidgetInteraction(double newEventPos[2]);
238  virtual void EndWidgetInteraction(double newEventPos[2]);
240 
241 
242  virtual double *GetBounds();
243  virtual void GetActors(vtkPropCollection *pc);
244  virtual void ReleaseGraphicsResources(vtkWindow*);
245  virtual int RenderOpaqueGeometry(vtkViewport*);
247  virtual int HasTranslucentPolygonalGeometry();
249 
250 //BTX - manage the state of the widget
252  {
253  Outside=0,
259  Scaling
260  };
261 //ETX
262 
264 
271  vtkSetClampMacro(InteractionState,int,Outside,Scaling);
273 
275 
277  virtual void SetRepresentationState(int);
278  vtkGetMacro(RepresentationState, int);
280 
281 protected:
284 
286 
287  // Keep track of event positions
288  double LastEventPosition[3];
289 
290  // Controlling ivars
294 
295  // Locking normal to camera
297 
298  // Controlling the push operation
299  double BumpDistance;
300 
301  // The actual plane which is being manipulated
303 
304  // The bounding box is represented by a single voxel image data
309  void HighlightOutline(int highlight);
310  int OutlineTranslation; //whether the outline can be moved
311  int ScaleEnabled; //whether the widget can be scaled
312  int OutsideBounds; //whether the widget can be moved outside input's bounds
313 
314  // The cut plane is produced with a vtkCutter
319  void HighlightPlane(int highlight);
320 
321  // Optional tubes are represented by extracting boundary edges and tubing
326  int Tubing; //control whether tubing is on
327 
328  // The + normal cone
332  void HighlightNormal(int highlight);
333 
334  // The + normal line
338 
339  // The - normal cone
343 
344  // The - normal line
348 
349  // The origin positioning handle
353 
354  // Do the picking
356 
357  // Register internal Pickers within PickingManager
358  virtual void RegisterPickers();
359 
360  // Transform the normal (used for rotation)
362 
363  // Methods to manipulate the plane
364  void ConstrainOrigin(double x[3]);
365  void Rotate(double X, double Y, double *p1, double *p2, double *vpn);
366  void TranslatePlane(double *p1, double *p2);
367  void TranslateOutline(double *p1, double *p2);
368  void TranslateOrigin(double *p1, double *p2);
369  void Push(double *p1, double *p2);
370  void Scale(double *p1, double *p2, double X, double Y);
371  void SizeHandles();
372 
373  // Properties used to control the appearance of selected objects and
374  // the manipulator in general.
382  void CreateDefaultProperties();
383 
384  void GeneratePlane();
385 
386  // Support GetBounds() method
388 
389 private:
391  void operator=(const vtkImplicitPlaneRepresentation&); //Not implemented
392 };
393 
394 #endif
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:68
virtual void EndWidgetInteraction(double newEventPos[2])
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract specification for Viewports
Definition: vtkViewport.h:46
represent surface properties of a geometric object
Definition: vtkProperty.h:63
virtual void StartWidgetInteraction(double eventPos[2])
map scalar values into colors via a lookup table
generate polygonal cone
Definition: vtkConeSource.h:43
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
virtual void ReleaseGraphicsResources(vtkWindow *)
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
a list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
#define VTKINTERACTIONWIDGETS_EXPORT
create wireframe outline for arbitrary data set
create a polygonal sphere centered at the origin
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
Definition: vtkTubeFilter.h:82
virtual int HasTranslucentPolygonalGeometry()
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void RegisterPickers()
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:44
perform various plane computations
Definition: vtkPlane.h:36
virtual void WidgetInteraction(double newEventPos[2])
virtual void GetActors(vtkPropCollection *)
create a line defined by two end points
Definition: vtkLineSource.h:41
map vtkPolyData to graphics primitives
virtual int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport))
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:68
void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
implicit function for a bounding box
Definition: vtkBox.h:40
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport))