VTK  9.2.6
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 =========================================================================*/
50 #ifndef vtkAreaPicker_h
51 #define vtkAreaPicker_h
52 
53 #include "vtkAbstractPropPicker.h"
54 #include "vtkRenderingCoreModule.h" // For export macro
55 
56 class vtkRenderer;
57 class vtkPoints;
58 class vtkPlanes;
61 class vtkDataSet;
63 class vtkProp;
64 
65 class VTKRENDERINGCORE_EXPORT vtkAreaPicker : public vtkAbstractPropPicker
66 {
67 public:
68  static vtkAreaPicker* New();
70  void PrintSelf(ostream& os, vtkIndent indent) override;
71 
75  void SetPickCoords(double x0, double y0, double x1, double y1);
76 
80  void SetRenderer(vtkRenderer*);
81 
85  virtual int Pick();
86 
92  virtual int AreaPick(double x0, double y0, double x1, double y1, vtkRenderer* renderer = nullptr);
93 
99  int Pick(double x0, double y0, double vtkNotUsed(z0), vtkRenderer* renderer = nullptr) override
100  {
101  return this->AreaPick(x0, y0, x0 + 1.0, y0 + 1.0, renderer);
102  }
103 
105 
108  vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
110 
112 
116  vtkGetObjectMacro(DataSet, vtkDataSet);
118 
123  vtkProp3DCollection* GetProp3Ds() { return this->Prop3Ds; }
124 
126 
131  vtkGetObjectMacro(Frustum, vtkPlanes);
133 
135 
138  vtkGetObjectMacro(ClipPoints, vtkPoints);
140 
141 protected:
142  vtkAreaPicker();
143  ~vtkAreaPicker() override;
144 
145  void Initialize() override;
146  void DefineFrustum(double x0, double y0, double x1, double y1, vtkRenderer*);
147  virtual int PickProps(vtkRenderer* renderer);
148  int TypeDecipher(vtkProp*, vtkAbstractMapper3D**);
149 
150  int ABoxFrustumIsect(double bounds[], double& mindist);
151 
154 
155  vtkProp3DCollection* Prop3Ds; // candidate actors (based on bounding box)
156  vtkAbstractMapper3D* Mapper; // selected mapper (if the prop has a mapper)
157  vtkDataSet* DataSet; // selected dataset (if there is one)
158 
159  // used internally to do prop intersection tests
161 
162  double X0;
163  double Y0;
164  double X1;
165  double Y1;
166 
167 private:
168  vtkAreaPicker(const vtkAreaPicker&) = delete;
169  void operator=(const vtkAreaPicker&) = delete;
170 };
171 
172 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
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:62
vtkProp3DCollection * Prop3Ds
implicit function for convex set of planes
Definition: vtkPlanes.h:52
abstract specification for renderers
Definition: vtkRenderer.h:72
void Initialize() override
vtkPlanes * Frustum
a simple class to control print indentation
Definition: vtkIndent.h:39
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:39
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:99
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:65
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:39