1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : GeometryGUI.h
25 // Author : Lucien PIGNOLONI
32 #include "SalomeApp_Module.h"
35 #include "GEOM_Client.hxx"
36 #include "SALOME_InteractiveObject.hxx"
38 #include "SALOMEDSClient.hxx"
47 #include "SALOMEconfig.h"
48 #include CORBA_CLIENT_HEADER(SALOMEDS)
51 #include <SALOME_WNT.hxx>
53 #define SALOME_WNT_EXPORT
57 //#include <SALOME_WNT.hxx>
59 //#define SALOME_WNT_EXPORT
62 #if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS
63 #define GEOMGUI_WNT_EXPORT __declspec( dllexport )
65 #define GEOMGUI_WNT_EXPORT
68 typedef QMap<QString, GEOMGUI*> GUIMap;
72 class GEOMGUI_OCCSelector;
73 class LightApp_VTKSelector;
74 class LightApp_Selection;
75 class SUIT_ViewManager;
77 //=================================================================================
78 // class : GeometryGUI
80 //=================================================================================
81 class GEOMGUI_WNT_EXPORT GeometryGUI : public SalomeApp_Module
92 virtual LightApp_Displayer* displayer();
93 virtual void initialize( CAM_Application* );
94 virtual QString engineIOR() const;
96 static bool InitGeomGen(); //BugID IPAL9186: SRN: To be called by Python scripts
98 static GEOM::GEOM_Gen_var GetGeomGen();// { return GeometryGUI::myComponentGeom; }
100 static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
101 static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy);
103 GEOM_Client& GetShapeReader() { return myShapeReader; }
104 Standard_CString& GetFatherior() { return myFatherior; }
105 //void SetState( const int state ) { myState = state; }
106 //int GetState() const { return myState; }
108 // Get active dialog box
109 QDialog* GetActiveDialogBox(){ return myActiveDialogBox; }
110 // Set active dialog box
111 void SetActiveDialogBox( QDialog* aDlg );
113 // Non modal dialog boxes management
114 void EmitSignalDeactivateDialog();
115 void EmitSignalCloseAllDialogs();
116 void EmitSignalDefaultStepValueChanged( double newVal );
118 void OnGUIEvent( int id );
120 // virtual bool SetSettings();
121 // virtual void SupportedViewType ( int* buffer, int bufferSize );
122 virtual void BuildPresentation( const Handle(SALOME_InteractiveObject)&, SUIT_ViewWindow* = 0 );
124 // virtual void DefinePopup( QString & theContext, QString & theParent, QString & theObject);
125 // virtual bool CustomPopup( QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
126 // const QString& theParent, const QString& theObject );
128 // The Working Plane management
129 void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; }
130 gp_Ax3 GetWorkingPlane() { return myWorkingPlane; }
131 void ActiveWorkingPlane();
133 virtual void windows( QMap<int, int>& ) const;
134 virtual void viewManagers( QStringList& ) const;
136 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
137 virtual void createPreferences();
138 virtual void preferencesChanged( const QString&, const QString& );
142 virtual bool deactivateModule( SUIT_Study* );
143 virtual bool activateModule( SUIT_Study* );
144 virtual void OnKeyPress ( SUIT_ViewWindow*, QKeyEvent* );
145 virtual void OnMousePress( SUIT_ViewWindow*, QMouseEvent* );
146 virtual void OnMouseMove ( SUIT_ViewWindow*, QMouseEvent* );
149 virtual void onViewManagerAdded( SUIT_ViewManager* );
150 virtual void onViewManagerRemoved( SUIT_ViewManager* );
154 void onWindowActivated( SUIT_ViewWindow* );
157 void SignalDeactivateActiveDialog();
158 void SignalCloseAllDialogs();
159 void SignalDefaultStepValueChanged( double newVal );
162 virtual LightApp_Selection* createSelection() const;
165 GEOMGUI* getLibrary( const QString& libraryName );
166 void createGeomAction( const int id, const QString& po_id,
167 const QString& icon_id = QString(""),
168 const int key = 0, const bool toggle = false );
169 void createPopupItem( const int, const QString& clients, const QString& types,
170 const bool isSingle = false, const int isVisible = -1,
171 const bool isExpandAll = false, const bool isOCC = false,
172 const int parentId = -1 );
175 static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine!!!
177 GUIMap myGUIMap; // GUI libraries map
178 QDialog* myActiveDialogBox; // active dialog box
179 GEOM_Client myShapeReader; // geom shape reader
180 Standard_CString myFatherior;
181 int myState; // identify a method
182 gp_Ax3 myWorkingPlane;
183 QMap<int,QString> myRules; // popup rules
185 QPtrList<GEOMGUI_OCCSelector> myOCCSelectors;
186 QPtrList<LightApp_VTKSelector> myVTKSelectors;
188 LightApp_Displayer* myDisplayer;
190 friend class DisplayGUI;