VTK  9.7.1
vtkAreaPicker.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
38 #ifndef vtkAreaPicker_h
39 #define vtkAreaPicker_h
40 
41 #include "vtkAbstractPropPicker.h"
42 #include "vtkRenderingCoreModule.h" // For export macro
43 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
44 
45 VTK_ABI_NAMESPACE_BEGIN
46 class vtkDataObject;
47 class vtkRenderer;
48 class vtkPoints;
49 class vtkPlanes;
52 class vtkDataSet;
54 class vtkProp;
55 
56 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkAreaPicker : public vtkAbstractPropPicker
57 {
58 public:
59  static vtkAreaPicker* New();
61  void PrintSelf(ostream& os, vtkIndent indent) override;
62 
66  void SetPickCoords(double x0, double y0, double x1, double y1);
67 
71  void SetRenderer(vtkRenderer*);
72 
76  virtual int Pick();
77 
83  virtual int AreaPick(double x0, double y0, double x1, double y1, vtkRenderer* renderer = nullptr);
84 
90  int Pick(double x0, double y0, double vtkNotUsed(z0), vtkRenderer* renderer = nullptr) override
91  {
92  return this->AreaPick(x0, y0, x0 + 1.0, y0 + 1.0, renderer);
93  }
94 
96 
99  vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
101 
103 
107  vtkGetObjectMacro(DataSet, vtkDataSet);
109 
111 
115  vtkGetObjectMacro(DataObject, vtkDataObject);
117 
122  vtkProp3DCollection* GetProp3Ds() { return this->Prop3Ds; }
123 
125 
130  vtkGetObjectMacro(Frustum, vtkPlanes);
132 
134 
137  vtkGetObjectMacro(ClipPoints, vtkPoints);
139 
140 protected:
141  vtkAreaPicker();
142  ~vtkAreaPicker() override;
143 
144  void Initialize() override;
145  void DefineFrustum(double x0, double y0, double x1, double y1, vtkRenderer*);
146  virtual int PickProps(vtkRenderer* renderer);
147  int TypeDecipher(vtkProp*, vtkAbstractMapper3D**);
148 
149  int ABoxFrustumIsect(double bounds[], double& mindist);
150 
153 
154  vtkProp3DCollection* Prop3Ds; // candidate actors (based on bounding box)
155  vtkAbstractMapper3D* Mapper; // selected mapper (if the prop has a mapper)
156  vtkDataSet* DataSet; // selected dataset (if there is one)
157  vtkDataObject* DataObject; // selected dataobject (this is useful to represent selected objects
158  // which directly derive vtkDataObject)
159 
160  // used internally to do prop intersection tests
162 
163  double X0;
164  double Y0;
165  double X1;
166  double Y1;
167 
168 private:
169  vtkAreaPicker(const vtkAreaPicker&) = delete;
170  void operator=(const vtkAreaPicker&) = delete;
171 };
172 
173 VTK_ABI_NAMESPACE_END
174 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
vtkProp3DCollection * GetProp3Ds()
Return a collection of all the prop 3D's that were intersected by the pick ray.
vtkAbstractMapper3D * Mapper
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkProp3DCollection * Prop3Ds
int Pick(double x0, double y0, double z0, vtkRenderer *renderer=nullptr) override
Perform pick operation in volume behind the given screen coordinate.
Definition: vtkAreaPicker.h:90
implicit function for convex set of planes
Definition: vtkPlanes.h:41
abstract specification for renderers
Definition: vtkRenderer.h:63
void Initialize() override
vtkDataObject * DataObject
vtkPlanes * Frustum
a simple class to control print indentation
Definition: vtkIndent.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:28
vtkDataSet * DataSet
abstract class specifies interface to map 3D data
vtkExtractSelectedFrustum * FrustumExtractor
an ordered list of 3D props
Returns the portion of the input dataset that lies within a selection frustum.
vtkPoints * ClipPoints
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.
Picks props behind a selection rectangle on a viewport.
Definition: vtkAreaPicker.h:56
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
general representation of visualization data
Definition: vtkDataObject.h:55
represent and manipulate 3D points
Definition: vtkPoints.h:30