1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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, or (at your option) any later version.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : OperationGUI.cxx
23 // Author : Damien COQUERET, Open CASCADE S.A.S.
25 #include "OperationGUI.h"
27 #include <GeometryGUI.h>
28 #include "GeometryGUI_Operations.h"
30 #include <SUIT_Session.h>
31 #include <SUIT_Desktop.h>
32 #include <SUIT_ViewManager.h>
33 #include <SalomeApp_Application.h>
34 #include <OCCViewer_ViewWindow.h>
36 #include <TopTools_MapOfShape.hxx>
37 #include <TopExp_Explorer.hxx>
38 #include <Precision.hxx>
40 #include "OperationGUI_PartitionDlg.h" // Method PARTITION
41 #include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE
42 #include "OperationGUI_FilletDlg.h" // Method FILLET
43 #include "OperationGUI_Fillet1d2dDlg.h" // Method FILLET 2D and FILLET 1D
44 #include "OperationGUI_ChamferDlg.h" // Method CHAMFER
45 #include "OperationGUI_ClippingDlg.h" // Clipping dialog box
46 #include "OperationGUI_GetShapesOnShapeDlg.h"
47 #include "OperationGUI_GetSharedShapesDlg.h"
48 #include "OperationGUI_ExtrudedFeatureDlg.h" // Methods EXTRUDED BOSS / CUT
50 #ifdef DEBUG_CURVE_CREATOR
51 // for debug purposes, to be removed
52 #include "CurveCreator_Widget.h"
53 #include <QVBoxLayout>
54 #include <QPushButton>
57 //=======================================================================
58 // function : OperationGUI()
59 // purpose : Constructor
60 //=======================================================================
61 OperationGUI::OperationGUI( GeometryGUI* parent ) :
66 //=======================================================================
67 // function : ~OperationGUI()
68 // purpose : Destructor
69 //=======================================================================
70 OperationGUI::~OperationGUI()
75 //=======================================================================
76 // function : OnGUIEvent()
78 //=======================================================================
79 bool OperationGUI::OnGUIEvent (int theCommandID, SUIT_Desktop* parent)
81 SalomeApp_Application* app = getGeometryGUI()->getApp();
82 if (!app) return false;
84 getGeometryGUI()->EmitSignalDeactivateDialog();
86 switch (theCommandID) {
87 case GEOMOp::OpPartition: (new OperationGUI_PartitionDlg (getGeometryGUI(), parent))->show(); break;
88 case GEOMOp::OpArchimede: (new OperationGUI_ArchimedeDlg (getGeometryGUI(), parent))->show(); break;
89 case GEOMOp::OpFillet3d: (new OperationGUI_FilletDlg (getGeometryGUI(), parent))->show(); break;
90 case GEOMOp::OpChamfer: (new OperationGUI_ChamferDlg (getGeometryGUI(), parent))->show(); break;
91 case GEOMOp::OpClipping: (new OperationGUI_ClippingDlg (getGeometryGUI(), parent))->show(); break;
92 case GEOMOp::OpShapesOnShape: (new OperationGUI_GetShapesOnShapeDlg(getGeometryGUI(), parent))->show(); break;
93 case GEOMOp::OpSharedShapes: (new OperationGUI_GetSharedShapesDlg (getGeometryGUI(), parent))->show(); break;
94 case GEOMOp::OpExtrudedBoss: (new OperationGUI_ExtrudedFeatureDlg (BOSS, getGeometryGUI(), parent))->show(); break;
95 case GEOMOp::OpExtrudedCut: (new OperationGUI_ExtrudedFeatureDlg (CUT, getGeometryGUI(), parent))->show(); break;
96 case GEOMOp::OpFillet1d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, true))->show(); break;
97 case GEOMOp::OpFillet2d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, false))->show(); break;
98 #ifdef DEBUG_CURVE_CREATOR
99 // for debug purposes, to be removed
100 case GEOMOp::OpCurveCreator:
102 static CurveCreator_Curve *aStaticCurve = NULL;
104 if (aStaticCurve == NULL) {
105 aStaticCurve = new CurveCreator_Curve(CurveCreator::Dim2d);
107 if (CurveCreator::Dim2d == aStaticCurve->getDimension()) {
108 OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)getGeometryGUI()->getApp()->activeViewManager()->getActiveView();
112 QDialog *aDialog = new QDialog(parent);
113 QVBoxLayout *aMainLO = new QVBoxLayout;
114 QPushButton *aQuitButton = new QPushButton(tr("Close"));
115 CurveCreator_Widget *aWidget =
116 new CurveCreator_Widget (aDialog, aStaticCurve);
118 connect(aQuitButton, SIGNAL(clicked()), aDialog, SLOT(close()));
119 aMainLO->addWidget(aWidget);
120 aMainLO->addWidget(aQuitButton);
122 aDialog->setLayout(aMainLO);
123 aDialog->setAttribute(Qt::WA_DeleteOnClose);
129 app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
135 //=====================================================================================
137 //=====================================================================================
141 __declspec( dllexport )
143 GEOMGUI* GetLibGUI( GeometryGUI* parent )
145 return new OperationGUI( parent );