1 // Copyright (C) 2007-2010 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
23 // GEOM GEOMGUI : GUI for Geometry component
24 // File : GeometryGUI.h
25 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
30 #include "GEOM_GEOMGUI.hxx"
32 #include <SalomeApp_Module.h>
34 #include <GEOM_Client.hxx>
35 #include <SALOME_InteractiveObject.hxx>
36 #include <SALOMEDSClient.hxx>
45 #include <Graphic3d_HArray1OfBytes.hxx>
48 #include "SALOMEconfig.h"
49 #include CORBA_CLIENT_HEADER(SALOMEDS)
51 // minimum allowed value for deflection coefficient
52 #define DEFLECTION_MIN 1e-06
56 class GEOMGUI_OCCSelector;
57 class LightApp_VTKSelector;
58 class LightApp_Selection;
59 class SUIT_ViewManager;
60 class SalomeApp_Study;
62 //=================================================================================
63 // class : GeometryGUI
65 //=================================================================================
66 class GEOMGUI_EXPORT GeometryGUI : public SalomeApp_Module
77 virtual LightApp_Displayer* displayer();
78 virtual void initialize( CAM_Application* );
79 virtual QString engineIOR() const;
81 static Handle(Graphic3d_HArray1OfBytes) getTexture( SalomeApp_Study*, int, int&, int& );
83 static bool InitGeomGen();
85 static GEOM::GEOM_Gen_var GetGeomGen();
87 static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
88 static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy);
90 GEOM_Client& GetShapeReader() { return myShapeReader; }
92 // Get active dialog box
93 QDialog* GetActiveDialogBox(){ return myActiveDialogBox; }
94 // Set active dialog box
95 void SetActiveDialogBox( QDialog* aDlg );
97 // Non modal dialog boxes management
98 void EmitSignalDeactivateDialog();
99 void EmitSignalCloseAllDialogs();
100 void EmitSignalDefaultStepValueChanged( double newVal );
103 void OnGUIEvent( int id );
105 // The Working Plane management
106 void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; }
107 gp_Ax3 GetWorkingPlane() { return myWorkingPlane; }
108 void ActiveWorkingPlane();
110 virtual void windows( QMap<int, int>& ) const;
111 virtual void viewManagers( QStringList& ) const;
113 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
114 virtual void createPreferences();
115 virtual void preferencesChanged( const QString&, const QString& );
116 int getLocalSelectionMode() const;
117 void setLocalSelectionMode(const int mode);
119 virtual void storeVisualParameters (int savePoint);
120 virtual void restoreVisualParameters(int savePoint);
123 virtual bool deactivateModule( SUIT_Study* );
124 virtual bool activateModule( SUIT_Study* );
125 virtual void OnKeyPress ( SUIT_ViewWindow*, QKeyEvent* );
126 virtual void OnMousePress( SUIT_ViewWindow*, QMouseEvent* );
127 virtual void OnMouseMove ( SUIT_ViewWindow*, QMouseEvent* );
130 virtual void onViewManagerAdded( SUIT_ViewManager* );
131 virtual void onViewManagerRemoved( SUIT_ViewManager* );
135 void onWindowActivated( SUIT_ViewWindow* );
136 void onViewAboutToShow();
139 void SignalDeactivateActiveDialog();
140 void SignalCloseAllDialogs();
141 void SignalDefaultStepValueChanged( double newVal );
144 virtual LightApp_Selection* createSelection() const;
147 GEOMGUI* getLibrary( const QString& libraryName );
148 void createGeomAction( const int id, const QString& po_id,
149 const QString& icon_id = QString(""),
150 const int key = 0, const bool toggle = false );
151 void createPopupItem( const int, const QString& clients, const QString& types,
152 const bool isSingle = false, const int isVisible = -1,
153 const bool isExpandAll = false, const bool isOCC = false,
154 const int parentId = -1 );
157 static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine!!!
161 typedef QMap<long, Handle(Graphic3d_HArray1OfBytes)> TextureMap;
162 typedef QMap<long, TextureMap> StudyTextureMap;
163 typedef QMap<QString, GEOMGUI*> GUIMap;
165 GUIMap myGUIMap; // GUI libraries map
166 QDialog* myActiveDialogBox; // active dialog box
167 GEOM_Client myShapeReader; // geom shape reader
168 gp_Ax3 myWorkingPlane;
169 QMap<int,QString> myRules; // popup rules
170 static StudyTextureMap myTextureMap; // texture map
172 QList<GEOMGUI_OCCSelector*> myOCCSelectors;
173 QList<LightApp_VTKSelector*> myVTKSelectors;
175 LightApp_Displayer* myDisplayer;
176 int myLocalSelectionMode; //Select Only
178 friend class DisplayGUI;