Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00056 #ifndef __vtkPicker_h
00057 #define __vtkPicker_h
00058 
00059 #include "vtkAbstractPropPicker.h"
00060 
00061 class vtkAbstractMapper3D;
00062 class vtkDataSet;
00063 class vtkTransform;
00064 class vtkActorCollection;
00065 class vtkProp3DCollection;
00066 class vtkPoints;
00067 
00068 class VTK_RENDERING_EXPORT vtkPicker : public vtkAbstractPropPicker
00069 {
00070 public:
00071   static vtkPicker *New();
00072   vtkTypeRevisionMacro(vtkPicker,vtkAbstractPropPicker);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074 
00076 
00079   vtkSetMacro(Tolerance,float);
00080   vtkGetMacro(Tolerance,float);
00082 
00084 
00086   vtkGetVectorMacro(MapperPosition,float,3);
00088 
00090 
00091   vtkGetObjectMacro(Mapper,vtkAbstractMapper3D);
00093 
00095 
00097   vtkGetObjectMacro(DataSet,vtkDataSet);
00099 
00102   vtkProp3DCollection *GetProp3Ds() {return this->Prop3Ds;};
00103 
00107   vtkActorCollection *GetActors();
00108 
00112   vtkPoints *GetPickedPositions() {return this->PickedPositions;};
00113   
00115 
00119   virtual int Pick(float selectionX, float selectionY, float selectionZ, 
00120                    vtkRenderer *renderer);  
00122 
00124 
00128   int Pick(float selectionPt[3], vtkRenderer *ren)
00129     {return this->Pick(selectionPt[0], selectionPt[1], selectionPt[2], ren);};
00131       
00132 protected:
00133   vtkPicker();
00134   ~vtkPicker();
00135 
00136   void MarkPicked(vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m, 
00137                   float tMin, float mapperPos[3]);
00138   virtual float IntersectWithLine(float p1[3], float p2[3], float tol, 
00139                                   vtkAssemblyPath *path, vtkProp3D *p, 
00140                                   vtkAbstractMapper3D *m);
00141   virtual void Initialize();
00142 
00143   float Tolerance; //tolerance for computation (% of window)
00144   float MapperPosition[3]; //selection point in untransformed coordinates
00145 
00146   vtkAbstractMapper3D *Mapper; //selected mapper (if the prop has a mapper)
00147   vtkDataSet *DataSet; //selected dataset (if there is one)
00148 
00149   float GlobalTMin; //parametric coordinate along pick ray where hit occured
00150   vtkTransform *Transform; //use to perform ray transformation
00151   vtkActorCollection *Actors; //candidate actors (based on bounding box)
00152   vtkProp3DCollection *Prop3Ds; //candidate actors (based on bounding box)
00153   vtkPoints *PickedPositions; // candidate positions
00154   
00155 private:
00156   vtkPicker(const vtkPicker&);  // Not implemented.
00157   void operator=(const vtkPicker&);  // Not implemented.
00158 };
00159 
00160 
00161 #endif
00162 
00163