VTK
dox/Rendering/Core/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 =========================================================================*/
00046 #ifndef __vtkPicker_h
00047 #define __vtkPicker_h
00048 
00049 #include "vtkRenderingCoreModule.h" // For export macro
00050 #include "vtkAbstractPropPicker.h"
00051 
00052 class vtkAbstractMapper3D;
00053 class vtkDataSet;
00054 class vtkTransform;
00055 class vtkActorCollection;
00056 class vtkProp3DCollection;
00057 class vtkPoints;
00058 
00059 class VTKRENDERINGCORE_EXPORT vtkPicker : public vtkAbstractPropPicker
00060 {
00061 public:
00062   static vtkPicker *New();
00063   vtkTypeMacro(vtkPicker, vtkAbstractPropPicker);
00064   void PrintSelf(ostream& os, vtkIndent indent);
00065 
00067 
00070   vtkSetMacro(Tolerance, double);
00071   vtkGetMacro(Tolerance, double);
00073 
00075 
00077   vtkGetVectorMacro(MapperPosition, double, 3);
00079 
00081 
00082   vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
00084 
00086 
00088   vtkGetObjectMacro(DataSet, vtkDataSet);
00090 
00092 
00094   vtkProp3DCollection *GetProp3Ds()
00095     { return this->Prop3Ds; }
00097 
00101   vtkActorCollection *GetActors();
00102 
00104 
00107   vtkPoints *GetPickedPositions()
00108     { return this->PickedPositions; }
00110 
00112 
00116   virtual int Pick(double selectionX, double selectionY, double selectionZ,
00117                    vtkRenderer *renderer);
00119 
00121 
00125   int Pick(double selectionPt[3], vtkRenderer *ren)
00126     { return this->Pick(selectionPt[0], selectionPt[1], selectionPt[2], ren); }
00128 
00129 protected:
00130   vtkPicker();
00131   ~vtkPicker();
00132 
00133   void MarkPicked(vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m,
00134                   double tMin, double mapperPos[3]);
00135   virtual double IntersectWithLine(double p1[3], double p2[3], double tol,
00136                                   vtkAssemblyPath *path, vtkProp3D *p,
00137                                   vtkAbstractMapper3D *m);
00138   virtual void Initialize();
00139 
00140   double Tolerance;  //tolerance for computation (% of window)
00141   double MapperPosition[3]; //selection point in untransformed coordinates
00142 
00143   vtkAbstractMapper3D *Mapper; //selected mapper (if the prop has a mapper)
00144   vtkDataSet *DataSet; //selected dataset (if there is one)
00145 
00146   double GlobalTMin; //parametric coordinate along pick ray where hit occurred
00147   vtkTransform *Transform; //use to perform ray transformation
00148   vtkActorCollection *Actors; //candidate actors (based on bounding box)
00149   vtkProp3DCollection *Prop3Ds; //candidate actors (based on bounding box)
00150   vtkPoints *PickedPositions; // candidate positions
00151 
00152 private:
00153   vtkPicker(const vtkPicker&);  // Not implemented.
00154   void operator=(const vtkPicker&);  // Not implemented.
00155 };
00156 
00157 #endif