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 
174  void GetPlane(vtkPlane *plane);
175 
179  void SetPlane(vtkPlane *plane);
180 
184  void UpdatePlacement(void);
185 
187 
188  vtkGetObjectMacro(NormalProperty,vtkProperty);
189  vtkGetObjectMacro(SelectedNormalProperty,vtkProperty);
191 
193 
195  vtkGetObjectMacro(PlaneProperty,vtkProperty);
196  vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
198 
200 
201  vtkGetObjectMacro(OutlineProperty,vtkProperty);
202  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
204 
206 
208  vtkGetObjectMacro(EdgesProperty,vtkProperty);
210 
211 
212  void SetEdgeColor(vtkLookupTable*);
213  void SetEdgeColor(double, double, double);
214  void SetEdgeColor(double x[3]);
216 
218 
221  vtkSetClampMacro(BumpDistance,double,0.000001,1);
222  vtkGetMacro(BumpDistance,double);
224 
230  void BumpPlane(int dir, double factor);
231 
236  void PushPlane(double distance);
237 
239 
240  virtual int ComputeInteractionState(int X, int Y, int modify=0);
241  virtual void PlaceWidget(double bounds[6]);
242  virtual void BuildRepresentation();
243  virtual void StartWidgetInteraction(double eventPos[2]);
244  virtual void WidgetInteraction(double newEventPos[2]);
245  virtual void EndWidgetInteraction(double newEventPos[2]);
247 
248 
249  virtual double *GetBounds();
250  virtual void GetActors(vtkPropCollection *pc);
251  virtual void ReleaseGraphicsResources(vtkWindow*);
252  virtual int RenderOpaqueGeometry(vtkViewport*);
254  virtual int HasTranslucentPolygonalGeometry();
256 
257  // Manage the state of the widget
259  {
260  Outside=0,
266  Scaling
267  };
268 
270 
277  vtkSetClampMacro(InteractionState,int,Outside,Scaling);
279 
281 
283  virtual void SetRepresentationState(int);
284  vtkGetMacro(RepresentationState, int);
286 
287 protected:
290 
292 
293  // Keep track of event positions
294  double LastEventPosition[3];
295 
296  // Controlling ivars
300 
301  // Locking normal to camera
303 
304  // Controlling the push operation
305  double BumpDistance;
306 
307  // The actual plane which is being manipulated
309 
310  // The bounding box is represented by a single voxel image data
315  void HighlightOutline(int highlight);
316  int OutlineTranslation; //whether the outline can be moved
317  int ScaleEnabled; //whether the widget can be scaled
318  int OutsideBounds; //whether the widget can be moved outside input's bounds
319 
320  // The cut plane is produced with a vtkCutter
325  void HighlightPlane(int highlight);
326 
327  // Optional tubes are represented by extracting boundary edges and tubing
332  int Tubing; //control whether tubing is on
333 
334  // The + normal cone
338  void HighlightNormal(int highlight);
339 
340  // The + normal line
344 
345  // The - normal cone
349 
350  // The - normal line
354 
355  // The origin positioning handle
359 
360  // Do the picking
362 
363  // Register internal Pickers within PickingManager
364  virtual void RegisterPickers();
365 
366  // Transform the normal (used for rotation)
368 
369  // Methods to manipulate the plane
370  void ConstrainOrigin(double x[3]);
371  void Rotate(double X, double Y, double *p1, double *p2, double *vpn);
372  void TranslatePlane(double *p1, double *p2);
373  void TranslateOutline(double *p1, double *p2);
374  void TranslateOrigin(double *p1, double *p2);
375  void Push(double *p1, double *p2);
376  void Scale(double *p1, double *p2, double X, double Y);
377  void SizeHandles();
378 
379  // Properties used to control the appearance of selected objects and
380  // the manipulator in general.
388  void CreateDefaultProperties();
389 
390  void GeneratePlane();
391 
392  // Support GetBounds() method
394 
395 private:
397  void operator=(const vtkImplicitPlaneRepresentation&); //Not implemented
398 };
399 
400 #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:84
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))