Salome HOME
c6d90cbd50febb48dac8500a75150dc2a91b666e
[modules/gui.git] / src / VTKViewer / VTKViewer_RectPicker.h
1 //  SALOME VTKViewer : build VTK viewer into Salome desktop
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : VTKViewer_RectPicker.h
25 //  Author : Natalia KOPNOVA
26 //  Module : SALOME
27
28 #ifndef __VTKViewer_RectPicker_h
29 #define __VTKViewer_RectPicker_h
30
31 #include <vtkPicker.h>
32
33 /*! \class vtkPicker
34  * \brief For more information see <a href="http://www.vtk.org/">VTK documentation
35  */
36 /*! \class VTKViewer_RectPicker
37  * \brief Rectangular picker class.
38  */
39 class VTK_EXPORT VTKViewer_RectPicker : public vtkPicker
40 {
41 public:
42   /*!Create new instance of VTKViewer_RectPicker.*/
43   static VTKViewer_RectPicker *New();
44   vtkTypeMacro(VTKViewer_RectPicker,vtkPicker);
45   
46   virtual int Pick(float selectionX1, float selectionY1, float selectionZ1, 
47                    float selectionX2, float selectionY2, float selectionZ2,
48                    vtkRenderer *renderer);  
49
50   /*!
51    * Perform pick operation with selection rectangle provided. Normally the first
52    * two values for the selection top-left and right-bottom points are x-y pixel 
53    * coordinate, and the third value is =0. 
54    * \retval Return non-zero if something was successfully picked.
55    */
56   int Pick(float selectionPt1[3], float selectionPt2[3], vtkRenderer *ren)
57     {return this->Pick(selectionPt1[0], selectionPt1[1], selectionPt1[2], 
58                        selectionPt2[0], selectionPt2[1], selectionPt2[2],
59                        ren);};
60
61   static char HitBBox(float bounds[6], float origin[4][4], float dir[4][3]);
62
63   static char PointInside(float point[3], float p1[4][4], float p2[4][4], float tol=0);
64
65 protected:
66   VTKViewer_RectPicker();
67   ~VTKViewer_RectPicker() {};
68
69   virtual float IntersectWithHex(float p1[4][4], float p2[4][4], float tol, 
70                                  vtkAssemblyPath *path, vtkProp3D *p, 
71                                  vtkAbstractMapper3D *m);
72
73 private:
74 };
75
76 #endif
77
78