Back to index

salome-gui  6.5.0
SVTK_RectPicker.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME VTKViewer : build VTK viewer into Salome desktop
00024 //  File   : SVTK_RectPicker.h
00025 //  Author : 
00026 //  Module : SALOME
00027 //
00028 #ifndef __SVTK_RectPicker_h
00029 #define __SVTK_RectPicker_h
00030 
00031 #include "SVTK.h"
00032 #include "VTKViewer.h"
00033 
00034 #include <map>
00035 #include <vector>
00036 
00037 #include <vtkAbstractPropPicker.h>
00038 
00039 class vtkRenderer;
00040 
00041 #ifdef WIN32
00042 #pragma warning ( disable:4251 )
00043 #endif
00044 
00051 class SVTK_EXPORT SVTK_RectPicker : public vtkAbstractPropPicker
00052 {
00053  public:
00054   static
00055   SVTK_RectPicker *New();
00056 
00057   vtkTypeMacro(SVTK_RectPicker,vtkAbstractPropPicker);
00058   
00064   vtkSetMacro(Tolerance,vtkFloatingPointType);
00065   vtkGetMacro(Tolerance,vtkFloatingPointType);
00066 
00068   vtkSetMacro(PickPoints,int);
00069   vtkGetMacro(PickPoints,int);
00070   vtkBooleanMacro(PickPoints,int);
00071 
00072   virtual 
00073   int
00074   Pick(vtkFloatingPointType theSelectionX, 
00075        vtkFloatingPointType theSelectionY, 
00076        vtkFloatingPointType theSelectionZ, 
00077        vtkFloatingPointType theSelectionX2, 
00078        vtkFloatingPointType theSelectionY2, 
00079        vtkFloatingPointType theSelectionZ2,
00080        vtkRenderer *theRenderer);  
00081 
00082   int
00083   Pick(vtkFloatingPointType theSelection[3], 
00084        vtkFloatingPointType theSelection2[3], 
00085        vtkRenderer *theRenderer);
00086 
00087   typedef std::vector<vtkIdType> TVectorIds;
00088   typedef std::map<vtkActor*,TVectorIds> TVectorIdsMap;
00089 
00090   const TVectorIdsMap& 
00091   GetPointIdsMap() const;
00092 
00093   const TVectorIdsMap& 
00094   GetCellIdsMap() const;
00095 
00096  protected:
00097   SVTK_RectPicker();
00098   ~SVTK_RectPicker();
00099 
00101   vtkFloatingPointType Tolerance;
00102 
00104   int PickPoints;
00105 
00107   vtkFloatingPointType SelectionPoint2[3]; 
00108 
00110   vtkFloatingPointType PickPosition2[3]; 
00111 
00112   TVectorIdsMap myPointIdsMap;
00113   TVectorIdsMap myCellIdsMap;
00114 
00115  private:
00116   virtual 
00117   int
00118   Pick(vtkFloatingPointType, 
00119        vtkFloatingPointType, 
00120        vtkFloatingPointType, 
00121        vtkRenderer*);
00122 };
00123 
00124 #ifdef WIN32
00125 #pragma warning ( default:4251 )
00126 #endif
00127 
00128 #endif
00129 
00130