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 =========================================================================*/
49 #ifndef __vtkAreaPicker_h
50 #define __vtkAreaPicker_h
51 
52 #include "vtkAbstractPropPicker.h"
53 
54 class vtkRenderer;
55 class vtkPoints;
56 class vtkPlanes;
59 class vtkDataSet;
61 class vtkProp;
62 
64 {
65 public:
66  static vtkAreaPicker *New();
68  void PrintSelf(ostream& os, vtkIndent indent);
69 
71  void SetPickCoords(double x0, double y0, double x1, double y1);
72 
74  void SetRenderer(vtkRenderer *);
75 
77  virtual int Pick();
78 
83  virtual int AreaPick(double x0, double y0, double x1, double y1, vtkRenderer *renderer = NULL);
84 
86 
89  virtual int Pick(double x0, double y0, double vtkNotUsed(z0), vtkRenderer *renderer = NULL)
90  {return this->AreaPick(x0, y0, x0+1.0, y0+1.0, renderer);};
92 
94 
95  vtkGetObjectMacro(Mapper,vtkAbstractMapper3D);
97 
99 
101  vtkGetObjectMacro(DataSet,vtkDataSet);
103 
106  vtkProp3DCollection *GetProp3Ds() {return this->Prop3Ds;};
107 
109 
112  vtkGetObjectMacro(Frustum, vtkPlanes);
114 
116 
117  vtkGetObjectMacro(ClipPoints, vtkPoints);
119 
120 protected:
121  vtkAreaPicker();
122  ~vtkAreaPicker();
123 
124  virtual void Initialize();
125  void DefineFrustum(double x0, double y0, double x1, double y1, vtkRenderer *renderer);
126  virtual int PickProps(vtkRenderer *renderer);
127  int TypeDecipher(vtkProp *, vtkAbstractMapper3D **);
128 
129  int ABoxFrustumIsect(double bounds[], double &mindist);
130 
133 
134  vtkProp3DCollection *Prop3Ds; //candidate actors (based on bounding box)
135  vtkAbstractMapper3D *Mapper; //selected mapper (if the prop has a mapper)
136  vtkDataSet *DataSet; //selected dataset (if there is one)
137 
138  //used internally to do prop intersection tests
140 
141  double X0;
142  double Y0;
143  double X1;
144  double Y1;
145 
146 private:
147  vtkAreaPicker(const vtkAreaPicker&); // Not implemented.
148  void operator=(const vtkAreaPicker&); // Not implemented.
149 };
150 
151 #endif
152 
153