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 : SVTK_RectPicker.h
28 #ifndef __SVTK_RectPicker_h
29 #define __SVTK_RectPicker_h
36 #include <vtkAbstractPropPicker.h>
40 /*! \class vtkAbstractPropPicker
41 * \brief For more information see <a href="http://www.vtk.org/">VTK documentation
43 /*! \class VTKViewer_RectPicker
44 * \brief Rectangular picker class.
46 class SVTK_EXPORT SVTK_RectPicker : public vtkAbstractPropPicker
50 SVTK_RectPicker *New();
52 vtkTypeMacro(SVTK_RectPicker,vtkAbstractPropPicker);
55 Specify tolerance for performing pick operation. Tolerance is specified
56 as fraction of rendering window size. (Rendering window size is measured
59 vtkSetMacro(Tolerance,float);
60 vtkGetMacro(Tolerance,float);
62 //! Use these methods to pick points or points and cells
63 vtkSetMacro(PickPoints,int);
64 vtkGetMacro(PickPoints,int);
65 vtkBooleanMacro(PickPoints,int);
69 Pick(float theSelectionX, float theSelectionY, float theSelectionZ,
70 float theSelectionX2, float theSelectionY2, float theSelectionZ2,
71 vtkRenderer *theRenderer);
74 Pick(float theSelection[3], float theSelection2[3], vtkRenderer *theRenderer);
76 typedef std::vector<vtkIdType> TVectorIds;
77 typedef std::map<vtkActor*,TVectorIds> TVectorIdsMap;
80 GetPointIdsMap() const;
83 GetCellIdsMap() const;
89 //! tolerance for computation (% of window)
92 //! use the following to control picking mode
95 //! second rectangle selection point in window (pixel) coordinates
96 float SelectionPoint2[3];
98 //! second rectangle selection point in world coordinates
99 float PickPosition2[3];
101 TVectorIdsMap myPointIdsMap;
102 TVectorIdsMap myCellIdsMap;
107 Pick(float, float, float, vtkRenderer*);