VTK  9.3.0
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
47 #ifndef vtkAreaPicker_h
48 #define vtkAreaPicker_h
49 
50 #include "vtkAbstractPropPicker.h"
51 #include "vtkRenderingCoreModule.h" // For export macro
52 
53 VTK_ABI_NAMESPACE_BEGIN
54 class vtkRenderer;
55 class vtkPoints;
56 class vtkPlanes;
59 class vtkDataSet;
61 class vtkProp;
62 
63 class VTKRENDERINGCORE_EXPORT vtkAreaPicker : public vtkAbstractPropPicker
64 {
65 public:
66  static vtkAreaPicker* New();
68  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
73  void SetPickCoords(double x0, double y0, double x1, double y1);
74 
79 
83  virtual int Pick();
84 
90  virtual int AreaPick(double x0, double y0, double x1, double y1, vtkRenderer* renderer = nullptr);
91 
97  int Pick(double x0, double y0, double vtkNotUsed(z0), vtkRenderer* renderer = nullptr) override
98  {
99  return this->AreaPick(x0, y0, x0 + 1.0, y0 + 1.0, renderer);
100  }
101 
103 
106  vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
108 
110 
114  vtkGetObjectMacro(DataSet, vtkDataSet);
116 
121  vtkProp3DCollection* GetProp3Ds() { return this->Prop3Ds; }
122 
124 
129  vtkGetObjectMacro(Frustum, vtkPlanes);
131 
133 
136  vtkGetObjectMacro(ClipPoints, vtkPoints);
138 
139 protected:
141  ~vtkAreaPicker() override;
142 
143  void Initialize() override;
144  void DefineFrustum(double x0, double y0, double x1, double y1, vtkRenderer*);
145  virtual int PickProps(vtkRenderer* renderer);
147 
148  int ABoxFrustumIsect(double bounds[], double& mindist);
149 
152 
153  vtkProp3DCollection* Prop3Ds; // candidate actors (based on bounding box)
154  vtkAbstractMapper3D* Mapper; // selected mapper (if the prop has a mapper)
155  vtkDataSet* DataSet; // selected dataset (if there is one)
156 
157  // used internally to do prop intersection tests
159 
160  double X0;
161  double Y0;
162  double X1;
163  double Y1;
164 
165 private:
166  vtkAreaPicker(const vtkAreaPicker&) = delete;
167  void operator=(const vtkAreaPicker&) = delete;
168 };
169 
170 VTK_ABI_NAMESPACE_END
171 #endif
abstract class specifies interface to map 3D data
abstract API for pickers that can pick an instance of vtkProp
Picks props behind a selection rectangle on a viewport.
Definition: vtkAreaPicker.h:64
int ABoxFrustumIsect(double bounds[], double &mindist)
void SetRenderer(vtkRenderer *)
Set the default renderer to pick on.
vtkAbstractMapper3D * Mapper
vtkPlanes * Frustum
virtual int Pick()
Perform an AreaPick within the default screen rectangle and renderer.
vtkDataSet * DataSet
static vtkAreaPicker * New()
void Initialize() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int PickProps(vtkRenderer *renderer)
vtkProp3DCollection * GetProp3Ds()
Return a collection of all the prop 3D's that were intersected by the pick ray.
void DefineFrustum(double x0, double y0, double x1, double y1, vtkRenderer *)
int Pick(double x0, double y0, double vtkNotUsed(z0), vtkRenderer *renderer=nullptr) override
Perform pick operation in volume behind the given screen coordinate.
Definition: vtkAreaPicker.h:97
int TypeDecipher(vtkProp *, vtkAbstractMapper3D **)
virtual int AreaPick(double x0, double y0, double x1, double y1, vtkRenderer *renderer=nullptr)
Perform pick operation in volume behind the given screen coordinates.
void SetPickCoords(double x0, double y0, double x1, double y1)
Set the default screen rectangle to pick in.
vtkExtractSelectedFrustum * FrustumExtractor
vtkPoints * ClipPoints
~vtkAreaPicker() override
vtkProp3DCollection * Prop3Ds
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
Returns the portion of the input dataset that lies within a selection frustum.
a simple class to control print indentation
Definition: vtkIndent.h:38
implicit function for convex set of planes
Definition: vtkPlanes.h:51
represent and manipulate 3D points
Definition: vtkPoints.h:38
an ordered list of 3D props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:55
abstract specification for renderers
Definition: vtkRenderer.h:71
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:28