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