]> SALOME platform Git repositories - modules/gui.git/blob - src/LightApp/LightApp_VTKSelector.h
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[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/ or email : webmaster.salome@opencascade.com
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    virtual ~LightApp_SVTKDataOwner() {};
47 #ifndef DISABLE_VTKVIEWER
48    #ifndef DISABLE_SALOMEOBJECT
49     LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)&, SUIT_Desktop* );
50    #else
51     LightApp_SVTKDataOwner( const QString& );
52    #endif
53
54     /*!Gets dataowners ids list.*/
55     const TColStd_IndexedMapOfInteger& GetIds() const;
56
57     /*!Gets selection mode.*/
58     Selection_Mode GetMode() const;
59
60     /*!Finds corresponding actor in the active viewer.*/
61     SALOME_Actor* GetActor() const;
62
63  protected:
64     mutable TColStd_IndexedMapOfInteger myIds;
65
66     SVTK_ViewWindow* GetActiveViewWindow() const;
67     SUIT_Desktop* myDesktop;
68 #endif
69 };
70
71
72 /*!
73   \class LightApp_VTKSelector
74   Custom selector to get/set selection from object browser
75 */
76 class LIGHTAPP_EXPORT LightApp_VTKSelector : public SUIT_Selector
77 {
78   Q_OBJECT;
79
80 public:
81   virtual ~LightApp_VTKSelector() {};
82 #ifndef DISABLE_VTKVIEWER
83   LightApp_VTKSelector( SVTK_ViewModelBase*, SUIT_SelectionMgr* );
84
85   SVTK_ViewModelBase* viewer() const;
86
87   virtual QString type() const;
88 #else
89   LightApp_VTKSelector( SUIT_SelectionMgr* );
90 #endif
91
92 private slots:
93   void              onSelectionChanged();
94
95 #ifndef DISABLE_VTKVIEWER
96 protected:
97   virtual void      getSelection( SUIT_DataOwnerPtrList& ) const;
98   virtual void      setSelection( const SUIT_DataOwnerPtrList& );
99
100 private:
101   SVTK_ViewModelBase* myViewer;
102
103 #endif
104 };
105
106 #endif