Salome HOME
e784ac282ab9498fc83ba57c8b25b605465366da
[modules/geom.git] / src / OperationGUI / OperationGUI.cxx
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : OperationGUI.cxx
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header$
28
29 using namespace std;
30 #include "OperationGUI.h"
31
32 #include "QAD_RightFrame.h"
33 #include "QAD_Desktop.h"
34 #include "OCCViewer_Viewer3d.h"
35 #include "OCCViewer_ViewFrame.h"
36 #include "SALOMEGUI_QtCatchCorbaException.hxx"
37
38 #include <TopTools_MapOfShape.hxx>
39 #include <TopExp_Explorer.hxx>
40 #include <Precision.hxx>
41
42 #include "OperationGUI_PartitionDlg.h"   // Method PARTITION
43 #include "OperationGUI_ArchimedeDlg.h"   // Method ARCHIMEDE
44 #include "OperationGUI_FilletDlg.h"      // Method FILLET
45 #include "OperationGUI_ChamferDlg.h"     // Method CHAMFER
46
47 #include "OperationGUI_ClippingDlg.h"
48
49 OperationGUI* OperationGUI::myGUIObject = 0;
50
51 //=======================================================================
52 // function : GetOperationGUI()
53 // purpose  : Get the only OperationGUI object [ static ]
54 //=======================================================================
55 OperationGUI* OperationGUI::GetOperationGUI()
56 {
57   if ( myGUIObject == 0 ) {
58     // init OperationGUI only once
59     myGUIObject = new OperationGUI();
60   }
61   return myGUIObject;
62 }
63
64 //=======================================================================
65 // function : OperationGUI()
66 // purpose  : Constructor
67 //=======================================================================
68 OperationGUI::OperationGUI() : GEOMGUI()
69 {
70 }
71
72
73 //=======================================================================
74 // function : ~OperationGUI()
75 // purpose  : Destructor
76 //=======================================================================
77 OperationGUI::~OperationGUI()
78 {
79 }
80
81
82 //=======================================================================
83 // function : OnGUIEvent()
84 // purpose  : 
85 //=======================================================================
86 bool OperationGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent )
87 {
88   OperationGUI* myOperationGUI = GetOperationGUI();
89   GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog();
90   SALOME_Selection* Sel = SALOME_Selection::Selection(
91     QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
92   
93   switch ( theCommandID )
94   {
95     case 503: // PARTITION
96       ( new OperationGUI_PartitionDlg( parent, "", Sel ) )->show();
97     break;
98     case 504: // ARCHIMEDE
99       new OperationGUI_ArchimedeDlg( parent, Sel );
100     break;
101     case 505: // FILLET
102       new OperationGUI_FilletDlg( parent, Sel );        
103     break;
104     case 506: // CHAMFER
105       new OperationGUI_ChamferDlg( parent, Sel );
106     break;
107     case 507: // CLIPPING RANGE
108       ( new OperationGUI_ClippingDlg( parent, "" ) )->show();
109     break;
110     default:
111       parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
112     break;
113   }
114   
115   return true;
116 }
117
118 //=====================================================================================
119 // EXPORTED METHODS
120 //=====================================================================================
121 extern "C"
122 {
123   GEOMGUI* GetLibGUI()
124   {
125     return OperationGUI::GetOperationGUI();
126   }
127 }