VTK
vtkPicker.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPicker.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 =========================================================================*/
46 #ifndef vtkPicker_h
47 #define vtkPicker_h
48 
49 #include "vtkRenderingCoreModule.h" // For export macro
50 #include "vtkAbstractPropPicker.h"
51 
53 class vtkDataSet;
54 class vtkTransform;
55 class vtkActorCollection;
57 class vtkPoints;
58 
60 {
61 public:
62  static vtkPicker *New();
64  void PrintSelf(ostream& os, vtkIndent indent);
65 
67 
70  vtkSetMacro(Tolerance, double);
71  vtkGetMacro(Tolerance, double);
73 
75 
77  vtkGetVectorMacro(MapperPosition, double, 3);
79 
81 
82  vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
84 
86 
88  vtkGetObjectMacro(DataSet, vtkDataSet);
90 
92 
95  { return this->Prop3Ds; }
97 
101  vtkActorCollection *GetActors();
102 
104 
108  { return this->PickedPositions; }
110 
112 
116  virtual int Pick(double selectionX, double selectionY, double selectionZ,
117  vtkRenderer *renderer);
119 
121 
125  int Pick(double selectionPt[3], vtkRenderer *ren)
126  { return this->Pick(selectionPt[0], selectionPt[1], selectionPt[2], ren); }
128 
129 protected:
130  vtkPicker();
131  ~vtkPicker();
132 
133  void MarkPicked(vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m,
134  double tMin, double mapperPos[3]);
135  virtual double IntersectWithLine(double p1[3], double p2[3], double tol,
136  vtkAssemblyPath *path, vtkProp3D *p,
138  virtual void Initialize();
139 
140  double Tolerance; //tolerance for computation (% of window)
141  double MapperPosition[3]; //selection point in untransformed coordinates
142 
143  vtkAbstractMapper3D *Mapper; //selected mapper (if the prop has a mapper)
144  vtkDataSet *DataSet; //selected dataset (if there is one)
145 
146  double GlobalTMin; //parametric coordinate along pick ray where hit occurred
147  vtkTransform *Transform; //use to perform ray transformation
148  vtkActorCollection *Actors; //candidate actors (based on bounding box)
149  vtkProp3DCollection *Prop3Ds; //candidate actors (based on bounding box)
150  vtkPoints *PickedPositions; // candidate positions
151 
152 private:
153  vtkPicker(const vtkPicker&); // Not implemented.
154  void operator=(const vtkPicker&); // Not implemented.
155 };
156 
157 #endif
double Tolerance
Definition: vtkPicker.h:140
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
void PrintSelf(ostream &os, vtkIndent indent)
vtkPoints * PickedPositions
Definition: vtkPicker.h:150
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:42
vtkActorCollection * Actors
Definition: vtkPicker.h:148
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:59
int Pick(double selectionPt[3], vtkRenderer *ren)
Definition: vtkPicker.h:125
vtkTransform * Transform
Definition: vtkPicker.h:147
vtkProp3DCollection * GetProp3Ds()
Definition: vtkPicker.h:94
a list of nodes that form an assembly path
vtkPoints * GetPickedPositions()
Definition: vtkPicker.h:107
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkProp3DCollection * Prop3Ds
Definition: vtkPicker.h:149
abstract class specifies interface to map 3D data
a list of 3D props
a list of actors
abstract API for pickers that can pick an instance of vtkProp
virtual int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer *renderer)=0
#define VTKRENDERINGCORE_EXPORT
vtkAbstractMapper3D * Mapper
Definition: vtkPicker.h:143
static vtkObject * New()
double GlobalTMin
Definition: vtkPicker.h:146
represent and manipulate 3D points
Definition: vtkPoints.h:38
vtkDataSet * DataSet
Definition: vtkPicker.h:144