]> SALOME platform Git repositories - modules/gui.git/blob - src/LightApp/LightApp_VTKSelector.h
Salome HOME
a9cc2b47591371218faef4fe2a17e4893be9fe54
[modules/gui.git] / src / LightApp / LightApp_VTKSelector.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef LIGHTAPP_VTKSELECTOR_H
23 #define LIGHTAPP_VTKSELECTOR_H
24
25 #include "SUIT_Selector.h"
26 #include "LightApp.h"
27 #include "LightApp_DataOwner.h"
28
29 #include <QObject>
30
31 class SUIT_Desktop;
32
33 #ifndef DISABLE_VTKVIEWER
34   #include <TColStd_IndexedMapOfInteger.hxx>
35   #include "SVTK_Selection.h"
36 #ifndef DISABLE_SALOMEOBJECT
37   #include "SALOME_InteractiveObject.hxx"
38 #endif
39   class SALOME_Actor;
40   class SVTK_ViewWindow;
41   class SVTK_ViewModelBase;
42 #endif
43
44 /*!
45   Provide salome vtk data owner list.
46 */
47 class LIGHTAPP_EXPORT LightApp_SVTKDataOwner : public LightApp_DataOwner
48 {
49  public:
50    virtual ~LightApp_SVTKDataOwner() {};
51 #ifndef DISABLE_VTKVIEWER
52    #ifndef DISABLE_SALOMEOBJECT
53     LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)&, SUIT_Desktop* );
54    #else
55     LightApp_SVTKDataOwner( const QString& );
56    #endif
57
58     /*!Gets dataowners ids list.*/
59     const TColStd_IndexedMapOfInteger& GetIds() const;
60
61     /*!Gets selection mode.*/
62     Selection_Mode GetMode() const;
63
64     /*!Finds corresponding actor in the active viewer.*/
65     SALOME_Actor* GetActor() const;
66
67  protected:
68     mutable TColStd_IndexedMapOfInteger myIds;
69
70     SVTK_ViewWindow* GetActiveViewWindow() const;
71     SUIT_Desktop* myDesktop;
72 #endif
73 };
74
75
76 /*!
77   \class LightApp_VTKSelector
78   Custom selector to get/set selection from object browser
79 */
80 class LIGHTAPP_EXPORT LightApp_VTKSelector : public QObject, public SUIT_Selector
81 {
82   Q_OBJECT;
83
84 public:
85   virtual ~LightApp_VTKSelector() {};
86 #ifndef DISABLE_VTKVIEWER
87   LightApp_VTKSelector( SVTK_ViewModelBase*, SUIT_SelectionMgr* );
88
89   SVTK_ViewModelBase* viewer() const;
90
91   virtual QString type() const;
92 #else
93   LightApp_VTKSelector( SUIT_SelectionMgr* );
94 #endif
95
96 private slots:
97   void              onSelectionChanged();
98
99 #ifndef DISABLE_VTKVIEWER
100 protected:
101   virtual void      getSelection( SUIT_DataOwnerPtrList& ) const;
102   virtual void      setSelection( const SUIT_DataOwnerPtrList& );
103
104 private:
105   SVTK_ViewModelBase* myViewer;
106
107 #endif
108 };
109
110 #endif