1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // GEOM GEOMGUI : GUI for Geometry component
23 // File : GeometryGUI.h
24 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
29 #include "GEOM_GEOMGUI.hxx"
31 #include <SalomeApp_Module.h>
33 #include <GEOM_Client.hxx>
34 #include <SALOME_InteractiveObject.hxx>
35 #include <SALOMEDSClient.hxx>
46 #include "SALOMEconfig.h"
47 #include CORBA_CLIENT_HEADER(SALOMEDS)
49 typedef QMap<QString, GEOMGUI*> GUIMap;
53 class GEOMGUI_OCCSelector;
54 class LightApp_VTKSelector;
55 class LightApp_Selection;
56 class SUIT_ViewManager;
58 //=================================================================================
59 // class : GeometryGUI
61 //=================================================================================
62 class GEOMGUI_EXPORT GeometryGUI : public SalomeApp_Module
73 virtual LightApp_Displayer* displayer();
74 virtual void initialize( CAM_Application* );
75 virtual QString engineIOR() const;
77 static bool InitGeomGen(); //BugID IPAL9186: SRN: To be called by Python scripts
79 static GEOM::GEOM_Gen_var GetGeomGen();// { return GeometryGUI::myComponentGeom; }
81 static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
82 static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy);
84 static char* JoinObjectParameters(const QStringList& theParametersList);
86 GEOM_Client& GetShapeReader() { return myShapeReader; }
87 Standard_CString& GetFatherior() { return myFatherior; }
88 //void SetState( const int state ) { myState = state; }
89 //int GetState() const { return myState; }
91 // Get active dialog box
92 QDialog* GetActiveDialogBox(){ return myActiveDialogBox; }
93 // Set active dialog box
94 void SetActiveDialogBox( QDialog* aDlg );
96 // Non modal dialog boxes management
97 void EmitSignalDeactivateDialog();
98 void EmitSignalCloseAllDialogs();
99 void EmitSignalDefaultStepValueChanged( double newVal );
101 void OnGUIEvent( int id );
103 // virtual bool SetSettings();
104 // virtual void SupportedViewType ( int* buffer, int bufferSize );
105 virtual void BuildPresentation( const Handle(SALOME_InteractiveObject)&, SUIT_ViewWindow* = 0 );
107 // virtual void DefinePopup( QString & theContext, QString & theParent, QString & theObject);
108 // virtual bool CustomPopup( QAD_Desktop* parent, QMenu* popup, const QString& theContext,
109 // const QString& theParent, const QString& theObject );
111 // The Working Plane management
112 void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; }
113 gp_Ax3 GetWorkingPlane() { return myWorkingPlane; }
114 void ActiveWorkingPlane();
116 virtual void windows( QMap<int, int>& ) const;
117 virtual void viewManagers( QStringList& ) const;
119 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
120 virtual void createPreferences();
121 virtual void preferencesChanged( const QString&, const QString& );
122 int getLocalSelectionMode() const;
123 void setLocalSelectionMode(const int mode);
125 virtual void storeVisualParameters (int savePoint);
126 virtual void restoreVisualParameters(int savePoint);
129 virtual bool deactivateModule( SUIT_Study* );
130 virtual bool activateModule( SUIT_Study* );
131 virtual void OnKeyPress ( SUIT_ViewWindow*, QKeyEvent* );
132 virtual void OnMousePress( SUIT_ViewWindow*, QMouseEvent* );
133 virtual void OnMouseMove ( SUIT_ViewWindow*, QMouseEvent* );
136 virtual void onViewManagerAdded( SUIT_ViewManager* );
137 virtual void onViewManagerRemoved( SUIT_ViewManager* );
141 void onWindowActivated( SUIT_ViewWindow* );
142 void onViewAboutToShow();
145 void SignalDeactivateActiveDialog();
146 void SignalCloseAllDialogs();
147 void SignalDefaultStepValueChanged( double newVal );
150 virtual LightApp_Selection* createSelection() const;
153 GEOMGUI* getLibrary( const QString& libraryName );
154 void createGeomAction( const int id, const QString& po_id,
155 const QString& icon_id = QString(""),
156 const int key = 0, const bool toggle = false );
157 void createPopupItem( const int, const QString& clients, const QString& types,
158 const bool isSingle = false, const int isVisible = -1,
159 const bool isExpandAll = false, const bool isOCC = false,
160 const int parentId = -1 );
163 static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine!!!
165 GUIMap myGUIMap; // GUI libraries map
166 QDialog* myActiveDialogBox; // active dialog box
167 GEOM_Client myShapeReader; // geom shape reader
168 Standard_CString myFatherior;
169 int myState; // identify a method
170 gp_Ax3 myWorkingPlane;
171 QMap<int,QString> myRules; // popup rules
173 QList<GEOMGUI_OCCSelector*> myOCCSelectors;
174 QList<LightApp_VTKSelector*> myVTKSelectors;
176 LightApp_Displayer* myDisplayer;
177 int myLocalSelectionMode; //Select Only
179 friend class DisplayGUI;