]> SALOME platform Git repositories - modules/gui.git/blob - src/LightApp/LightApp_VTKSelector.h
Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[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 "SUIT_Selector.h"
23 #include "LightApp.h"
24 #include "LightApp_DataOwner.h"
25
26 #ifndef DISABLE_VTKVIEWER
27   #include <vtkSmartPointer.h>
28   #include <TColStd_IndexedMapOfInteger.hxx>
29   #include "SVTK_Selection.h"
30 #ifndef DISABLE_SALOMEOBJECT
31   #include "SALOME_InteractiveObject.hxx"
32 #endif
33   class SALOME_Actor;
34   class SVTK_ViewModelBase;
35 #endif
36
37 /*!
38   Provide salome vtk data owner list.
39 */
40 class LIGHTAPP_EXPORT LightApp_SVTKDataOwner : public LightApp_DataOwner
41 {
42  public:
43 #ifndef DISABLE_VTKVIEWER
44    #ifndef DISABLE_SALOMEOBJECT
45     LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO,
46                             const TColStd_IndexedMapOfInteger& theIds,
47                             Selection_Mode theMode = ActorSelection,
48                             SALOME_Actor* theActor = NULL);
49    #endif
50     virtual ~LightApp_SVTKDataOwner();
51
52     /*!Gets dataowners ids list.*/
53     const TColStd_IndexedMapOfInteger& GetIds() const
54     {
55       return myIds;
56     }
57
58     /*!Gets selection mode.*/
59     Selection_Mode GetMode() const 
60     { 
61       return mySelectionMode; 
62     }
63
64     SALOME_Actor* GetActor() const;
65
66  protected:
67     TColStd_IndexedMapOfInteger myIds;
68     Selection_Mode mySelectionMode;
69     vtkSmartPointer<SALOME_Actor> myActor;
70 #else
71   LightApp_SVTKDataOwner( const QString& );
72 #endif
73 };
74
75
76 /*!
77   Provide vtk selection of data owners.
78 */
79 class LIGHTAPP_EXPORT LightApp_VTKSelector : public SUIT_Selector
80 {
81   Q_OBJECT;
82
83 public:
84 #ifndef DISABLE_VTKVIEWER
85   LightApp_VTKSelector( SVTK_ViewModelBase*, SUIT_SelectionMgr* );
86   virtual ~LightApp_VTKSelector();
87
88   SVTK_ViewModelBase* viewer() const;
89
90   virtual QString type() const;
91 #else
92   LightApp_VTKSelector( SUIT_SelectionMgr* );
93 #endif
94
95 private slots:
96   void              onSelectionChanged();
97
98 #ifndef DISABLE_VTKVIEWER
99 protected:
100   virtual void      getSelection( SUIT_DataOwnerPtrList& ) const;
101   virtual void      setSelection( const SUIT_DataOwnerPtrList& );
102
103 private:
104   SVTK_ViewModelBase* myViewer;
105
106 #endif
107 };
108
109 #endif