VTK
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 =========================================================================*/
44 #ifndef vtkAreaPicker_h
45 #define vtkAreaPicker_h
46 
47 #include "vtkRenderingCoreModule.h" // For export macro
48 #include "vtkAbstractPropPicker.h"
49 
50 class vtkRenderer;
51 class vtkPoints;
52 class vtkPlanes;
55 class vtkDataSet;
57 class vtkProp;
58 
59 class VTKRENDERINGCORE_EXPORT vtkAreaPicker : public vtkAbstractPropPicker
60 {
61 public:
62  static vtkAreaPicker *New();
64  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
65 
69  void SetPickCoords(double x0, double y0, double x1, double y1);
70 
74  void SetRenderer(vtkRenderer *);
75 
79  virtual int Pick();
80 
86  virtual int AreaPick(double x0, double y0, double x1, double y1, vtkRenderer *renderer = NULL);
87 
93  int Pick(double x0, double y0, double vtkNotUsed(z0), vtkRenderer *renderer = NULL) VTK_OVERRIDE
94  { return this->AreaPick(x0, y0, x0+1.0, y0+1.0, renderer); }
95 
97 
100  vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
102 
104 
108  vtkGetObjectMacro(DataSet, vtkDataSet);
110 
116  { return this->Prop3Ds; }
117 
119 
124  vtkGetObjectMacro(Frustum, vtkPlanes);
126 
128 
131  vtkGetObjectMacro(ClipPoints, vtkPoints);
133 
134 protected:
135  vtkAreaPicker();
136  ~vtkAreaPicker() VTK_OVERRIDE;
137 
138  void Initialize() VTK_OVERRIDE;
139  void DefineFrustum(double x0, double y0, double x1, double y1, vtkRenderer *);
140  virtual int PickProps(vtkRenderer *renderer);
141  int TypeDecipher(vtkProp *, vtkAbstractMapper3D **);
142 
143  int ABoxFrustumIsect(double bounds[], double &mindist);
144 
147 
148  vtkProp3DCollection *Prop3Ds; //candidate actors (based on bounding box)
149  vtkAbstractMapper3D *Mapper; //selected mapper (if the prop has a mapper)
150  vtkDataSet *DataSet; //selected dataset (if there is one)
151 
152  //used internally to do prop intersection tests
154 
155  double X0;
156  double Y0;
157  double X1;
158  double Y1;
159 
160 private:
161  vtkAreaPicker(const vtkAreaPicker&) VTK_DELETE_FUNCTION;
162  void operator=(const vtkAreaPicker&) VTK_DELETE_FUNCTION;
163 };
164 
165 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
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
implicit function for convex set of planes
Definition: vtkPlanes.h:48
abstract specification for renderers
Definition: vtkRenderer.h:57
void Initialize() override
vtkPlanes * Frustum
a simple class to control print indentation
Definition: vtkIndent.h:33
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int Pick(double x0, double y0, double vtkNotUsed(z0), vtkRenderer *renderer=NULL) override
Perform pick operation in volume behind the given screen coordinate.
Definition: vtkAreaPicker.h:93
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:59
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:33