Salome HOME
Merge from OCC_development_generic_2006
[modules/gui.git] / src / LightApp / LightApp_VTKSelector.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/
18 //
19 #ifndef LIGHTAPP_VTKSELECTOR_H
20 #define LIGHTAPP_VTKSELECTOR_H
21
22 #include <vtkSmartPointer.h>
23
24 #include <TColStd_IndexedMapOfInteger.hxx>
25
26 #include "SUIT_Selector.h"
27
28 #include "LightApp.h"
29 #include "LightApp_DataOwner.h"
30
31 #include "SVTK_Selection.h"
32 #include "SALOME_InteractiveObject.hxx"
33
34 class SALOME_Actor;
35 class SVTK_ViewModelBase;
36
37 /*!
38   Provide salome vtk data owner list.
39 */
40 class LIGHTAPP_EXPORT LightApp_SVTKDataOwner : public LightApp_DataOwner
41 {
42  public:
43     LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO,
44                             const TColStd_IndexedMapOfInteger& theIds,
45                             Selection_Mode theMode = ActorSelection,
46                             SALOME_Actor* theActor = NULL);
47     virtual ~LightApp_SVTKDataOwner();
48
49     /*!Gets dataowners ids list.*/
50     const TColStd_IndexedMapOfInteger& GetIds() const
51     {
52       return myIds;
53     }
54
55     /*!Gets selection mode.*/
56     Selection_Mode GetMode() const 
57     { 
58       return mySelectionMode; 
59     }
60
61     SALOME_Actor* GetActor() const;
62
63  protected:
64     TColStd_IndexedMapOfInteger myIds;
65     Selection_Mode mySelectionMode;
66     vtkSmartPointer<SALOME_Actor> myActor;
67 };
68
69
70 /*!
71   Provide vtk selection of data owners.
72 */
73 class LIGHTAPP_EXPORT LightApp_VTKSelector : public SUIT_Selector
74 {
75   Q_OBJECT;
76
77 public:
78   LightApp_VTKSelector( SVTK_ViewModelBase*, SUIT_SelectionMgr* );
79   virtual ~LightApp_VTKSelector();
80
81   SVTK_ViewModelBase* viewer() const;
82
83   virtual QString type() const;
84
85 private slots:
86   void              onSelectionChanged();
87
88 protected:
89   virtual void      getSelection( SUIT_DataOwnerPtrList& ) const;
90   virtual void      setSelection( const SUIT_DataOwnerPtrList& );
91
92 private:
93   SVTK_ViewModelBase* myViewer;
94 };
95
96 #endif