1 // SALOME VTKViewer : build VTK viewer into Salome desktop
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : VTKViewer_RectPicker.h
25 // Author : Natalia KOPNOVA
28 #ifndef __VTKViewer_RectPicker_h
29 #define __VTKViewer_RectPicker_h
31 #include <vtkPicker.h>
34 * \brief For more information see <a href="http://www.vtk.org/">VTK documentation
36 /*! \class VTKViewer_RectPicker
37 * \brief Rectangular picker class.
39 class VTK_EXPORT VTKViewer_RectPicker : public vtkPicker
42 /*!Create new instance of VTKViewer_RectPicker.*/
43 static VTKViewer_RectPicker *New();
44 vtkTypeMacro(VTKViewer_RectPicker,vtkPicker);
46 virtual int Pick(float selectionX1, float selectionY1, float selectionZ1,
47 float selectionX2, float selectionY2, float selectionZ2,
48 vtkRenderer *renderer);
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.
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],
61 static char HitBBox(float bounds[6], float origin[4][4], float dir[4][3]);
63 static char PointInside(float point[3], float p1[4][4], float p2[4][4], float tol=0);
66 VTKViewer_RectPicker();
67 ~VTKViewer_RectPicker() {};
69 virtual float IntersectWithHex(float p1[4][4], float p2[4][4], float tol,
70 vtkAssemblyPath *path, vtkProp3D *p,
71 vtkAbstractMapper3D *m);