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 "vtkRenderingCoreModule.h" // For export macro 00053 #include "vtkAbstractPropPicker.h" 00054 00055 class vtkRenderer; 00056 class vtkPoints; 00057 class vtkPlanes; 00058 class vtkProp3DCollection; 00059 class vtkAbstractMapper3D; 00060 class vtkDataSet; 00061 class vtkExtractSelectedFrustum; 00062 class vtkProp; 00063 00064 class VTKRENDERINGCORE_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 00106 00108 vtkProp3DCollection *GetProp3Ds() 00109 { return this->Prop3Ds; } 00111 00113 00116 vtkGetObjectMacro(Frustum, vtkPlanes); 00118 00120 00121 vtkGetObjectMacro(ClipPoints, vtkPoints); 00123 00124 protected: 00125 vtkAreaPicker(); 00126 ~vtkAreaPicker(); 00127 00128 virtual void Initialize(); 00129 void DefineFrustum(double x0, double y0, double x1, double y1, vtkRenderer *); 00130 virtual int PickProps(vtkRenderer *renderer); 00131 int TypeDecipher(vtkProp *, vtkAbstractMapper3D **); 00132 00133 int ABoxFrustumIsect(double bounds[], double &mindist); 00134 00135 vtkPoints *ClipPoints; 00136 vtkPlanes *Frustum; 00137 00138 vtkProp3DCollection *Prop3Ds; //candidate actors (based on bounding box) 00139 vtkAbstractMapper3D *Mapper; //selected mapper (if the prop has a mapper) 00140 vtkDataSet *DataSet; //selected dataset (if there is one) 00141 00142 //used internally to do prop intersection tests 00143 vtkExtractSelectedFrustum *FrustumExtractor; 00144 00145 double X0; 00146 double Y0; 00147 double X1; 00148 double Y1; 00149 00150 private: 00151 vtkAreaPicker(const vtkAreaPicker&); // Not implemented. 00152 void operator=(const vtkAreaPicker&); // Not implemented. 00153 }; 00154 00155 #endif