VTK
dox/Rendering/vtkAreaPicker.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkAreaPicker.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00049 #ifndef __vtkAreaPicker_h
00050 #define __vtkAreaPicker_h
00051 
00052 #include "vtkAbstractPropPicker.h"
00053 
00054 class vtkRenderer;
00055 class vtkPoints;
00056 class vtkPlanes;
00057 class vtkProp3DCollection;
00058 class vtkAbstractMapper3D;
00059 class vtkDataSet;
00060 class vtkExtractSelectedFrustum;
00061 class vtkProp;
00062 
00063 class VTK_RENDERING_EXPORT vtkAreaPicker : public vtkAbstractPropPicker
00064 {
00065 public:
00066   static vtkAreaPicker *New();
00067   vtkTypeMacro(vtkAreaPicker,vtkAbstractPropPicker);
00068   void PrintSelf(ostream& os, vtkIndent indent);
00069 
00071   void SetPickCoords(double x0, double y0, double x1, double y1);
00072   
00074   void SetRenderer(vtkRenderer *);
00075 
00077   virtual int Pick();
00078 
00083   virtual int AreaPick(double x0, double y0, double x1, double y1, vtkRenderer *renderer = NULL);
00084 
00086 
00089   virtual int Pick(double x0, double y0, double vtkNotUsed(z0), vtkRenderer *renderer = NULL)
00090     {return this->AreaPick(x0, y0, x0+1.0, y0+1.0, renderer);};
00092 
00094 
00095   vtkGetObjectMacro(Mapper,vtkAbstractMapper3D);
00097 
00099 
00101   vtkGetObjectMacro(DataSet,vtkDataSet);
00103 
00106   vtkProp3DCollection *GetProp3Ds() {return this->Prop3Ds;};
00107 
00109 
00112   vtkGetObjectMacro(Frustum, vtkPlanes);
00114 
00116 
00117   vtkGetObjectMacro(ClipPoints, vtkPoints);
00119 
00120 protected:
00121   vtkAreaPicker();
00122   ~vtkAreaPicker();
00123 
00124   virtual void Initialize();
00125   void DefineFrustum(double x0, double y0, double x1, double y1, vtkRenderer *renderer);
00126   virtual int PickProps(vtkRenderer *renderer);  
00127   int TypeDecipher(vtkProp *, vtkAbstractMapper3D **);
00128 
00129   int ABoxFrustumIsect(double bounds[], double &mindist);
00130 
00131   vtkPoints *ClipPoints;
00132   vtkPlanes *Frustum;
00133 
00134   vtkProp3DCollection *Prop3Ds; //candidate actors (based on bounding box)
00135   vtkAbstractMapper3D *Mapper; //selected mapper (if the prop has a mapper)
00136   vtkDataSet *DataSet; //selected dataset (if there is one)
00137 
00138   //used internally to do prop intersection tests
00139   vtkExtractSelectedFrustum *FrustumExtractor;
00140 
00141   double X0;
00142   double Y0;
00143   double X1;
00144   double Y1;
00145 
00146 private:
00147   vtkAreaPicker(const vtkAreaPicker&);  // Not implemented.
00148   void operator=(const vtkAreaPicker&);  // Not implemented.
00149 };
00150 
00151 #endif
00152 
00153