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 
64 {
65 public:
68 
70 
72  void PrintSelf(ostream& os, vtkIndent indent);
74 
76 
77  void SetOrigin(double x, double y, double z);
78  void SetOrigin(double x[3]);
79  double* GetOrigin();
80  void GetOrigin(double xyz[3]);
82 
84 
85  void SetNormal(double x, double y, double z);
86  void SetNormal(double x[3]);
87  double* GetNormal();
88  void GetNormal(double xyz[3]);
90 
92 
96  void SetNormalToXAxis(int);
97  vtkGetMacro(NormalToXAxis,int);
98  vtkBooleanMacro(NormalToXAxis,int);
99  void SetNormalToYAxis(int);
100  vtkGetMacro(NormalToYAxis,int);
101  vtkBooleanMacro(NormalToYAxis,int);
102  void SetNormalToZAxis(int);
103  vtkGetMacro(NormalToZAxis,int);
104  vtkBooleanMacro(NormalToZAxis,int);
106 
108 
110  vtkSetMacro(Tubing,int);
111  vtkGetMacro(Tubing,int);
112  vtkBooleanMacro(Tubing,int);
114 
116 
120  void SetDrawPlane(int plane);
121  vtkGetMacro(DrawPlane,int);
122  vtkBooleanMacro(DrawPlane,int);
124 
126 
128  vtkSetMacro(OutlineTranslation,int);
129  vtkGetMacro(OutlineTranslation,int);
130  vtkBooleanMacro(OutlineTranslation,int);
132 
134 
136  vtkSetMacro(OutsideBounds,int);
137  vtkGetMacro(OutsideBounds,int);
138  vtkBooleanMacro(OutsideBounds,int);
140 
142 
143  vtkSetMacro(ScaleEnabled,int);
144  vtkGetMacro(ScaleEnabled,int);
145  vtkBooleanMacro(ScaleEnabled,int);
147 
150  void GetPolyData(vtkPolyData *pd);
151 
154  vtkPolyDataAlgorithm* GetPolyDataAlgorithm();
155 
160  void GetPlane(vtkPlane *plane);
161 
165  void UpdatePlacement(void);
166 
168 
169  vtkGetObjectMacro(NormalProperty,vtkProperty);
170  vtkGetObjectMacro(SelectedNormalProperty,vtkProperty);
172 
174 
176  vtkGetObjectMacro(PlaneProperty,vtkProperty);
177  vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
179 
181 
182  vtkGetObjectMacro(OutlineProperty,vtkProperty);
183  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
185 
187 
189  vtkGetObjectMacro(EdgesProperty,vtkProperty);
191 
193 
194  virtual int ComputeInteractionState(int X, int Y, int modify=0);
195  virtual void PlaceWidget(double bounds[6]);
196  virtual void BuildRepresentation();
197  virtual void StartWidgetInteraction(double eventPos[2]);
198  virtual void WidgetInteraction(double newEventPos[2]);
199  virtual void EndWidgetInteraction(double newEventPos[2]);
201 
203 
204  virtual double *GetBounds();
205  virtual void GetActors(vtkPropCollection *pc);
206  virtual void ReleaseGraphicsResources(vtkWindow*);
207  virtual int RenderOpaqueGeometry(vtkViewport*);
209  virtual int HasTranslucentPolygonalGeometry();
211 
212 //BTX - manage the state of the widget
214  {
215  Outside=0,
222  Scaling
223  };
224 //ETX
225 
227 
234  vtkSetClampMacro(InteractionState,int,Outside,Scaling);
236 
238 
240  virtual void SetRepresentationState(int);
241  vtkGetMacro(RepresentationState, int);
243 
244 protected:
247 
249 
250  // Keep track of event positions
251  double LastEventPosition[3];
252 
253  // Controlling ivars
257 
258  // The actual plane which is being manipulated
260 
261  // The bounding box is represented by a single voxel image data
266  void HighlightOutline(int highlight);
267  int OutlineTranslation; //whether the outline can be moved
268  int ScaleEnabled; //whether the widget can be scaled
269  int OutsideBounds; //whether the widget can be moved outside input's bounds
270 
271  // The cut plane is produced with a vtkCutter
276  void HighlightPlane(int highlight);
277 
278  // Optional tubes are represented by extracting boundary edges and tubing
283  int Tubing; //control whether tubing is on
284 
285  // The + normal cone
289  void HighlightNormal(int highlight);
290 
291  // The + normal line
295 
296  // The - normal cone
300 
301  // The - normal line
305 
306  // The origin positioning handle
310 
311  // Do the picking
313 
314  // Transform the normal (used for rotation)
316 
317  // Methods to manipulate the plane
318  void ConstrainOrigin(double x[3]);
319  void Rotate(double X, double Y, double *p1, double *p2, double *vpn);
320  void TranslatePlane(double *p1, double *p2);
321  void TranslateOutline(double *p1, double *p2);
322  void TranslateOrigin(double *p1, double *p2);
323  void Push(double *p1, double *p2);
324  void Scale(double *p1, double *p2, double X, double Y);
325  void SizeHandles();
326 
327  // Properties used to control the appearance of selected objects and
328  // the manipulator in general.
336  void CreateDefaultProperties();
337 
338  void GeneratePlane();
339 
340  // Support GetBounds() method
342 
343 private:
345  void operator=(const vtkImplicitPlaneRepresentation&); //Not implemented
346 };
347 
348 #endif