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 
44 
45 class vtkActor;
46 class vtkPolyDataMapper;
47 class vtkCellPicker;
48 class vtkConeSource;
49 class vtkLineSource;
50 class vtkSphereSource;
51 class vtkTubeFilter;
52 class vtkPlane;
53 class vtkCutter;
54 class vtkProperty;
55 class vtkImageData;
56 class vtkOutlineFilter;
57 class vtkFeatureEdges;
58 class vtkPolyData;
60 class vtkTransform;
61 class vtkBox;
62 class vtkLookupTable;
63 
65 {
66 public:
69 
71 
73  void PrintSelf(ostream& os, vtkIndent indent);
75 
77 
78  void SetOrigin(double x, double y, double z);
79  void SetOrigin(double x[3]);
80  double* GetOrigin();
81  void GetOrigin(double xyz[3]);
83 
85 
86  void SetNormal(double x, double y, double z);
87  void SetNormal(double x[3]);
88  void SetNormalToCamera();
89  double* GetNormal();
90  void GetNormal(double xyz[3]);
92 
94 
98  void SetNormalToXAxis(int);
99  vtkGetMacro(NormalToXAxis,int);
100  vtkBooleanMacro(NormalToXAxis,int);
101  void SetNormalToYAxis(int);
102  vtkGetMacro(NormalToYAxis,int);
103  vtkBooleanMacro(NormalToYAxis,int);
104  void SetNormalToZAxis(int);
105  vtkGetMacro(NormalToZAxis,int);
106  vtkBooleanMacro(NormalToZAxis,int);
108 
110 
113  virtual void SetLockNormalToCamera(int);
114  vtkGetMacro(LockNormalToCamera,int);
115  vtkBooleanMacro(LockNormalToCamera,int);
117 
119 
121  vtkSetMacro(Tubing,int);
122  vtkGetMacro(Tubing,int);
123  vtkBooleanMacro(Tubing,int);
125 
127 
131  void SetDrawPlane(int plane);
132  vtkGetMacro(DrawPlane,int);
133  vtkBooleanMacro(DrawPlane,int);
135 
137 
139  vtkSetMacro(OutlineTranslation,int);
140  vtkGetMacro(OutlineTranslation,int);
141  vtkBooleanMacro(OutlineTranslation,int);
143 
145 
147  vtkSetMacro(OutsideBounds,int);
148  vtkGetMacro(OutsideBounds,int);
149  vtkBooleanMacro(OutsideBounds,int);
151 
153 
154  vtkSetMacro(ScaleEnabled,int);
155  vtkGetMacro(ScaleEnabled,int);
156  vtkBooleanMacro(ScaleEnabled,int);
158 
161  void GetPolyData(vtkPolyData *pd);
162 
165  vtkPolyDataAlgorithm* GetPolyDataAlgorithm();
166 
171  void GetPlane(vtkPlane *plane);
172 
176  void UpdatePlacement(void);
177 
179 
180  vtkGetObjectMacro(NormalProperty,vtkProperty);
181  vtkGetObjectMacro(SelectedNormalProperty,vtkProperty);
183 
185 
187  vtkGetObjectMacro(PlaneProperty,vtkProperty);
188  vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
190 
192 
193  vtkGetObjectMacro(OutlineProperty,vtkProperty);
194  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
196 
198 
200  vtkGetObjectMacro(EdgesProperty,vtkProperty);
202 
203 
204  void SetEdgeColor(vtkLookupTable*);
205  void SetEdgeColor(double, double, double);
206  void SetEdgeColor(double x[3]);
208 
210 
213  vtkSetClampMacro(BumpDistance,double,0.000001,1);
214  vtkGetMacro(BumpDistance,double);
216 
222  void BumpPlane(int dir, double factor);
223 
228  void PushPlane(double distance);
229 
231 
232  virtual int ComputeInteractionState(int X, int Y, int modify=0);
233  virtual void PlaceWidget(double bounds[6]);
234  virtual void BuildRepresentation();
235  virtual void StartWidgetInteraction(double eventPos[2]);
236  virtual void WidgetInteraction(double newEventPos[2]);
237  virtual void EndWidgetInteraction(double newEventPos[2]);
239 
240 
241  virtual double *GetBounds();
242  virtual void GetActors(vtkPropCollection *pc);
243  virtual void ReleaseGraphicsResources(vtkWindow*);
244  virtual int RenderOpaqueGeometry(vtkViewport*);
246  virtual int HasTranslucentPolygonalGeometry();
248 
249 //BTX - manage the state of the widget
251  {
252  Outside=0,
258  Scaling
259  };
260 //ETX
261 
263 
270  vtkSetClampMacro(InteractionState,int,Outside,Scaling);
272 
274 
276  virtual void SetRepresentationState(int);
277  vtkGetMacro(RepresentationState, int);
279 
280 protected:
283 
285 
286  // Keep track of event positions
287  double LastEventPosition[3];
288 
289  // Controlling ivars
293 
294  // Locking normal to camera
296 
297  // Controlling the push operation
298  double BumpDistance;
299 
300  // The actual plane which is being manipulated
302 
303  // The bounding box is represented by a single voxel image data
308  void HighlightOutline(int highlight);
309  int OutlineTranslation; //whether the outline can be moved
310  int ScaleEnabled; //whether the widget can be scaled
311  int OutsideBounds; //whether the widget can be moved outside input's bounds
312 
313  // The cut plane is produced with a vtkCutter
318  void HighlightPlane(int highlight);
319 
320  // Optional tubes are represented by extracting boundary edges and tubing
325  int Tubing; //control whether tubing is on
326 
327  // The + normal cone
331  void HighlightNormal(int highlight);
332 
333  // The + normal line
337 
338  // The - normal cone
342 
343  // The - normal line
347 
348  // The origin positioning handle
352 
353  // Do the picking
355 
356  // Transform the normal (used for rotation)
358 
359  // Methods to manipulate the plane
360  void ConstrainOrigin(double x[3]);
361  void Rotate(double X, double Y, double *p1, double *p2, double *vpn);
362  void TranslatePlane(double *p1, double *p2);
363  void TranslateOutline(double *p1, double *p2);
364  void TranslateOrigin(double *p1, double *p2);
365  void Push(double *p1, double *p2);
366  void Scale(double *p1, double *p2, double X, double Y);
367  void SizeHandles();
368 
369  // Properties used to control the appearance of selected objects and
370  // the manipulator in general.
378  void CreateDefaultProperties();
379 
380  void GeneratePlane();
381 
382  // Support GetBounds() method
384 
385 private:
387  void operator=(const vtkImplicitPlaneRepresentation&); //Not implemented
388 };
389 
390 #endif