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