Salome HOME
IMPs 19998 and 21191: new gluing by PKV
[modules/geom.git] / src / RepairGUI / RepairGUI.cxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  GEOM GEOMGUI : GUI for Geometry component
23 //  File   : RepairGUI.cxx
24 //  Author : Damien COQUERET, Open CASCADE S.A.S.
25
26 #include "RepairGUI.h"
27
28 #include <GeometryGUI.h>
29 #include "GeometryGUI_Operations.h"
30
31 #include <SUIT_Desktop.h>
32 #include <SUIT_Session.h>
33 #include <SalomeApp_Application.h>
34
35 #include "RepairGUI_SewingDlg.h"        // Method SEWING
36 #include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES
37 #include "RepairGUI_RemoveHolesDlg.h"   // Method SUPPRESS HOLE
38 #include "RepairGUI_ShapeProcessDlg.h"  // Method PROCESS SHAPE
39 #include "RepairGUI_CloseContourDlg.h"  // Method CLOSE CONTOUR
40 #include "RepairGUI_RemoveIntWiresDlg.h"// Method REMOVE INTERNAL WIRES
41 #include "RepairGUI_DivideEdgeDlg.h"    // Method DEVIDE EDGE
42 #include "RepairGUI_FreeBoundDlg.h"     // Method FREE BOUNDARIES
43 #include "RepairGUI_FreeFacesDlg.h"     // Method FREE FACES
44 #include "RepairGUI_GlueDlg.h"          // Method GLUE FACES
45 #include "RepairGUI_LimitToleranceDlg.h"    // Method LIMIT TOLERANCE
46 #include "RepairGUI_ChangeOrientationDlg.h" // Method CHANGE ORIENTATION
47 #include "RepairGUI_RemoveExtraEdgesDlg.h"  // Method REMOVE EXTRA EDGES
48
49 //=======================================================================
50 // function : RepairGUI()
51 // purpose  : Constructor
52 //=======================================================================
53 RepairGUI::RepairGUI( GeometryGUI* parent )
54   : GEOMGUI( parent )
55 {
56 }
57
58 //=======================================================================
59 // function : ~RepairGUI()
60 // purpose  : Destructor
61 //=======================================================================
62 RepairGUI::~RepairGUI()
63 {
64 }
65
66
67 //=======================================================================
68 // function : OnGUIEvent()
69 // purpose  :
70 //=======================================================================
71 bool RepairGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
72 {
73   SalomeApp_Application* app = getGeometryGUI()->getApp();
74   if ( !app ) return false;
75
76   getGeometryGUI()->EmitSignalDeactivateDialog();
77
78   QDialog* aDlg = NULL;
79   switch (theCommandID) {
80   case GEOMOp::OpSewing:           aDlg = new RepairGUI_SewingDlg            (getGeometryGUI(), parent); break;
81   case GEOMOp::OpGlueFaces: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent, false, TopAbs_FACE); break;
82   case GEOMOp::OpGlueEdges: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent, false, TopAbs_EDGE); break;
83   case GEOMOp::OpLimitTolerance:   aDlg = new RepairGUI_LimitToleranceDlg    (getGeometryGUI(), parent); break;
84   case GEOMOp::OpSuppressFaces:    aDlg = new RepairGUI_SuppressFacesDlg     (getGeometryGUI(), parent); break;
85   case GEOMOp::OpSuppressHoles:    aDlg = new RepairGUI_RemoveHolesDlg       (getGeometryGUI(), parent); break;
86   case GEOMOp::OpShapeProcess:     aDlg = new RepairGUI_ShapeProcessDlg      (getGeometryGUI(), parent); break;
87   case GEOMOp::OpCloseContour:     aDlg = new RepairGUI_CloseContourDlg      (getGeometryGUI(), parent); break;
88   case GEOMOp::OpRemoveIntWires:   aDlg = new RepairGUI_RemoveIntWiresDlg    (getGeometryGUI(), parent); break;
89   case GEOMOp::OpAddPointOnEdge:   aDlg = new RepairGUI_DivideEdgeDlg        (getGeometryGUI(), parent); break;
90   case GEOMOp::OpFreeBoundaries:   aDlg = new RepairGUI_FreeBoundDlg         (getGeometryGUI(), parent); break;
91   case GEOMOp::OpFreeFaces:        aDlg = new RepairGUI_FreeFacesDlg         (getGeometryGUI(), parent); break;
92   case GEOMOp::OpOrientation:      aDlg = new RepairGUI_ChangeOrientationDlg (getGeometryGUI(), parent); break;
93   case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg  (getGeometryGUI(), parent); break;
94     default:
95       app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
96       break;
97   }
98
99   if (aDlg)
100     aDlg->show();
101
102   return true;
103 }
104
105
106 //=====================================================================================
107 // EXPORTED METHODS
108 //=====================================================================================
109 extern "C"
110 {
111 #ifdef WNT
112   __declspec( dllexport )
113 #endif
114   GEOMGUI* GetLibGUI( GeometryGUI* parent )
115   {
116     return new RepairGUI( parent );
117   }
118 }