1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 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.
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : BooleanGUI.cxx
25 // Author : Damien COQUERET
30 #include "BooleanGUI.h"
32 #include "SALOMEGUI_QtCatchCorbaException.hxx"
34 #include "BooleanGUI_FuseDlg.h" // Method FUSE
35 #include "BooleanGUI_CommonDlg.h" // Method COMMON
36 #include "BooleanGUI_CutDlg.h" // Method CUT
37 #include "BooleanGUI_SectionDlg.h" // Method SECTION
39 //=======================================================================
40 // function : BooleanGUI()
41 // purpose : Constructor
42 //=======================================================================
43 BooleanGUI::BooleanGUI() :
46 myGeomBase = new GEOMBase();
47 myGeomGUI = GEOMContext::GetGeomGUI();
48 myGeom = myGeomGUI->myComponentGeom;
52 //=======================================================================
53 // function : ~BooleanGUI()
54 // purpose : Destructor
55 //=======================================================================
56 BooleanGUI::~BooleanGUI()
61 //=======================================================================
62 // function : OnGUIEvent()
64 //=======================================================================
65 bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
67 BooleanGUI* myBooleanGUI = new BooleanGUI();
68 myBooleanGUI->myGeomGUI->EmitSignalDeactivateDialog();
69 SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
75 BooleanGUI_FuseDlg *aDlg = new BooleanGUI_FuseDlg(parent, "", myBooleanGUI, Sel);
80 BooleanGUI_CommonDlg *aDlg = new BooleanGUI_CommonDlg(parent, "", myBooleanGUI, Sel);
85 BooleanGUI_CutDlg *aDlg = new BooleanGUI_CutDlg(parent, "", myBooleanGUI, Sel);
90 BooleanGUI_SectionDlg *aDlg = new BooleanGUI_SectionDlg(parent, "", myBooleanGUI, Sel);
95 parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
103 //=======================================================================
104 // function : MakeBooleanAndDisplay()
106 //=======================================================================
107 void BooleanGUI::MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2, const short operation)
110 GEOM::GEOM_Shape_ptr result = myGeom->MakeBoolean(Shape1, Shape2, operation);
111 if(result->_is_nil()) {
112 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
116 TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
117 Standard_CString type;
118 myGeomBase->GetShapeTypeString(S,type);
119 result->NameType(type);
121 if (myGeomBase->Display(result))
122 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
124 catch (const SALOME::SALOME_Exception& S_ex) {
125 QtCatchCorbaException(S_ex);
131 //=====================================================================================
133 //=====================================================================================
136 bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
137 {return BooleanGUI::OnGUIEvent(theCommandID, parent);}