VTK  9.1.0
vtkAreaPicker.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAreaPicker.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 =========================================================================*/
113 #ifndef vtkAreaPicker_h
114 #define vtkAreaPicker_h
115 
116 #include "vtkAbstractPropPicker.h"
117 #include "vtkRenderingCoreModule.h" // For export macro
118 
119 class vtkRenderer;
120 class vtkPoints;
121 class vtkPlanes;
122 class vtkProp3DCollection;
123 class vtkAbstractMapper3D;
124 class vtkDataSet;
126 class vtkProp;
127 
128 class VTKRENDERINGCORE_EXPORT vtkAreaPicker : public vtkAbstractPropPicker
129 {
130 public:
131  static vtkAreaPicker* New();
133  void PrintSelf(ostream& os, vtkIndent indent) override;
134 
138  void SetPickCoords(double x0, double y0, double x1, double y1);
139 
144 
148  virtual int Pick();
149 
155  virtual int AreaPick(double x0, double y0, double x1, double y1, vtkRenderer* renderer = nullptr);
156 
162  int Pick(double x0, double y0, double vtkNotUsed(z0), vtkRenderer* renderer = nullptr) override
163  {
164  return this->AreaPick(x0, y0, x0 + 1.0, y0 + 1.0, renderer);
165  }
166 
168 
171  vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
173 
175 
179  vtkGetObjectMacro(DataSet, vtkDataSet);
181 
186  vtkProp3DCollection* GetProp3Ds() { return this->Prop3Ds; }
187 
189 
194  vtkGetObjectMacro(Frustum, vtkPlanes);
196 
198 
201  vtkGetObjectMacro(ClipPoints, vtkPoints);
203 
204 protected:
206  ~vtkAreaPicker() override;
207 
208  void Initialize() override;
209  void DefineFrustum(double x0, double y0, double x1, double y1, vtkRenderer*);
210  virtual int PickProps(vtkRenderer* renderer);
212 
213  int ABoxFrustumIsect(double bounds[], double& mindist);
214 
217 
218  vtkProp3DCollection* Prop3Ds; // candidate actors (based on bounding box)
219  vtkAbstractMapper3D* Mapper; // selected mapper (if the prop has a mapper)
220  vtkDataSet* DataSet; // selected dataset (if there is one)
221 
222  // used internally to do prop intersection tests
224 
225  double X0;
226  double Y0;
227  double X1;
228  double Y1;
229 
230 private:
231  vtkAreaPicker(const vtkAreaPicker&) = delete;
232  void operator=(const vtkAreaPicker&) = delete;
233 };
234 
235 #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.
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.
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:166
Returns the portion of the input dataset that lies within a selection frustum.
a simple class to control print indentation
Definition: vtkIndent.h:113
implicit function for convex set of planes
Definition: vtkPlanes.h:159
represent and manipulate 3D points
Definition: vtkPoints.h:143
an ordered list of 3D props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:67
abstract specification for renderers
Definition: vtkRenderer.h:173
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:39