]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMGUI/GeometryGUI.h
Salome HOME
Merging from V3_2_6pre4
[modules/geom.git] / src / GEOMGUI / GeometryGUI.h
1 //  GEOM GEOMGUI : GUI for Geometry 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : GeometryGUI.h
25 //  Author : Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 #ifndef GEOMETRYGUI_H
30 #define GEOMETRYGUI_H
31
32 #include "GEOM_GEOMGUI.hxx"
33
34 #include "SalomeApp_Module.h"
35
36 #include "GEOMGUI.h"
37 #include "GEOM_Client.hxx"
38 #include "SALOME_InteractiveObject.hxx"
39
40 #include "SALOMEDSClient.hxx"
41
42 // QT Includes
43 #include <qmap.h>
44
45 // OCCT Includes
46 #include <gp_Ax3.hxx>
47
48 // IDL headers
49 #include "SALOMEconfig.h"
50 #include CORBA_CLIENT_HEADER(SALOMEDS)
51
52 typedef QMap<QString, GEOMGUI*> GUIMap;
53
54 class QDialog;
55 class QPopupMenu;
56 class GEOMGUI_OCCSelector;
57 class LightApp_VTKSelector;
58 class LightApp_Selection;
59 class SUIT_ViewManager;
60
61 //=================================================================================
62 // class    : GeometryGUI
63 // purpose  :
64 //=================================================================================
65 class  GEOMGUI_EXPORT GeometryGUI : public SalomeApp_Module
66 {
67   Q_OBJECT;
68
69 public:
70   // Constructor
71   GeometryGUI();
72
73   // Destructor
74   ~GeometryGUI();
75
76   virtual LightApp_Displayer* displayer();
77   virtual void                initialize( CAM_Application* );
78   virtual QString             engineIOR() const;
79
80   static bool                 InitGeomGen();   //BugID IPAL9186: SRN: To be called by Python scripts
81
82   static  GEOM::GEOM_Gen_var  GetGeomGen();//        { return GeometryGUI::myComponentGeom; }
83
84   static CORBA::Object_var    ClientSObjectToObject (_PTR(SObject) theSObject);
85   static SALOMEDS::Study_var  ClientStudyToStudy (_PTR(Study) theStudy);
86
87   GEOM_Client&                GetShapeReader()    { return myShapeReader; }
88   Standard_CString&           GetFatherior()      { return myFatherior; }
89   //void                        SetState( const int state ) { myState = state; }
90   //int                         GetState() const    { return myState; }
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   void                        OnGUIEvent( int id );
103
104 //  virtual bool                SetSettings();
105 //  virtual void                SupportedViewType ( int* buffer, int bufferSize );
106   virtual void                BuildPresentation( const Handle(SALOME_InteractiveObject)&, SUIT_ViewWindow* = 0 );
107
108 //  virtual void                DefinePopup( QString & theContext, QString & theParent, QString & theObject);
109 //  virtual bool                CustomPopup( QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
110 //                                         const QString& theParent, const QString& theObject );
111
112   // The Working Plane management
113   void                        SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp;   }
114   gp_Ax3                      GetWorkingPlane()            { return myWorkingPlane; }
115   void                        ActiveWorkingPlane();
116
117   virtual void                windows( QMap<int, int>& ) const;
118   virtual void                viewManagers( QStringList& ) const;
119
120   virtual void                contextMenuPopup( const QString&, QPopupMenu*, QString& );
121   virtual void                createPreferences();
122   virtual void                preferencesChanged( const QString&, const QString& );
123   int                         getLocalSelectionMode() const;
124   void                        setLocalSelectionMode(const int mode);
125
126 public slots:
127   virtual bool                deactivateModule( SUIT_Study* );
128   virtual bool                activateModule( SUIT_Study* );
129   virtual void                OnKeyPress  ( SUIT_ViewWindow*, QKeyEvent*   );
130   virtual void                OnMousePress( SUIT_ViewWindow*, QMouseEvent* );
131   virtual void                OnMouseMove ( SUIT_ViewWindow*, QMouseEvent* );
132
133 protected slots:
134   virtual void                onViewManagerAdded( SUIT_ViewManager* );
135   virtual void                onViewManagerRemoved( SUIT_ViewManager* );
136
137 private slots:
138   void                        OnGUIEvent();
139   void                        onWindowActivated( SUIT_ViewWindow* );
140
141 signals :
142   void                        SignalDeactivateActiveDialog();
143   void                        SignalCloseAllDialogs();
144   void                        SignalDefaultStepValueChanged( double newVal );
145
146 protected:
147   virtual LightApp_Selection* createSelection() const;
148
149 private:
150   GEOMGUI*                    getLibrary( const QString& libraryName );
151   void                        createGeomAction( const int id, const QString& po_id,
152                                                 const QString& icon_id = QString(""),
153                                                 const int key = 0, const bool toggle = false );
154   void                        createPopupItem( const int, const QString& clients, const QString& types,
155                                                const bool isSingle = false, const int isVisible = -1,
156                                                const bool isExpandAll = false, const bool isOCC = false,
157                                                const int parentId = -1 );
158
159 public:
160   static GEOM::GEOM_Gen_var   myComponentGeom;   // GEOM engine!!!
161 private:  
162   GUIMap                      myGUIMap;          // GUI libraries map
163   QDialog*                    myActiveDialogBox; // active dialog box
164   GEOM_Client                 myShapeReader;     // geom shape reader
165   Standard_CString            myFatherior;
166   int                         myState;           // identify a method
167   gp_Ax3                      myWorkingPlane;
168   QMap<int,QString>           myRules;           // popup rules
169
170   QPtrList<GEOMGUI_OCCSelector>   myOCCSelectors;
171   QPtrList<LightApp_VTKSelector> myVTKSelectors;
172
173   LightApp_Displayer*         myDisplayer;
174   int                         myLocalSelectionMode; //Select Only
175
176 friend class DisplayGUI;
177 };
178
179 #endif