Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISUGUI / VisuGUI_Module.h
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : VisuGUI_Module.h
25 //  Author : 
26 //  Module : VISU
27
28 #ifndef VisuGUI_Module_HeaderFile
29 #define VisuGUI_Module_HeaderFile
30
31 #include "VisuGUI.h"
32 #include "STD_Application.h"
33 #include "SALOMEDSClient_SObject.hxx"
34
35 class SUIT_ViewManager;
36 class SVTK_ViewManager;
37 class SVTK_ViewWindow;
38
39 #include "MED_SharedPtr.hxx"
40
41 namespace VISU
42 {
43   class Viewer;
44   typedef MED::SharedPtr<Viewer> PViewer;
45   
46   typedef std::map<SUIT_ViewManager*,PViewer> TViewerMap;
47 }
48
49 //! This class inherits base VisuGUI.
50 /*! Used to display, erase end edit presentations in the VVTK viewer. */
51 class VisuGUI_Module: public VisuGUI
52 {
53   Q_OBJECT;
54
55   friend class VISU::Viewer;
56
57 public:
58   VisuGUI_Module();
59
60   virtual
61   ~VisuGUI_Module();
62
63   virtual
64   bool
65   eventFilter( QObject * theWatched, QEvent * theEvent );
66
67   //! Redifined method of the module initializing.
68   virtual
69   void
70   initialize( CAM_Application* );
71
72   //! Redefined method of creating prefernces.
73   virtual 
74   void 
75   createPreferences();
76
77   virtual
78   void
79   preferencesChanged( const QString&, const QString& );
80
81   virtual
82   SUIT_ViewManager*
83   getViewManager(const QString& theType, 
84                  const bool theIsCreate);
85
86   virtual 
87   void
88   storeVisualParameters(int savePoint);
89   
90   virtual
91   void
92   restoreVisualParameters(int savePoint);
93
94 public slots:
95   //! Reimplemented method of the module deactivation.
96   virtual 
97   bool
98   deactivateModule( SUIT_Study* );
99
100   //! Reimplemented method of the module activation.
101   virtual 
102   bool
103   activateModule( SUIT_Study* );
104
105 protected:
106   //! Create preferences for Gauss Points presentation.
107   virtual 
108   void 
109   createGaussPointsPreferences();
110
111   //! Create preferences for Outside Cursor Gauss Points presentations.
112   virtual 
113   void 
114   createInsideCursorPreferences();
115
116   virtual 
117   void 
118   createOutsideCursorPreferences();
119
120   //! Create preferences for Picking.
121   virtual 
122   void 
123   createPickingPreferences();
124
125   //! Create preferences for Space Mouse.
126   virtual 
127   void 
128   createSpaceMousePreferences();
129
130   //! Create preferences for Recorder.
131   virtual 
132   void 
133   createRecorderPreferences();
134
135 protected slots:
136   SUIT_ViewManager*
137   onCreateViewManager();
138
139   void
140   onLastViewClosed(SUIT_ViewManager*);
141
142   void
143   OnCreateGaussPoints();
144
145   void
146   OnViewCreated(SUIT_ViewWindow*);
147
148   void 
149   OnViewManagerAdded(SUIT_ViewManager*);
150
151   //! Reimplemented method of the Gauss Points edition.
152   virtual
153   void
154   OnEditGaussPoints();
155
156   //! Virtual method of saving configuration.
157   virtual
158   void
159   OnSaveConfiguration();
160
161   //! Virtual method of overwriting configuration.
162   virtual
163   void
164   OnOverwriteConfiguration();
165
166   //! Virtual method of restoring configuration.
167   virtual
168   void
169   OnRestoreConfiguration();
170
171 protected:
172   VISU::TViewerMap myViewerMap;
173   _PTR(SObject) myConfigSObject;
174
175   void setProperty( SVTK_ViewWindow*, const QString& );  // set a property (speed_increment, etc ) for SVTK ViewWindow
176   void setProperty( SVTK_ViewManager*, const QString& ); // set a property for SVTK ViewWindow // set only 1 property for all ViewWindows of given view manager
177 };
178
179 #endif