VTK  9.2.6
vtkHardwarePicker.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkHardwarePicker.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=========================================================================*/
36#ifndef vtkHardwarePicker_h
37#define vtkHardwarePicker_h
38
40#include "vtkNew.h" // For vtkNew
41#include "vtkRenderingCoreModule.h" // For export macro
42#include "vtkSmartPointer.h" // For vtkSmartPointer
43
45class vtkCell;
47class vtkDataSet;
48class vtkSelection;
49
50class VTKRENDERINGCORE_EXPORT vtkHardwarePicker : public vtkAbstractPropPicker
51{
52public:
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
58
62 vtkSetMacro(SnapToMeshPoint, bool);
63 vtkGetMacro(SnapToMeshPoint, bool);
64 vtkBooleanMacro(SnapToMeshPoint, bool);
66
68
72 vtkSetMacro(PixelTolerance, int);
73 vtkGetMacro(PixelTolerance, int);
75
77
82 vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
84
86
92 vtkGetObjectMacro(DataSet, vtkDataSet);
94
96
102 vtkGetObjectMacro(CompositeDataSet, vtkCompositeDataSet);
104
106
111 vtkGetMacro(FlatBlockIndex, vtkIdType);
113
115
125 vtkGetMacro(PointId, vtkIdType);
127
129
139 vtkGetMacro(CellId, vtkIdType);
141
143
155 vtkGetMacro(SubId, int);
157
159
171 vtkGetVector3Macro(PCoords, double);
173
175
188 vtkGetVectorMacro(PickNormal, double, 3);
190
197 vtkGetMacro(NormalFlipped, bool);
198
208 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
209
210protected:
213
214 void Initialize() override;
215 // converts the propCandidate into a vtkAbstractMapper3D and returns its pickability
217
227
232 int ComputeSurfaceNormal(vtkDataSet* data, vtkCell* cell, double* weights);
233
238
239 bool SnapToMeshPoint; // if true, the pick position is snapped to the closest point on the mesh
240 int PixelTolerance; // tolerance for picking when snapping the closest point on the mesh
241
242 vtkNew<vtkPropCollection> PickableProps; // list of pickable props
243 vtkSmartPointer<vtkSelection> HardwareSelection; // result of the hardware selector
244
245 double NearRayPoint[3]; // near ray point
246 double FarRayPoint[3]; // far ray point
247
248 vtkAbstractMapper3D* Mapper; // selected mapper (if the prop has a mapper)
249 vtkDataSet* DataSet; // selected dataset (if there is one)
250 vtkCompositeDataSet* CompositeDataSet; // selected dataset (if there is one)
251 vtkIdType FlatBlockIndex; // flat block index, for a composite data set
252
253 vtkIdType PointId; // id of the picked point
254 vtkIdType CellId; // id of the picked cell
255 int SubId; // sub id of the picked cell
256 double PCoords[3]; // parametric coordinates of the picked point
257 double PickNormal[3]; // normal of the picked surface
258 bool NormalFlipped; // Flag to indicate if the normal has been flipped
259
260private:
261 vtkHardwarePicker(const vtkHardwarePicker&) = delete;
262 void operator=(const vtkHardwarePicker&) = delete;
263};
264
265#endif
abstract class specifies interface to map 3D data
abstract API for pickers that can pick an instance of vtkProp
abstract class to specify cell behavior
Definition vtkCell.h:58
abstract superclass for composite (multi-block or AMR) datasets
abstract class to specify dataset behavior
Definition vtkDataSet.h:57
pick a point or snap to point of an actor/prop using graphics hardware
void Initialize() override
static vtkHardwarePicker * New()
~vtkHardwarePicker() override
vtkAbstractMapper3D * Mapper
void ComputeIntersectionFromDataSet(vtkDataSet *ds)
Compute the intersection using provided dataset.
int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer *renderer) override
Perform the pick operation set the PickedProp.
void FixNormalSign()
Fix normal sign in case the orientation of the picked cell is wrong.
vtkNew< vtkPropCollection > PickableProps
int TypeDecipher(vtkProp *, vtkAbstractMapper3D **)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCompositeDataSet * CompositeDataSet
vtkSmartPointer< vtkSelection > HardwareSelection
int ComputeSurfaceNormal(vtkDataSet *data, vtkCell *cell, double *weights)
Compute the intersection normal either by interpolating the point normals at the intersected point,...
a simple class to control print indentation
Definition vtkIndent.h:34
Allocate and hold a VTK object.
Definition vtkNew.h:56
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:51
abstract specification for renderers
Definition vtkRenderer.h:67
data object that represents a "selection" in VTK.
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition vtkType.h:332