1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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, or (at your option) any later version.
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SALOME VTKViewer : build VTK viewer into Salome desktop
24 // File : SVTK_AreaPicker.h
28 #ifndef __SVTK_AreaPicker_h
29 #define __SVTK_AreaPicker_h
32 #include "VTKViewer.h"
37 #include <vtkAbstractPropPicker.h>
38 #include <vtkDataSet.h>
45 #pragma warning ( disable:4251 )
48 /*! \class vtkAbstractPropPicker
49 * \brief For more information see <a href="http://www.vtk.org/">VTK documentation
51 /*! \class SVTK_AreaPicker
52 * \brief Rectangular picker class.
54 class SVTK_EXPORT SVTK_AreaPicker : public vtkAbstractPropPicker
58 enum SelectionMode { RectangleMode, PolygonMode };
61 SVTK_AreaPicker *New();
63 vtkTypeMacro(SVTK_AreaPicker,vtkAbstractPropPicker);
66 Specify tolerance for performing pick operation. Tolerance is specified
67 as fraction of rendering window size. (Rendering window size is measured
70 vtkSetMacro(Tolerance,double);
71 vtkGetMacro(Tolerance,double);
73 //! Use these methods to pick points or points and cells
74 vtkSetMacro(PickPoints,int);
75 vtkGetMacro(PickPoints,int);
76 vtkBooleanMacro(PickPoints,int);
79 Pick( QVector<QPoint>& thePoints,
80 vtkRenderer *theRenderer,
81 SelectionMode theMode );
84 Pick( double theSelectionX,
86 double theSelectionX2,
87 double theSelectionY2,
88 vtkRenderer *theRenderer,
89 SelectionMode theMode );
92 isPointInPolygon( const QPoint& thePoint,const QVector<QPoint>& thePolygon );
94 typedef std::vector<vtkIdType> TVectorIds;
95 typedef std::map<vtkActor*,TVectorIds> TVectorIdsMap;
98 GetPointIdsMap() const;
101 GetCellIdsMap() const;
107 //! tolerance for computation (% of window)
110 //! use the following to control picking mode
113 //! coordinates of bounding box of selection
116 TVectorIdsMap myPointIdsMap;
117 TVectorIdsMap myCellIdsMap;
128 SelectVisiblePoints( QVector<QPoint>& thePoints,
129 vtkRenderer *theRenderer,
130 vtkDataSet *theInput,
131 SVTK_AreaPicker::TVectorIds& theVisibleIds,
132 SVTK_AreaPicker::TVectorIds& theInVisibleIds,
134 SelectionMode theMode );
136 SelectVisibleCells( QVector<QPoint>& thePoints,
137 vtkRenderer *theRenderer,
138 vtkDataSet *theInput,
139 SVTK_AreaPicker::TVectorIds& theVectorIds,
141 SelectionMode theMode );
145 #pragma warning ( default:4251 )