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