VTK
|
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 class vtkImageActor; 00063 00064 class VTK_RENDERING_EXPORT vtkAreaPicker : public vtkAbstractPropPicker 00065 { 00066 public: 00067 static vtkAreaPicker *New(); 00068 vtkTypeMacro(vtkAreaPicker,vtkAbstractPropPicker); 00069 void PrintSelf(ostream& os, vtkIndent indent); 00070 00072 void SetPickCoords(double x0, double y0, double x1, double y1); 00073 00075 void SetRenderer(vtkRenderer *); 00076 00078 virtual int Pick(); 00079 00084 virtual int AreaPick(double x0, double y0, double x1, double y1, vtkRenderer *renderer = NULL); 00085 00087 00090 virtual int Pick(double x0, double y0, double vtkNotUsed(z0), vtkRenderer *renderer = NULL) 00091 {return this->AreaPick(x0, y0, x0+1.0, y0+1.0, renderer);}; 00093 00095 00096 vtkGetObjectMacro(Mapper,vtkAbstractMapper3D); 00098 00100 00102 vtkGetObjectMacro(DataSet,vtkDataSet); 00104 00107 vtkProp3DCollection *GetProp3Ds() {return this->Prop3Ds;}; 00108 00110 00113 vtkGetObjectMacro(Frustum, vtkPlanes); 00115 00117 00118 vtkGetObjectMacro(ClipPoints, vtkPoints); 00120 00121 protected: 00122 vtkAreaPicker(); 00123 ~vtkAreaPicker(); 00124 00125 virtual void Initialize(); 00126 void DefineFrustum(double x0, double y0, double x1, double y1, vtkRenderer *renderer); 00127 virtual int PickProps(vtkRenderer *renderer); 00128 int TypeDecipher(vtkProp *, vtkImageActor **, vtkAbstractMapper3D **); 00129 00130 int ABoxFrustumIsect(double bounds[], double &mindist); 00131 00132 vtkPoints *ClipPoints; 00133 vtkPlanes *Frustum; 00134 00135 vtkProp3DCollection *Prop3Ds; //candidate actors (based on bounding box) 00136 vtkAbstractMapper3D *Mapper; //selected mapper (if the prop has a mapper) 00137 vtkDataSet *DataSet; //selected dataset (if there is one) 00138 00139 //used internally to do prop intersection tests 00140 vtkExtractSelectedFrustum *FrustumExtractor; 00141 00142 double X0; 00143 double Y0; 00144 double X1; 00145 double Y1; 00146 00147 private: 00148 vtkAreaPicker(const vtkAreaPicker&); // Not implemented. 00149 void operator=(const vtkAreaPicker&); // Not implemented. 00150 }; 00151 00152 #endif 00153 00154