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 =========================================================================*/
41 #ifndef vtkImplicitPlaneRepresentation_h
42 #define vtkImplicitPlaneRepresentation_h
43 
44 #include "vtkInteractionWidgetsModule.h" // For export macro
46 
47 class vtkActor;
48 class vtkPolyDataMapper;
49 class vtkCellPicker;
50 class vtkConeSource;
51 class vtkLineSource;
52 class vtkSphereSource;
53 class vtkTubeFilter;
54 class vtkPlane;
55 class vtkCutter;
56 class vtkProperty;
57 class vtkImageData;
58 class vtkOutlineFilter;
59 class vtkFeatureEdges;
60 class vtkPolyData;
62 class vtkTransform;
63 class vtkBox;
64 class vtkLookupTable;
65 
66 class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitPlaneRepresentation : public vtkWidgetRepresentation
67 {
68 public:
73 
75 
79  void PrintSelf(ostream& os, vtkIndent indent);
81 
83 
86  void SetOrigin(double x, double y, double z);
87  void SetOrigin(double x[3]);
88  double* GetOrigin();
89  void GetOrigin(double xyz[3]);
91 
93 
96  void SetNormal(double x, double y, double z);
97  void SetNormal(double x[3]);
98  void SetNormalToCamera();
99  double* GetNormal();
100  void GetNormal(double xyz[3]);
102 
104 
111  void SetNormalToXAxis(int);
112  vtkGetMacro(NormalToXAxis,int);
113  vtkBooleanMacro(NormalToXAxis,int);
114  void SetNormalToYAxis(int);
115  vtkGetMacro(NormalToYAxis,int);
116  vtkBooleanMacro(NormalToYAxis,int);
117  void SetNormalToZAxis(int);
118  vtkGetMacro(NormalToZAxis,int);
119  vtkBooleanMacro(NormalToZAxis,int);
121 
123 
128  virtual void SetLockNormalToCamera(int);
129  vtkGetMacro(LockNormalToCamera,int);
130  vtkBooleanMacro(LockNormalToCamera,int);
132 
134 
138  vtkSetMacro(Tubing,int);
139  vtkGetMacro(Tubing,int);
140  vtkBooleanMacro(Tubing,int);
142 
144 
150  void SetDrawPlane(int plane);
151  vtkGetMacro(DrawPlane,int);
152  vtkBooleanMacro(DrawPlane,int);
154 
156 
160  vtkSetMacro(OutlineTranslation,int);
161  vtkGetMacro(OutlineTranslation,int);
162  vtkBooleanMacro(OutlineTranslation,int);
164 
166 
170  vtkSetMacro(OutsideBounds,int);
171  vtkGetMacro(OutsideBounds,int);
172  vtkBooleanMacro(OutsideBounds,int);
174 
176 
182  vtkSetVector6Macro(WidgetBounds, double);
183  vtkGetVector6Macro(WidgetBounds, double);
185 
187 
194  vtkSetMacro(ConstrainToWidgetBounds,int);
195  vtkGetMacro(ConstrainToWidgetBounds,int);
196  vtkBooleanMacro(ConstrainToWidgetBounds,int);
198 
200 
203  vtkSetMacro(ScaleEnabled,int);
204  vtkGetMacro(ScaleEnabled,int);
205  vtkBooleanMacro(ScaleEnabled,int);
207 
212  void GetPolyData(vtkPolyData *pd);
213 
218  vtkPolyDataAlgorithm* GetPolyDataAlgorithm();
219 
227  void GetPlane(vtkPlane *plane);
228 
234  void SetPlane(vtkPlane *plane);
235 
240  void UpdatePlacement(void);
241 
243 
246  vtkGetObjectMacro(NormalProperty,vtkProperty);
247  vtkGetObjectMacro(SelectedNormalProperty,vtkProperty);
249 
251 
255  vtkGetObjectMacro(PlaneProperty,vtkProperty);
256  vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
258 
260 
263  vtkGetObjectMacro(OutlineProperty,vtkProperty);
264  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
266 
268 
272  vtkGetObjectMacro(EdgesProperty,vtkProperty);
274 
275 
278  void SetEdgeColor(vtkLookupTable*);
279  void SetEdgeColor(double, double, double);
280  void SetEdgeColor(double x[3]);
282 
284 
289  vtkSetClampMacro(BumpDistance,double,0.000001,1);
290  vtkGetMacro(BumpDistance,double);
292 
301  void BumpPlane(int dir, double factor);
302 
309  void PushPlane(double distance);
310 
312 
315  virtual int ComputeInteractionState(int X, int Y, int modify=0);
316  virtual void PlaceWidget(double bounds[6]);
317  virtual void BuildRepresentation();
318  virtual void StartWidgetInteraction(double eventPos[2]);
319  virtual void WidgetInteraction(double newEventPos[2]);
320  virtual void EndWidgetInteraction(double newEventPos[2]);
322 
323 
326  virtual double *GetBounds();
327  virtual void GetActors(vtkPropCollection *pc);
328  virtual void ReleaseGraphicsResources(vtkWindow*);
329  virtual int RenderOpaqueGeometry(vtkViewport*);
331  virtual int HasTranslucentPolygonalGeometry();
333 
334  // Manage the state of the widget
336  {
337  Outside=0,
343  Scaling
344  };
345 
347 
356  vtkSetClampMacro(InteractionState,int,Outside,Scaling);
358 
360 
364  virtual void SetRepresentationState(int);
365  vtkGetMacro(RepresentationState, int);
367 
368 protected:
371 
373 
374  // Keep track of event positions
375  double LastEventPosition[3];
376 
377  // Controlling ivars
381 
382  // Locking normal to camera
384 
385  // Controlling the push operation
386  double BumpDistance;
387 
388  // The actual plane which is being manipulated
390 
391  // The bounding box is represented by a single voxel image data
396  void HighlightOutline(int highlight);
397  int OutlineTranslation; //whether the outline can be moved
398  int ScaleEnabled; //whether the widget can be scaled
399  int OutsideBounds; //whether the widget can be moved outside input's bounds
400  double WidgetBounds[6];
402 
403  // The cut plane is produced with a vtkCutter
408  void HighlightPlane(int highlight);
409 
410  // Optional tubes are represented by extracting boundary edges and tubing
415  int Tubing; //control whether tubing is on
416 
417  // The + normal cone
421  void HighlightNormal(int highlight);
422 
423  // The + normal line
427 
428  // The - normal cone
432 
433  // The - normal line
437 
438  // The origin positioning handle
442 
443  // Do the picking
445 
446  // Register internal Pickers within PickingManager
447  virtual void RegisterPickers();
448 
449  // Transform the normal (used for rotation)
451 
452  // Methods to manipulate the plane
453  void Rotate(double X, double Y, double *p1, double *p2, double *vpn);
454  void TranslatePlane(double *p1, double *p2);
455  void TranslateOutline(double *p1, double *p2);
456  void TranslateOrigin(double *p1, double *p2);
457  void Push(double *p1, double *p2);
458  void Scale(double *p1, double *p2, double X, double Y);
459  void SizeHandles();
460 
461  // Properties used to control the appearance of selected objects and
462  // the manipulator in general.
470  void CreateDefaultProperties();
471 
472  void GeneratePlane();
473 
474  // Support GetBounds() method
476 
477 private:
479  void operator=(const vtkImplicitPlaneRepresentation&) VTK_DELETE_FUNCTION;
480 };
481 
482 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkWidgetRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
Definition: vtkWidgetRepresentation.h:130
vtkWidgetRepresentation.h
vtkPlane
perform various plane computations
Definition: vtkPlane.h:37
vtkImplicitPlaneRepresentation::MovingOutline
@ MovingOutline
Definition: vtkImplicitPlaneRepresentation.h:339
vtkImplicitPlaneRepresentation::LineActor2
vtkActor * LineActor2
Definition: vtkImplicitPlaneRepresentation.h:436
vtkImplicitPlaneRepresentation::ConeMapper2
vtkPolyDataMapper * ConeMapper2
Definition: vtkImplicitPlaneRepresentation.h:430
vtkImplicitPlaneRepresentation::MovingOrigin
@ MovingOrigin
Definition: vtkImplicitPlaneRepresentation.h:340
vtkImplicitPlaneRepresentation::Outline
vtkOutlineFilter * Outline
Definition: vtkImplicitPlaneRepresentation.h:393
vtkImplicitPlaneRepresentation::SelectedNormalProperty
vtkProperty * SelectedNormalProperty
Definition: vtkImplicitPlaneRepresentation.h:464
vtkImplicitPlaneRepresentation::NormalProperty
vtkProperty * NormalProperty
Definition: vtkImplicitPlaneRepresentation.h:463
vtkCutter
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:69
vtkWidgetRepresentation::EndWidgetInteraction
virtual void EndWidgetInteraction(double newEventPos[2])
Definition: vtkWidgetRepresentation.h:132
vtkImplicitPlaneRepresentation::Tubing
int Tubing
Definition: vtkImplicitPlaneRepresentation.h:415
vtkImplicitPlaneRepresentation::RepresentationState
int RepresentationState
Definition: vtkImplicitPlaneRepresentation.h:372
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkImplicitPlaneRepresentation::ConstrainToWidgetBounds
int ConstrainToWidgetBounds
Definition: vtkImplicitPlaneRepresentation.h:401
vtkImplicitPlaneRepresentation::CutMapper
vtkPolyDataMapper * CutMapper
Definition: vtkImplicitPlaneRepresentation.h:405
vtkConeSource
generate polygonal cone
Definition: vtkConeSource.h:44
vtkImplicitPlaneRepresentation::EdgesProperty
vtkProperty * EdgesProperty
Definition: vtkImplicitPlaneRepresentation.h:469
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:54
vtkImplicitPlaneRepresentation::SphereActor
vtkActor * SphereActor
Definition: vtkImplicitPlaneRepresentation.h:441
vtkX3D::dir
@ dir
Definition: vtkX3D.h:324
vtkImplicitPlaneRepresentation::PlaneProperty
vtkProperty * PlaneProperty
Definition: vtkImplicitPlaneRepresentation.h:465
vtkImplicitPlaneRepresentation::ConeSource
vtkConeSource * ConeSource
Definition: vtkImplicitPlaneRepresentation.h:418
vtkImplicitPlaneRepresentation::LineMapper
vtkPolyDataMapper * LineMapper
Definition: vtkImplicitPlaneRepresentation.h:425
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkImplicitPlaneRepresentation::Cutter
vtkCutter * Cutter
Definition: vtkImplicitPlaneRepresentation.h:404
vtkImplicitPlaneRepresentation::SphereMapper
vtkPolyDataMapper * SphereMapper
Definition: vtkImplicitPlaneRepresentation.h:440
vtkImplicitPlaneRepresentation::Moving
@ Moving
Definition: vtkImplicitPlaneRepresentation.h:338
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkWidgetRepresentation::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkWidgetRepresentation.h:186
vtkImplicitPlaneRepresentation::Rotating
@ Rotating
Definition: vtkImplicitPlaneRepresentation.h:341
vtkImplicitPlaneRepresentation
a class defining the representation for a vtkImplicitPlaneWidget2
Definition: vtkImplicitPlaneRepresentation.h:66
vtkWidgetRepresentation::GetBounds
virtual double * GetBounds()
Methods to make this class behave as a vtkProp.
Definition: vtkWidgetRepresentation.h:181
vtkTubeFilter
filter that generates tubes around lines
Definition: vtkTubeFilter.h:83
vtkImplicitPlaneRepresentation::OutsideBounds
int OutsideBounds
Definition: vtkImplicitPlaneRepresentation.h:399
vtkImplicitPlaneRepresentation::OutlineMapper
vtkPolyDataMapper * OutlineMapper
Definition: vtkImplicitPlaneRepresentation.h:394
vtkImplicitPlaneRepresentation::ConeMapper
vtkPolyDataMapper * ConeMapper
Definition: vtkImplicitPlaneRepresentation.h:419
vtkWidgetRepresentation::HasTranslucentPolygonalGeometry
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkWidgetRepresentation.h:191
vtkImplicitPlaneRepresentation::LineSource2
vtkLineSource * LineSource2
Definition: vtkImplicitPlaneRepresentation.h:434
vtkWidgetRepresentation::WidgetInteraction
virtual void WidgetInteraction(double newEventPos[2])
Definition: vtkWidgetRepresentation.h:131
vtkImplicitPlaneRepresentation::EdgesActor
vtkActor * EdgesActor
Definition: vtkImplicitPlaneRepresentation.h:414
vtkImplicitPlaneRepresentation::SelectedOutlineProperty
vtkProperty * SelectedOutlineProperty
Definition: vtkImplicitPlaneRepresentation.h:468
vtkImplicitPlaneRepresentation::ConeSource2
vtkConeSource * ConeSource2
Definition: vtkImplicitPlaneRepresentation.h:429
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:46
vtkImplicitPlaneRepresentation::BumpDistance
double BumpDistance
Definition: vtkImplicitPlaneRepresentation.h:386
vtkImplicitPlaneRepresentation::LineActor
vtkActor * LineActor
Definition: vtkImplicitPlaneRepresentation.h:426
vtkImplicitPlaneRepresentation::LineSource
vtkLineSource * LineSource
Definition: vtkImplicitPlaneRepresentation.h:424
vtkImplicitPlaneRepresentation::OutlineTranslation
int OutlineTranslation
Definition: vtkImplicitPlaneRepresentation.h:397
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkImplicitPlaneRepresentation::CutActor
vtkActor * CutActor
Definition: vtkImplicitPlaneRepresentation.h:406
vtkWidgetRepresentation::RegisterPickers
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
vtkImplicitPlaneRepresentation::DrawPlane
int DrawPlane
Definition: vtkImplicitPlaneRepresentation.h:407
vtkImplicitPlaneRepresentation::ConeActor2
vtkActor * ConeActor2
Definition: vtkImplicitPlaneRepresentation.h:431
vtkWidgetRepresentation::GetActors
virtual void GetActors(vtkPropCollection *)
For some exporters and other other operations we must be able to collect all the actors or volumes.
Definition: vtkWidgetRepresentation.h:183
vtkImplicitPlaneRepresentation::ScaleEnabled
int ScaleEnabled
Definition: vtkImplicitPlaneRepresentation.h:398
vtkWidgetRepresentation::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport))
Definition: vtkWidgetRepresentation.h:188
vtkImplicitPlaneRepresentation::NormalToZAxis
int NormalToZAxis
Definition: vtkImplicitPlaneRepresentation.h:380
vtkFeatureEdges
extract boundary, non-manifold, and/or sharp edges from polygonal data
Definition: vtkFeatureEdges.h:52
vtkImplicitPlaneRepresentation::BoundingBox
vtkBox * BoundingBox
Definition: vtkImplicitPlaneRepresentation.h:475
vtkImplicitPlaneRepresentation::ConeActor
vtkActor * ConeActor
Definition: vtkImplicitPlaneRepresentation.h:420
vtkImplicitPlaneRepresentation::OutlineActor
vtkActor * OutlineActor
Definition: vtkImplicitPlaneRepresentation.h:395
vtkLineSource
create a line defined by two end points
Definition: vtkLineSource.h:42
vtkImplicitPlaneRepresentation::_InteractionState
_InteractionState
Definition: vtkImplicitPlaneRepresentation.h:335
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkImplicitPlaneRepresentation::Plane
vtkPlane * Plane
Definition: vtkImplicitPlaneRepresentation.h:389
vtkImplicitPlaneRepresentation::Picker
vtkCellPicker * Picker
Definition: vtkImplicitPlaneRepresentation.h:444
vtkImplicitPlaneRepresentation::Pushing
@ Pushing
Definition: vtkImplicitPlaneRepresentation.h:342
vtkImplicitPlaneRepresentation::Sphere
vtkSphereSource * Sphere
Definition: vtkImplicitPlaneRepresentation.h:439
vtkImplicitPlaneRepresentation::Transform
vtkTransform * Transform
Definition: vtkImplicitPlaneRepresentation.h:450
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkWidgetRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkLookupTable
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:74
vtkImplicitPlaneRepresentation::Box
vtkImageData * Box
Definition: vtkImplicitPlaneRepresentation.h:392
vtkWidgetRepresentation::PlaceWidget
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
Definition: vtkWidgetRepresentation.h:129
vtkBox
implicit function for a bounding box
Definition: vtkBox.h:41
vtkImplicitPlaneRepresentation::OutlineProperty
vtkProperty * OutlineProperty
Definition: vtkImplicitPlaneRepresentation.h:467
vtkImplicitPlaneRepresentation::LockNormalToCamera
int LockNormalToCamera
Definition: vtkImplicitPlaneRepresentation.h:383
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkOutlineFilter
create wireframe outline for arbitrary data set
Definition: vtkOutlineFilter.h:38
vtkWidgetRepresentation::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport))
Definition: vtkWidgetRepresentation.h:189
vtkImplicitPlaneRepresentation::NormalToYAxis
int NormalToYAxis
Definition: vtkImplicitPlaneRepresentation.h:379
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:64
vtkImplicitPlaneRepresentation::NormalToXAxis
int NormalToXAxis
Definition: vtkImplicitPlaneRepresentation.h:378
vtkPropCollection
a list of Props
Definition: vtkPropCollection.h:38
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
vtkImplicitPlaneRepresentation::Edges
vtkFeatureEdges * Edges
Definition: vtkImplicitPlaneRepresentation.h:411
vtkImplicitPlaneRepresentation::EdgesTuber
vtkTubeFilter * EdgesTuber
Definition: vtkImplicitPlaneRepresentation.h:412
vtkWidgetRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkImplicitPlaneRepresentation::LineMapper2
vtkPolyDataMapper * LineMapper2
Definition: vtkImplicitPlaneRepresentation.h:435
vtkImplicitPlaneRepresentation::EdgesMapper
vtkPolyDataMapper * EdgesMapper
Definition: vtkImplicitPlaneRepresentation.h:413
vtkImplicitPlaneRepresentation::SelectedPlaneProperty
vtkProperty * SelectedPlaneProperty
Definition: vtkImplicitPlaneRepresentation.h:466
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:44