]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMGUI/GeometryGUI.h
Salome HOME
Additional fix for issue 0020626: EDF 1200 GEOM: the discretisation of the circles...
[modules/geom.git] / src / GEOMGUI / GeometryGUI.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 // 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 <SalomeApp_Module.h>
32
33 #include <GEOM_Client.hxx>
34 #include <SALOME_InteractiveObject.hxx>
35 #include <SALOMEDSClient.hxx>
36
37 #include "GEOMGUI.h"
38
39 // QT Includes
40 #include <QMap>
41
42 // OCCT Includes
43 #include <gp_Ax3.hxx>
44 #include <Graphic3d_HArray1OfBytes.hxx>
45
46 // IDL headers
47 #include "SALOMEconfig.h"
48 #include CORBA_CLIENT_HEADER(SALOMEDS)
49
50 // minimum allowed value for deflection coefficient
51 #define DEFLECTION_MIN 1e-06
52
53 typedef QMap<QString, GEOMGUI*> GUIMap;
54
55 class QDialog;
56 class QMenu;
57 class GEOMGUI_OCCSelector;
58 class LightApp_VTKSelector;
59 class LightApp_Selection;
60 class SUIT_ViewManager;
61 class SalomeApp_Study;
62
63 //=================================================================================
64 // class    : GeometryGUI
65 // purpose  :
66 //=================================================================================
67 class  GEOMGUI_EXPORT GeometryGUI : public SalomeApp_Module
68 {
69   Q_OBJECT;
70
71 public:
72   // Constructor
73   GeometryGUI();
74
75   // Destructor
76   ~GeometryGUI();
77
78   virtual LightApp_Displayer* displayer();
79   virtual void                initialize( CAM_Application* );
80   virtual QString             engineIOR() const;
81
82   static Handle(Graphic3d_HArray1OfBytes) getTexture( SalomeApp_Study*, int, int&, int& );
83
84   static bool                 InitGeomGen();   //BugID IPAL9186: SRN: To be called by Python scripts
85
86   static  GEOM::GEOM_Gen_var  GetGeomGen();//        { return GeometryGUI::myComponentGeom; }
87
88   static CORBA::Object_var    ClientSObjectToObject (_PTR(SObject) theSObject);
89   static SALOMEDS::Study_var  ClientStudyToStudy (_PTR(Study) theStudy);
90
91   GEOM_Client&                GetShapeReader()    { return myShapeReader; }
92   Standard_CString&           GetFatherior()      { return myFatherior; }
93   //void                        SetState( const int state ) { myState = state; }
94   //int                         GetState() const    { return myState; }
95
96   // Get active dialog box
97   QDialog*                    GetActiveDialogBox(){ return myActiveDialogBox; }
98   // Set active dialog box
99   void                        SetActiveDialogBox( QDialog* aDlg );
100
101   // Non modal dialog boxes management
102   void                        EmitSignalDeactivateDialog();
103   void                        EmitSignalCloseAllDialogs();
104   void                        EmitSignalDefaultStepValueChanged( double newVal );
105
106   void                        OnGUIEvent( int id );
107
108 //  virtual bool                SetSettings();
109 //  virtual void                SupportedViewType ( int* buffer, int bufferSize );
110   virtual void                BuildPresentation( const Handle(SALOME_InteractiveObject)&, SUIT_ViewWindow* = 0 );
111
112 //  virtual void                DefinePopup( QString & theContext, QString & theParent, QString & theObject);
113 //  virtual bool                CustomPopup( QAD_Desktop* parent, QMenu* popup, const QString& theContext,
114 //                                         const QString& theParent, const QString& theObject );
115
116   // The Working Plane management
117   void                        SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp;   }
118   gp_Ax3                      GetWorkingPlane()            { return myWorkingPlane; }
119   void                        ActiveWorkingPlane();
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
140 protected slots:
141   virtual void                onViewManagerAdded( SUIT_ViewManager* );
142   virtual void                onViewManagerRemoved( SUIT_ViewManager* );
143
144 private slots:
145   void                        OnGUIEvent();
146   void                        onWindowActivated( SUIT_ViewWindow* );
147   void                        onViewAboutToShow();
148
149 signals :
150   void                        SignalDeactivateActiveDialog();
151   void                        SignalCloseAllDialogs();
152   void                        SignalDefaultStepValueChanged( double newVal );
153
154 protected:
155   virtual LightApp_Selection* createSelection() const;
156
157 private:
158   GEOMGUI*                    getLibrary( const QString& libraryName );
159   void                        createGeomAction( const int id, const QString& po_id,
160                                                 const QString& icon_id = QString(""),
161                                                 const int key = 0, const bool toggle = false );
162   void                        createPopupItem( const int, const QString& clients, const QString& types,
163                                                const bool isSingle = false, const int isVisible = -1,
164                                                const bool isExpandAll = false, const bool isOCC = false,
165                                                const int parentId = -1 );
166
167 public:
168   static GEOM::GEOM_Gen_var   myComponentGeom;   // GEOM engine!!!
169
170 private:  
171
172   typedef QMap<long, Handle(Graphic3d_HArray1OfBytes)> TextureMap;
173   typedef QMap<long, TextureMap> StudyTextureMap;
174   
175   GUIMap                      myGUIMap;          // GUI libraries map
176   QDialog*                    myActiveDialogBox; // active dialog box
177   GEOM_Client                 myShapeReader;     // geom shape reader
178   Standard_CString            myFatherior;
179   int                         myState;           // identify a method
180   gp_Ax3                      myWorkingPlane;
181   QMap<int,QString>           myRules;           // popup rules
182   static StudyTextureMap      myTextureMap;      // texture map
183
184   QList<GEOMGUI_OCCSelector*>  myOCCSelectors;
185   QList<LightApp_VTKSelector*> myVTKSelectors;
186
187   LightApp_Displayer*         myDisplayer;
188   int                         myLocalSelectionMode; //Select Only
189
190   friend class DisplayGUI;
191 };
192
193 #endif