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