Salome HOME
Initial version
[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 VTK_EXPORT VTKViewer_RectPicker : public vtkPicker
34 {
35 public:
36   static VTKViewer_RectPicker *New();
37   vtkTypeMacro(VTKViewer_RectPicker,vtkPicker);
38   
39   // Description:
40   // Perform pick operation with selection rectangle provided. Normally the 
41   // first two values for the selection top-left and right-bottom points are 
42   // x-y pixel coordinate, and the third value is =0. 
43   // Return non-zero if something was successfully picked.
44   virtual int Pick(float selectionX1, float selectionY1, float selectionZ1, 
45                    float selectionX2, float selectionY2, float selectionZ2,
46                    vtkRenderer *renderer);  
47
48   // Description: 
49   // Perform pick operation with selection rectangle provided. Normally the first
50   // two values for the selection top-left and right-bottom points are x-y pixel 
51   // coordinate, and the third value is =0. 
52   // Return non-zero if something was successfully picked.
53   int Pick(float selectionPt1[3], float selectionPt2[3], vtkRenderer *ren)
54     {return this->Pick(selectionPt1[0], selectionPt1[1], selectionPt1[2], 
55                        selectionPt2[0], selectionPt2[1], selectionPt2[2],
56                        ren);};
57
58   // Description:
59   // Bounding box intersection with hexahedron. The method returns a non-zero value 
60   // if the bounding box is hit. Origin[4][4] starts the ray from corner points, 
61   // dir[4][3] is the vector components of the ray in the x-y-z directions. 
62   // (Notes: the intersection ray dir[4][3] is NOT normalized.)
63   static char HitBBox(float bounds[6], float origin[4][4], float dir[4][3]);
64
65   // Description:
66   // Position of point relative to hexahedron. The method returns a non-zero value 
67   // if the point is inside. p1[4][4] is the corner points of top face, 
68   // p2[4][4] is the corner points of bottom face. 
69   static char PointInside(float point[3], float p1[4][4], float p2[4][4], float tol=0);
70
71 protected:
72   VTKViewer_RectPicker();
73   ~VTKViewer_RectPicker() {};
74
75   virtual float IntersectWithHex(float p1[4][4], float p2[4][4], float tol, 
76                           vtkAssemblyPath *path, vtkProp3D *p, 
77                           vtkAbstractMapper3D *m);
78
79 private:
80 };
81
82 #endif
83
84