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
32 #include "VTKViewer.h"
37 #include <vtkAbstractPropPicker.h>
41 /*! \class vtkAbstractPropPicker
42 * \brief For more information see <a href="http://www.vtk.org/">VTK documentation
44 /*! \class SVTK_RectPicker
45 * \brief Rectangular picker class.
47 class SVTK_EXPORT SVTK_RectPicker : public vtkAbstractPropPicker
51 SVTK_RectPicker *New();
53 vtkTypeMacro(SVTK_RectPicker,vtkAbstractPropPicker);
56 Specify tolerance for performing pick operation. Tolerance is specified
57 as fraction of rendering window size. (Rendering window size is measured
60 vtkSetMacro(Tolerance,vtkFloatingPointType);
61 vtkGetMacro(Tolerance,vtkFloatingPointType);
63 //! Use these methods to pick points or points and cells
64 vtkSetMacro(PickPoints,int);
65 vtkGetMacro(PickPoints,int);
66 vtkBooleanMacro(PickPoints,int);
70 Pick(vtkFloatingPointType theSelectionX,
71 vtkFloatingPointType theSelectionY,
72 vtkFloatingPointType theSelectionZ,
73 vtkFloatingPointType theSelectionX2,
74 vtkFloatingPointType theSelectionY2,
75 vtkFloatingPointType theSelectionZ2,
76 vtkRenderer *theRenderer);
79 Pick(vtkFloatingPointType theSelection[3],
80 vtkFloatingPointType theSelection2[3],
81 vtkRenderer *theRenderer);
83 typedef std::vector<vtkIdType> TVectorIds;
84 typedef std::map<vtkActor*,TVectorIds> TVectorIdsMap;
87 GetPointIdsMap() const;
90 GetCellIdsMap() const;
96 //! tolerance for computation (% of window)
97 vtkFloatingPointType Tolerance;
99 //! use the following to control picking mode
102 //! second rectangle selection point in window (pixel) coordinates
103 vtkFloatingPointType SelectionPoint2[3];
105 //! second rectangle selection point in world coordinates
106 vtkFloatingPointType PickPosition2[3];
108 TVectorIdsMap myPointIdsMap;
109 TVectorIdsMap myCellIdsMap;
114 Pick(vtkFloatingPointType,
115 vtkFloatingPointType,
116 vtkFloatingPointType,