VTK
dox/Rendering/vtkPicker.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkPicker.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 =========================================================================*/
00043 #ifndef __vtkPicker_h
00044 #define __vtkPicker_h
00045 
00046 #include "vtkAbstractPropPicker.h"
00047 
00048 class vtkAbstractMapper3D;
00049 class vtkDataSet;
00050 class vtkTransform;
00051 class vtkActorCollection;
00052 class vtkProp3DCollection;
00053 class vtkPoints;
00054 
00055 class VTK_RENDERING_EXPORT vtkPicker : public vtkAbstractPropPicker
00056 {
00057 public:
00058   static vtkPicker *New();
00059   vtkTypeMacro(vtkPicker,vtkAbstractPropPicker);
00060   void PrintSelf(ostream& os, vtkIndent indent);
00061 
00063 
00066   vtkSetMacro(Tolerance,double);
00067   vtkGetMacro(Tolerance,double);
00069 
00071 
00073   vtkGetVectorMacro(MapperPosition,double,3);
00075 
00077 
00078   vtkGetObjectMacro(Mapper,vtkAbstractMapper3D);
00080 
00082 
00084   vtkGetObjectMacro(DataSet,vtkDataSet);
00086 
00089   vtkProp3DCollection *GetProp3Ds() {return this->Prop3Ds;};
00090 
00094   vtkActorCollection *GetActors();
00095 
00099   vtkPoints *GetPickedPositions() {return this->PickedPositions;};
00100   
00102 
00106   virtual int Pick(double selectionX, double selectionY, double selectionZ, 
00107                    vtkRenderer *renderer);  
00109 
00111 
00115   int Pick(double selectionPt[3], vtkRenderer *ren)
00116     {return this->Pick(selectionPt[0], selectionPt[1], selectionPt[2], ren);};
00118       
00119 protected:
00120   vtkPicker();
00121   ~vtkPicker();
00122 
00123   void MarkPicked(vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m, 
00124                   double tMin, double mapperPos[3]);
00125   virtual double IntersectWithLine(double p1[3], double p2[3], double tol, 
00126                                   vtkAssemblyPath *path, vtkProp3D *p, 
00127                                   vtkAbstractMapper3D *m);
00128   virtual void Initialize();
00129 
00130   double Tolerance;  //tolerance for computation (% of window)
00131   double MapperPosition[3]; //selection point in untransformed coordinates
00132 
00133   vtkAbstractMapper3D *Mapper; //selected mapper (if the prop has a mapper)
00134   vtkDataSet *DataSet; //selected dataset (if there is one)
00135 
00136   double GlobalTMin; //parametric coordinate along pick ray where hit occured
00137   vtkTransform *Transform; //use to perform ray transformation
00138   vtkActorCollection *Actors; //candidate actors (based on bounding box)
00139   vtkProp3DCollection *Prop3Ds; //candidate actors (based on bounding box)
00140   vtkPoints *PickedPositions; // candidate positions
00141   
00142 private:
00143   vtkPicker(const vtkPicker&);  // Not implemented.
00144   void operator=(const vtkPicker&);  // Not implemented.
00145 };
00146 
00147 
00148 #endif
00149 
00150