Salome HOME
SMH: Merged GEOM (NEWGUI, HEAD, POLYWORK)
[modules/geom.git] / src / RepairGUI / RepairGUI.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   : RepairGUI.cxx
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header$
28
29 #include "RepairGUI.h"
30
31 #include "SUIT_Desktop.h"
32 #include "SUIT_Session.h"
33
34 #include "RepairGUI_SewingDlg.h"        // Method SEWING
35 #include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES
36 #include "RepairGUI_RemoveHolesDlg.h"   // Method SUPPRESS HOLE
37 #include "RepairGUI_ShapeProcessDlg.h"  // Method PROCESS SHAPE
38 #include "RepairGUI_CloseContourDlg.h"  // Method CLOSE CONTOUR
39 #include "RepairGUI_RemoveIntWiresDlg.h"// Method REMOVE INTERNAL WIRES
40 #include "RepairGUI_DivideEdgeDlg.h"    // Method DEVIDE EDGE
41 #include "RepairGUI_FreeBoundDlg.h"     // Method FREE BOUNDARIES
42 #include "RepairGUI_FreeFacesDlg.h"     // Method FREE FACES
43 #include "RepairGUI_GlueDlg.h"          // Method GLUE FACES
44
45 #include "utilities.h"
46
47 using namespace std;
48
49 RepairGUI* RepairGUI::myGUIObject = 0;
50
51 //=======================================================================
52 // function : GetRepairGUI()
53 // purpose  : Get the only RepairGUI object [ static ]
54 //=======================================================================
55 RepairGUI* RepairGUI::GetRepairGUI( GeometryGUI* parent )
56 {
57   if ( myGUIObject == 0 ) {
58     // init RepairGUI only once
59     myGUIObject = new RepairGUI( parent );
60   }
61   return myGUIObject;
62 }
63
64 //=======================================================================
65 // function : RepairGUI()
66 // purpose  : Constructor
67 //=======================================================================
68 RepairGUI::RepairGUI( GeometryGUI* parent ) : GEOMGUI( parent )
69 {
70 }
71
72
73 //=======================================================================
74 // function : ~RepairGUI()
75 // purpose  : Destructor
76 //=======================================================================
77 RepairGUI::~RepairGUI()
78 {
79 }
80
81
82 //=======================================================================
83 // function : OnGUIEvent()
84 // purpose  : 
85 //=======================================================================
86 bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
87 {
88   getGeometryGUI()->EmitSignalDeactivateDialog();
89   
90   QDialog* aDlg = NULL;
91   switch (theCommandID) {
92     case 601: // SEWING
93       aDlg = new RepairGUI_SewingDlg( parent, "" );
94       break;
95     case 602: // GLUE FACES
96       aDlg = new RepairGUI_GlueDlg( parent, "" );
97       break;
98     case 603: // SUPPRESS FACES
99       aDlg = new RepairGUI_SuppressFacesDlg( parent, "" );
100       break;
101     case 604: // SUPPRESS HOLES
102       aDlg = new RepairGUI_RemoveHolesDlg( parent, "" );
103       break;
104     case 605: // SHAPE PROCESSING
105       aDlg = new RepairGUI_ShapeProcessDlg( parent, "" );
106       break;
107     case 606: // CLOSE CONTOUR
108       aDlg = new RepairGUI_CloseContourDlg( parent, "" );
109       break;
110     case 607: // REMOVE INTERNAL WIRES
111       aDlg = new RepairGUI_RemoveIntWiresDlg( parent, "" );
112       break;
113     case 608: // ADD POINT ON EDGE
114       aDlg = new RepairGUI_DivideEdgeDlg( parent, "" );
115       break;
116     case 609: // FREE BOUNDARIES
117       aDlg = new RepairGUI_FreeBoundDlg( getGeometryGUI(), parent );
118       break;    
119     case 610: // FREE FACES
120       aDlg = new RepairGUI_FreeFacesDlg( getGeometryGUI(), parent, "" );
121       break;    
122     default:
123       SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
124       break;
125   }
126
127   if ( aDlg )
128     aDlg->show();
129     
130   return true;
131 }
132
133
134 //=====================================================================================
135 // EXPORTED METHODS
136 //=====================================================================================
137 extern "C"
138 {
139   GEOMGUI* GetLibGUI( GeometryGUI* parent )
140   {
141     return RepairGUI::GetRepairGUI( parent );
142   }
143 }