Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Rendering/vtkPicker.h

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