]> SALOME platform Git repositories - modules/geom.git/blob - src/OperationGUI/OperationGUI.cxx
Salome HOME
SMH: Merged GEOM (NEWGUI, HEAD, POLYWORK)
[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 "SUIT_Session.h"
33 #include "SUIT_Desktop.h"
34
35 #include <TopTools_MapOfShape.hxx>
36 #include <TopExp_Explorer.hxx>
37 #include <Precision.hxx>
38
39 #include "OperationGUI_PartitionDlg.h"   // Method PARTITION
40 #include "OperationGUI_ArchimedeDlg.h"   // Method ARCHIMEDE
41 #include "OperationGUI_FilletDlg.h"      // Method FILLET
42 #include "OperationGUI_ChamferDlg.h"     // Method CHAMFER
43
44 #include "OperationGUI_ClippingDlg.h"
45
46 OperationGUI* OperationGUI::myGUIObject = 0;
47
48 //=======================================================================
49 // function : GetOperationGUI()
50 // purpose  : Get the only OperationGUI object [ static ]
51 //=======================================================================
52 OperationGUI* OperationGUI::GetOperationGUI( GeometryGUI* parent )
53 {
54   if ( myGUIObject == 0 ) {
55     // init OperationGUI only once
56     myGUIObject = new OperationGUI( parent );
57   }
58   return myGUIObject;
59 }
60
61 //=======================================================================
62 // function : OperationGUI()
63 // purpose  : Constructor
64 //=======================================================================
65 OperationGUI::OperationGUI(GeometryGUI* parent) : GEOMGUI(parent)
66 {
67 }
68
69
70 //=======================================================================
71 // function : ~OperationGUI()
72 // purpose  : Destructor
73 //=======================================================================
74 OperationGUI::~OperationGUI()
75 {
76 }
77
78
79 //=======================================================================
80 // function : OnGUIEvent()
81 // purpose  : 
82 //=======================================================================
83 bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
84 {
85   getGeometryGUI()->EmitSignalDeactivateDialog();
86   
87   switch ( theCommandID )
88   {
89     case 503: // PARTITION
90       ( new OperationGUI_PartitionDlg( parent, "" ) )->show();
91     break;
92     case 504: // ARCHIMEDE
93       new OperationGUI_ArchimedeDlg( getGeometryGUI(), parent );
94     break;
95     case 505: // FILLET
96       new OperationGUI_FilletDlg( parent );     
97     break;
98     case 506: // CHAMFER
99       new OperationGUI_ChamferDlg( parent );
100     break;
101     case 507: // CLIPPING RANGE
102       ( new OperationGUI_ClippingDlg( parent, "" ) )->show();
103     break;
104     default:
105       SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
106     break;
107   }
108   
109   return true;
110 }
111
112 //=====================================================================================
113 // EXPORTED METHODS
114 //=====================================================================================
115 extern "C"
116 {
117   GEOMGUI* GetLibGUI(GeometryGUI* parent)
118   {
119     return OperationGUI::GetOperationGUI(parent);
120   }
121 }