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 =========================================================================*/
41 #ifndef vtkPicker_h
42 #define vtkPicker_h
43 
44 #include "vtkRenderingCoreModule.h" // For export macro
45 #include "vtkAbstractPropPicker.h"
46 
49 class vtkDataSet;
50 class vtkTransform;
51 class vtkActorCollection;
53 class vtkPoints;
54 
55 class VTKRENDERINGCORE_EXPORT vtkPicker : public vtkAbstractPropPicker
56 {
57 public:
58  static vtkPicker *New();
60  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
61 
63 
68  vtkSetMacro(Tolerance, double);
69  vtkGetMacro(Tolerance, double);
71 
73 
77  vtkGetVectorMacro(MapperPosition, double, 3);
79 
81 
84  vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
86 
88 
92  vtkGetObjectMacro(DataSet, vtkDataSet);
94 
96 
100  vtkGetObjectMacro(CompositeDataSet, vtkCompositeDataSet);
102 
104 
109  vtkGetMacro(FlatBlockIndex, vtkIdType);
111 
117  { return this->Prop3Ds; }
118 
124  vtkActorCollection *GetActors();
125 
132  { return this->PickedPositions; }
133 
140  int Pick(double selectionX, double selectionY, double selectionZ,
141  vtkRenderer *renderer) VTK_OVERRIDE;
142 
148  int Pick(double selectionPt[3], vtkRenderer *ren)
149  { return this->Pick(selectionPt[0], selectionPt[1], selectionPt[2], ren); }
150 
151 protected:
152  vtkPicker();
153  ~vtkPicker() VTK_OVERRIDE;
154 
155  void MarkPicked(vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m,
156  double tMin, double mapperPos[3]);
157  void MarkPickedData(vtkAssemblyPath *path,
158  double tMin, double mapperPos[3], vtkAbstractMapper3D* mapper,
159  vtkDataSet* input, vtkIdType flatBlockIndex = -1);
160  virtual double IntersectWithLine(double p1[3], double p2[3], double tol,
161  vtkAssemblyPath *path, vtkProp3D *p,
163  void Initialize() VTK_OVERRIDE;
164  static bool CalculateRay(double p1[3], double p2[3],
165  double ray[3], double &rayFactor);
166 
167  double Tolerance; //tolerance for computation (% of window)
168  double MapperPosition[3]; //selection point in untransformed coordinates
169 
170  vtkAbstractMapper3D *Mapper; //selected mapper (if the prop has a mapper)
171  vtkDataSet *DataSet; //selected dataset (if there is one)
172  vtkCompositeDataSet* CompositeDataSet;
173  vtkIdType FlatBlockIndex; // flat block index, for a composite data set
174 
175  double GlobalTMin; //parametric coordinate along pick ray where hit occurred
176  vtkTransform *Transform; //use to perform ray transformation
177  vtkActorCollection *Actors; //candidate actors (based on bounding box)
178  vtkProp3DCollection *Prop3Ds; //candidate actors (based on bounding box)
179  vtkPoints *PickedPositions; // candidate positions
180 
181 private:
182  vtkPicker(const vtkPicker&) VTK_DELETE_FUNCTION;
183  void operator=(const vtkPicker&) VTK_DELETE_FUNCTION;
184 };
185 
186 #endif
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
abstract specification for renderers
Definition: vtkRenderer.h:57
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:43
int vtkIdType
Definition: vtkType.h:345
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:55
int Pick(double selectionPt[3], vtkRenderer *ren)
Perform pick operation with selection point provided.
Definition: vtkPicker.h:148
vtkProp3DCollection * GetProp3Ds()
Return a collection of all the prop 3D's that were intersected by the pick ray.
Definition: vtkPicker.h:116
abstract superclass for composite (multi-block or AMR) datasets
a list of nodes that form an assembly path
vtkPoints * GetPickedPositions()
Return a list of the points the the actors returned by GetProp3Ds were intersected at...
Definition: vtkPicker.h:131
a simple class to control print indentation
Definition: vtkIndent.h:33
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
abstract class specifies interface to map 3D data
an ordered list of 3D props
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
an ordered 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
Perform pick operation with selection point provided.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
represent and manipulate 3D points
Definition: vtkPoints.h:33
Transform
Definition: ADIOSDefs.h:39