VTK
vtkImplicitCylinderRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImplicitCylinderRepresentation.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 =========================================================================*/
42 #ifndef vtkImplicitCylinderRepresentation_h
43 #define vtkImplicitCylinderRepresentation_h
44 
45 #include "vtkInteractionWidgetsModule.h" // For export macro
47 
48 class vtkActor;
49 class vtkPolyDataMapper;
50 class vtkCellPicker;
51 class vtkConeSource;
52 class vtkLineSource;
53 class vtkSphereSource;
54 class vtkTubeFilter;
55 class vtkCylinder;
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 #define VTK_MAX_CYL_RESOLUTION 2048
67 
68 class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitCylinderRepresentation : public vtkWidgetRepresentation
69 {
70 public:
75 
77 
81  void PrintSelf(ostream& os, vtkIndent indent);
83 
85 
89  void SetCenter(double x, double y, double z);
90  void SetCenter(double x[3]);
91  double* GetCenter();
92  void GetCenter(double xyz[3]);
94 
96 
100  void SetAxis(double x, double y, double z);
101  void SetAxis(double a[3]);
102  double* GetAxis();
103  void GetAxis(double a[3]);
105 
107 
111  void SetRadius(double r);
112  double GetRadius();
114 
116 
123  vtkSetClampMacro(MinRadius,double,0.001,0.25);
124  vtkGetMacro(MinRadius,double);
125  vtkSetClampMacro(MaxRadius,double,0.25,VTK_FLOAT_MAX);
126  vtkGetMacro(MaxRadius,double);
128 
130 
137  void SetAlongXAxis(int);
138  vtkGetMacro(AlongXAxis,int);
139  vtkBooleanMacro(AlongXAxis,int);
140  void SetAlongYAxis(int);
141  vtkGetMacro(AlongYAxis,int);
142  vtkBooleanMacro(AlongYAxis,int);
143  void SetAlongZAxis(int);
144  vtkGetMacro(AlongZAxis,int);
145  vtkBooleanMacro(AlongZAxis,int);
147 
149 
155  void SetDrawCylinder(int drawCyl);
156  vtkGetMacro(DrawCylinder,int);
157  vtkBooleanMacro(DrawCylinder,int);
159 
161 
167  vtkSetClampMacro(Resolution,int,8,VTK_MAX_CYL_RESOLUTION);
168  vtkGetMacro(Resolution,int);
170 
172 
177  vtkSetMacro(Tubing,int);
178  vtkGetMacro(Tubing,int);
179  vtkBooleanMacro(Tubing,int);
181 
183 
187  vtkSetMacro(OutlineTranslation,int);
188  vtkGetMacro(OutlineTranslation,int);
189  vtkBooleanMacro(OutlineTranslation,int);
191 
193 
197  vtkSetMacro(OutsideBounds,int);
198  vtkGetMacro(OutsideBounds,int);
199  vtkBooleanMacro(OutsideBounds,int);
201 
203 
209  vtkSetVector6Macro(WidgetBounds, double);
210  vtkGetVector6Macro(WidgetBounds, double);
212 
214 
222  vtkSetMacro(ConstrainToWidgetBounds, int);
223  vtkGetMacro(ConstrainToWidgetBounds, int);
224  vtkBooleanMacro(ConstrainToWidgetBounds, int);
226 
228 
231  vtkSetMacro(ScaleEnabled,int);
232  vtkGetMacro(ScaleEnabled,int);
233  vtkBooleanMacro(ScaleEnabled,int);
235 
242  void GetCylinder(vtkCylinder *cyl);
243 
248  void GetPolyData(vtkPolyData *pd);
249 
254  void UpdatePlacement(void);
255 
257 
260  vtkGetObjectMacro(AxisProperty,vtkProperty);
261  vtkGetObjectMacro(SelectedAxisProperty,vtkProperty);
263 
265 
269  vtkGetObjectMacro(CylinderProperty,vtkProperty);
270  vtkGetObjectMacro(SelectedCylinderProperty,vtkProperty);
272 
274 
277  vtkGetObjectMacro(OutlineProperty,vtkProperty);
278  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
280 
282 
286  vtkGetObjectMacro(EdgesProperty,vtkProperty);
288 
289 
292  void SetEdgeColor(vtkLookupTable*);
293  void SetEdgeColor(double, double, double);
294  void SetEdgeColor(double x[3]);
296 
298 
301  virtual int ComputeInteractionState(int X, int Y, int modify=0);
302  virtual void PlaceWidget(double bounds[6]);
303  virtual void BuildRepresentation();
304  virtual void StartWidgetInteraction(double eventPos[2]);
305  virtual void WidgetInteraction(double newEventPos[2]);
306  virtual void EndWidgetInteraction(double newEventPos[2]);
308 
310 
313  virtual double *GetBounds();
314  virtual void GetActors(vtkPropCollection *pc);
315  virtual void ReleaseGraphicsResources(vtkWindow*);
316  virtual int RenderOpaqueGeometry(vtkViewport*);
318  virtual int HasTranslucentPolygonalGeometry();
320 
322 
327  vtkSetClampMacro(BumpDistance,double,0.000001,1);
328  vtkGetMacro(BumpDistance,double);
330 
338  void BumpCylinder(int dir, double factor);
339 
346  void PushCylinder(double distance);
347 
348  // Manage the state of the widget
350  {
351  Outside=0,
358  TranslatingCenter
359  };
360 
362 
371  vtkSetClampMacro(InteractionState,int,Outside,TranslatingCenter);
373 
375 
379  virtual void SetRepresentationState(int);
380  vtkGetMacro(RepresentationState, int);
382 
383 protected:
386 
388 
389  // Keep track of event positions
390  double LastEventPosition[3];
391 
392  // Control the radius
393  double MinRadius;
394  double MaxRadius;
395 
396  // Controlling the push operation
397  double BumpDistance;
398 
399  // Controlling ivars
403 
404  // The actual cylinder which is being manipulated
406 
407  // The facet resolution for rendering purposes.
409 
410  // The bounding box is represented by a single voxel image data
415  void HighlightOutline(int highlight);
416  int OutlineTranslation; //whether the outline can be moved
417  int ScaleEnabled; //whether the widget can be scaled
418  int OutsideBounds; //whether the widget can be moved outside input's bounds
419  double WidgetBounds[6];
421 
422  // The cut cylinder is produced with a vtkCutter
427  void HighlightCylinder(int highlight);
428 
429  // Optional tubes are represented by extracting boundary edges and tubing
434  int Tubing; //control whether tubing is on
435 
436  // The + normal cone (i.e., in positive direction along normal)
440  void HighlightNormal(int highlight);
441 
442  // The + normal line
446 
447  // The - normal cone
451 
452  // The - normal line
456 
457  // The center positioning handle
461 
462  // Do the picking
465 
466  // Register internal Pickers within PickingManager
467  virtual void RegisterPickers();
468 
469  // Transform the normal (used for rotation)
471 
472  // Methods to manipulate the cylinder
473  void Rotate(double X, double Y, double *p1, double *p2, double *vpn);
474  void TranslateCylinder(double *p1, double *p2);
475  void TranslateOutline(double *p1, double *p2);
476  void TranslateCenter(double *p1, double *p2);
477  void TranslateCenterOnAxis(double *p1, double *p2);
478  void ScaleRadius(double *p1, double *p2);
479  void AdjustRadius(double X, double Y, double *p1, double *p2);
480  void Scale(double *p1, double *p2, double X, double Y);
481  void SizeHandles();
482 
483  // Properties used to control the appearance of selected objects and
484  // the manipulator in general.
492  void CreateDefaultProperties();
493 
494  // Intersect oriented infinite cylinder against bounding box
495  void BuildCylinder();
496 
497  // Support GetBounds() method
499 
500 private:
502  void operator=(const vtkImplicitCylinderRepresentation&) VTK_DELETE_FUNCTION;
503 };
504 
505 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkImplicitCylinderRepresentation::Resolution
int Resolution
Definition: vtkImplicitCylinderRepresentation.h:408
vtkWidgetRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
Definition: vtkWidgetRepresentation.h:130
vtkWidgetRepresentation.h
vtkImplicitCylinderRepresentation::ConeActor
vtkActor * ConeActor
Definition: vtkImplicitCylinderRepresentation.h:439
vtkImplicitCylinderRepresentation::Edges
vtkFeatureEdges * Edges
Definition: vtkImplicitCylinderRepresentation.h:430
vtkImplicitCylinderRepresentation::MovingOutline
Definition: vtkImplicitCylinderRepresentation.h:353
vtkImplicitCylinderRepresentation::MovingCenter
Definition: vtkImplicitCylinderRepresentation.h:354
vtkImplicitCylinderRepresentation
defining the representation for a vtkImplicitCylinderWidget
Definition: vtkImplicitCylinderRepresentation.h:68
vtkImplicitCylinderRepresentation::SelectedCylinderProperty
vtkProperty * SelectedCylinderProperty
Definition: vtkImplicitCylinderRepresentation.h:488
vtkWidgetRepresentation::EndWidgetInteraction
virtual void EndWidgetInteraction(double newEventPos[2])
Definition: vtkWidgetRepresentation.h:132
vtkImplicitCylinderRepresentation::EdgesTuber
vtkTubeFilter * EdgesTuber
Definition: vtkImplicitCylinderRepresentation.h:431
vtkImplicitCylinderRepresentation::ConstrainToWidgetBounds
int ConstrainToWidgetBounds
Definition: vtkImplicitCylinderRepresentation.h:420
vtkImplicitCylinderRepresentation::OutsideBounds
int OutsideBounds
Definition: vtkImplicitCylinderRepresentation.h:418
vtkImplicitCylinderRepresentation::ScaleEnabled
int ScaleEnabled
Definition: vtkImplicitCylinderRepresentation.h:417
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkImplicitCylinderRepresentation::OutlineMapper
vtkPolyDataMapper * OutlineMapper
Definition: vtkImplicitCylinderRepresentation.h:413
vtkImplicitCylinderRepresentation::Outline
vtkOutlineFilter * Outline
Definition: vtkImplicitCylinderRepresentation.h:412
vtkImplicitCylinderRepresentation::Moving
Definition: vtkImplicitCylinderRepresentation.h:352
vtkImplicitCylinderRepresentation::SphereMapper
vtkPolyDataMapper * SphereMapper
Definition: vtkImplicitCylinderRepresentation.h:459
vtkImplicitCylinderRepresentation::EdgesMapper
vtkPolyDataMapper * EdgesMapper
Definition: vtkImplicitCylinderRepresentation.h:432
vtkConeSource
generate polygonal cone
Definition: vtkConeSource.h:44
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:54
vtkImplicitCylinderRepresentation::BoundingBox
vtkBox * BoundingBox
Definition: vtkImplicitCylinderRepresentation.h:498
vtkImplicitCylinderRepresentation::LineSource2
vtkLineSource * LineSource2
Definition: vtkImplicitCylinderRepresentation.h:453
vtkX3D::dir
Definition: vtkX3D.h:324
vtkImplicitCylinderRepresentation::EdgesActor
vtkActor * EdgesActor
Definition: vtkImplicitCylinderRepresentation.h:433
vtkImplicitCylinderRepresentation::CylinderProperty
vtkProperty * CylinderProperty
Definition: vtkImplicitCylinderRepresentation.h:487
vtkImplicitCylinderRepresentation::Tubing
int Tubing
Definition: vtkImplicitCylinderRepresentation.h:434
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkImplicitCylinderRepresentation::LineMapper2
vtkPolyDataMapper * LineMapper2
Definition: vtkImplicitCylinderRepresentation.h:454
vtkImplicitCylinderRepresentation::Cylinder
vtkCylinder * Cylinder
Definition: vtkImplicitCylinderRepresentation.h:405
vtkCylinder
implicit function for a cylinder
Definition: vtkCylinder.h:44
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkImplicitCylinderRepresentation::Transform
vtkTransform * Transform
Definition: vtkImplicitCylinderRepresentation.h:470
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
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
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
vtkWidgetRepresentation::WidgetInteraction
virtual void WidgetInteraction(double newEventPos[2])
Definition: vtkWidgetRepresentation.h:131
vtkImplicitCylinderRepresentation::LineSource
vtkLineSource * LineSource
Definition: vtkImplicitCylinderRepresentation.h:443
vtkImplicitCylinderRepresentation::RepresentationState
int RepresentationState
Definition: vtkImplicitCylinderRepresentation.h:387
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:46
vtkImplicitCylinderRepresentation::AxisProperty
vtkProperty * AxisProperty
Definition: vtkImplicitCylinderRepresentation.h:485
vtkImplicitCylinderRepresentation::AlongYAxis
int AlongYAxis
Definition: vtkImplicitCylinderRepresentation.h:401
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
vtkWidgetRepresentation::RegisterPickers
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
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
vtkWidgetRepresentation::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport))
Definition: vtkWidgetRepresentation.h:188
vtkImplicitCylinderRepresentation::ConeSource
vtkConeSource * ConeSource
Definition: vtkImplicitCylinderRepresentation.h:437
vtkImplicitCylinderRepresentation::MinRadius
double MinRadius
Definition: vtkImplicitCylinderRepresentation.h:393
vtkFeatureEdges
extract boundary, non-manifold, and/or sharp edges from polygonal data
Definition: vtkFeatureEdges.h:52
vtkImplicitCylinderRepresentation::ConeSource2
vtkConeSource * ConeSource2
Definition: vtkImplicitCylinderRepresentation.h:448
vtkImplicitCylinderRepresentation::_InteractionState
_InteractionState
Definition: vtkImplicitCylinderRepresentation.h:349
vtkImplicitCylinderRepresentation::SphereActor
vtkActor * SphereActor
Definition: vtkImplicitCylinderRepresentation.h:460
vtkImplicitCylinderRepresentation::ConeActor2
vtkActor * ConeActor2
Definition: vtkImplicitCylinderRepresentation.h:450
vtkImplicitCylinderRepresentation::Cyl
vtkPolyData * Cyl
Definition: vtkImplicitCylinderRepresentation.h:423
vtkImplicitCylinderRepresentation::DrawCylinder
int DrawCylinder
Definition: vtkImplicitCylinderRepresentation.h:426
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:161
vtkImplicitCylinderRepresentation::SelectedOutlineProperty
vtkProperty * SelectedOutlineProperty
Definition: vtkImplicitCylinderRepresentation.h:490
vtkImplicitCylinderRepresentation::EdgesProperty
vtkProperty * EdgesProperty
Definition: vtkImplicitCylinderRepresentation.h:491
vtkLineSource
create a line defined by two end points
Definition: vtkLineSource.h:42
vtkImplicitCylinderRepresentation::BumpDistance
double BumpDistance
Definition: vtkImplicitCylinderRepresentation.h:397
vtkImplicitCylinderRepresentation::ConeMapper2
vtkPolyDataMapper * ConeMapper2
Definition: vtkImplicitCylinderRepresentation.h:449
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkImplicitCylinderRepresentation::LineMapper
vtkPolyDataMapper * LineMapper
Definition: vtkImplicitCylinderRepresentation.h:444
vtkImplicitCylinderRepresentation::CylPicker
vtkCellPicker * CylPicker
Definition: vtkImplicitCylinderRepresentation.h:464
vtkImplicitCylinderRepresentation::Picker
vtkCellPicker * Picker
Definition: vtkImplicitCylinderRepresentation.h:463
vtkImplicitCylinderRepresentation::SelectedAxisProperty
vtkProperty * SelectedAxisProperty
Definition: vtkImplicitCylinderRepresentation.h:486
vtkImplicitCylinderRepresentation::AlongZAxis
int AlongZAxis
Definition: vtkImplicitCylinderRepresentation.h:402
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkImplicitCylinderRepresentation::AdjustingRadius
Definition: vtkImplicitCylinderRepresentation.h:356
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
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
vtkImplicitCylinderRepresentation::OutlineTranslation
int OutlineTranslation
Definition: vtkImplicitCylinderRepresentation.h:416
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
vtkImplicitCylinderRepresentation::AlongXAxis
int AlongXAxis
Definition: vtkImplicitCylinderRepresentation.h:400
vtkWidgetRepresentation::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport))
Definition: vtkWidgetRepresentation.h:189
vtkImplicitCylinderRepresentation::CylActor
vtkActor * CylActor
Definition: vtkImplicitCylinderRepresentation.h:425
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:64
VTK_MAX_CYL_RESOLUTION
#define VTK_MAX_CYL_RESOLUTION
Definition: vtkImplicitCylinderRepresentation.h:66
vtkImplicitCylinderRepresentation::Box
vtkImageData * Box
Definition: vtkImplicitCylinderRepresentation.h:411
vtkImplicitCylinderRepresentation::OutlineProperty
vtkProperty * OutlineProperty
Definition: vtkImplicitCylinderRepresentation.h:489
vtkImplicitCylinderRepresentation::ConeMapper
vtkPolyDataMapper * ConeMapper
Definition: vtkImplicitCylinderRepresentation.h:438
vtkPropCollection
a list of Props
Definition: vtkPropCollection.h:38
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
vtkImplicitCylinderRepresentation::Sphere
vtkSphereSource * Sphere
Definition: vtkImplicitCylinderRepresentation.h:458
vtkImplicitCylinderRepresentation::LineActor2
vtkActor * LineActor2
Definition: vtkImplicitCylinderRepresentation.h:455
vtkImplicitCylinderRepresentation::CylMapper
vtkPolyDataMapper * CylMapper
Definition: vtkImplicitCylinderRepresentation.h:424
vtkImplicitCylinderRepresentation::LineActor
vtkActor * LineActor
Definition: vtkImplicitCylinderRepresentation.h:445
vtkWidgetRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkImplicitCylinderRepresentation::OutlineActor
vtkActor * OutlineActor
Definition: vtkImplicitCylinderRepresentation.h:414
vtkImplicitCylinderRepresentation::RotatingAxis
Definition: vtkImplicitCylinderRepresentation.h:355
vtkImplicitCylinderRepresentation::Scaling
Definition: vtkImplicitCylinderRepresentation.h:357
vtkImplicitCylinderRepresentation::MaxRadius
double MaxRadius
Definition: vtkImplicitCylinderRepresentation.h:394
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:44