]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMGUI/GeometryGUI.h
Salome HOME
Mantis issue 0020853: EDF 1394 GEOM: Partition fails between 2 faces. A patch by...
[modules/geom.git] / src / GEOMGUI / GeometryGUI.h
1 //  Copyright (C) 2007-2010  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
23 // GEOM GEOMGUI : GUI for Geometry component
24 // File   : GeometryGUI.h
25 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
26 //
27 #ifndef GEOMETRYGUI_H
28 #define GEOMETRYGUI_H
29
30 #include "GEOM_GEOMGUI.hxx"
31
32 #include <SalomeApp_Module.h>
33
34 #include <GEOM_Client.hxx>
35 #include <SALOME_InteractiveObject.hxx>
36 #include <SALOMEDSClient.hxx>
37
38 #include "GEOMGUI.h"
39
40 // QT Includes
41 #include <QMap>
42
43 // OCCT Includes
44 #include <gp_Ax3.hxx>
45 #include <Graphic3d_HArray1OfBytes.hxx>
46
47 // IDL headers
48 #include "SALOMEconfig.h"
49 #include CORBA_CLIENT_HEADER(SALOMEDS)
50
51 // minimum allowed value for deflection coefficient
52 #define DEFLECTION_MIN 1e-06
53
54 class QDialog;
55 class QMenu;
56 class GEOMGUI_OCCSelector;
57 class LightApp_VTKSelector;
58 class LightApp_Selection;
59 class SUIT_ViewManager;
60 class SalomeApp_Study;
61
62 //=================================================================================
63 // class    : GeometryGUI
64 // purpose  :
65 //=================================================================================
66 class  GEOMGUI_EXPORT GeometryGUI : public SalomeApp_Module
67 {
68   Q_OBJECT;
69
70 public:
71   // Constructor
72   GeometryGUI();
73
74   // Destructor
75   ~GeometryGUI();
76
77   virtual LightApp_Displayer* displayer();
78   virtual void                initialize( CAM_Application* );
79   virtual QString             engineIOR() const;
80
81   static Handle(Graphic3d_HArray1OfBytes) getTexture( SalomeApp_Study*, int, int&, int& );
82
83   static bool                 InitGeomGen();
84
85   static  GEOM::GEOM_Gen_var  GetGeomGen();
86
87   static CORBA::Object_var    ClientSObjectToObject (_PTR(SObject) theSObject);
88   static SALOMEDS::Study_var  ClientStudyToStudy (_PTR(Study) theStudy);
89
90   GEOM_Client&                GetShapeReader()    { return myShapeReader; }
91
92   // Get active dialog box
93   QDialog*                    GetActiveDialogBox(){ return myActiveDialogBox; }
94   // Set active dialog box
95   void                        SetActiveDialogBox( QDialog* aDlg );
96
97   // Non modal dialog boxes management
98   void                        EmitSignalDeactivateDialog();
99   void                        EmitSignalCloseAllDialogs();
100   void                        EmitSignalDefaultStepValueChanged( double newVal );
101
102   // Process action
103   void                        OnGUIEvent( int id );
104
105   // The Working Plane management
106   void                        SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp;   }
107   gp_Ax3                      GetWorkingPlane()            { return myWorkingPlane; }
108   void                        ActiveWorkingPlane();
109
110   virtual void                windows( QMap<int, int>& ) const;
111   virtual void                viewManagers( QStringList& ) const;
112
113   virtual void                contextMenuPopup( const QString&, QMenu*, QString& );
114   virtual void                createPreferences();
115   virtual void                preferencesChanged( const QString&, const QString& );
116   int                         getLocalSelectionMode() const;
117   void                        setLocalSelectionMode(const int mode);
118
119   virtual void storeVisualParameters  (int savePoint);
120   virtual void restoreVisualParameters(int savePoint);
121
122 public slots:
123   virtual bool                deactivateModule( SUIT_Study* );
124   virtual bool                activateModule( SUIT_Study* );
125   virtual void                OnKeyPress  ( SUIT_ViewWindow*, QKeyEvent*   );
126   virtual void                OnMousePress( SUIT_ViewWindow*, QMouseEvent* );
127   virtual void                OnMouseMove ( SUIT_ViewWindow*, QMouseEvent* );
128
129 protected slots:
130   virtual void                onViewManagerAdded( SUIT_ViewManager* );
131   virtual void                onViewManagerRemoved( SUIT_ViewManager* );
132
133 private slots:
134   void                        OnGUIEvent();
135   void                        onWindowActivated( SUIT_ViewWindow* );
136   void                        onViewAboutToShow();
137
138 signals :
139   void                        SignalDeactivateActiveDialog();
140   void                        SignalCloseAllDialogs();
141   void                        SignalDefaultStepValueChanged( double newVal );
142
143 protected:
144   virtual LightApp_Selection* createSelection() const;
145
146 private:
147   GEOMGUI*                    getLibrary( const QString& libraryName );
148   void                        createGeomAction( const int id, const QString& po_id,
149                                                 const QString& icon_id = QString(""),
150                                                 const int key = 0, const bool toggle = false );
151   void                        createPopupItem( const int, const QString& clients, const QString& types,
152                                                const bool isSingle = false, const int isVisible = -1,
153                                                const bool isExpandAll = false, const bool isOCC = false,
154                                                const int parentId = -1 );
155
156 public:
157   static GEOM::GEOM_Gen_var   myComponentGeom;   // GEOM engine!!!
158
159 private:  
160
161   typedef QMap<long, Handle(Graphic3d_HArray1OfBytes)> TextureMap;
162   typedef QMap<long, TextureMap> StudyTextureMap;
163   typedef QMap<QString, GEOMGUI*> GUIMap;
164
165   GUIMap                      myGUIMap;          // GUI libraries map
166   QDialog*                    myActiveDialogBox; // active dialog box
167   GEOM_Client                 myShapeReader;     // geom shape reader
168   gp_Ax3                      myWorkingPlane;
169   QMap<int,QString>           myRules;           // popup rules
170   static StudyTextureMap      myTextureMap;      // texture map
171
172   QList<GEOMGUI_OCCSelector*>  myOCCSelectors;
173   QList<LightApp_VTKSelector*> myVTKSelectors;
174
175   LightApp_Displayer*         myDisplayer;
176   int                         myLocalSelectionMode; //Select Only
177
178   friend class DisplayGUI;
179 };
180
181 #endif