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
32 #include "SALOMEGUI_QtCatchCorbaException.hxx"
34 #include "BuildGUI_EdgeDlg.h" // Method EDGE
35 #include "BuildGUI_WireDlg.h" // Method WIRE
36 #include "BuildGUI_FaceDlg.h" // Method FACE
37 #include "BuildGUI_ShellDlg.h" // Method SHELL
38 #include "BuildGUI_SolidDlg.h" // Method SOLID
39 #include "BuildGUI_CompoundDlg.h" // Method COMPOUND
41 //=======================================================================
42 // function : BuildGUI()
43 // purpose : Constructor
44 //=======================================================================
45 BuildGUI::BuildGUI() :
48 myGeomBase = new GEOMBase();
49 myGeomGUI = GEOMContext::GetGeomGUI();
50 myGeom = myGeomGUI->myComponentGeom;
54 //=======================================================================
55 // function : ~BuildGUI()
56 // purpose : Destructor
57 //=======================================================================
63 //=======================================================================
64 // function : OnGUIEvent()
66 //=======================================================================
67 bool BuildGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
69 BuildGUI* myBuildGUI = new BuildGUI();
70 myBuildGUI->myGeomGUI->EmitSignalDeactivateDialog();
71 SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
75 case 4081: // GEOM::EDGE
77 BuildGUI_EdgeDlg *aDlg = new BuildGUI_EdgeDlg(parent, "", myBuildGUI, Sel);
80 case 4082: // GEOM::WIRE
82 BuildGUI_WireDlg *aDlg = new BuildGUI_WireDlg(parent, "", myBuildGUI, Sel);
85 case 4083: // GEOM::FACE
87 BuildGUI_FaceDlg *aDlg = new BuildGUI_FaceDlg(parent, "", myBuildGUI, Sel);
90 case 4084: // GEOM::SHELL
92 BuildGUI_ShellDlg *aDlg = new BuildGUI_ShellDlg(parent, "", myBuildGUI, Sel);
95 case 4085: // GEOM::SOLID
97 BuildGUI_SolidDlg *aDlg = new BuildGUI_SolidDlg(parent, "", myBuildGUI, Sel);
100 case 4086: // GEOM::COMPOUND
102 BuildGUI_CompoundDlg *aDlg = new BuildGUI_CompoundDlg(parent, "", myBuildGUI, Sel);
107 parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
115 //=====================================================================================
116 // function : MakeLinearEdgeAndDisplay()
118 //=====================================================================================
119 void BuildGUI::MakeLinearEdgeAndDisplay(const gp_Pnt P1, const gp_Pnt P2)
122 GEOM::PointStruct ps1 = myGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z());
123 GEOM::PointStruct ps2 = myGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z());
124 GEOM::GEOM_Shape_var result = myGeom->MakeEdge(ps1, ps2);
125 if(result->_is_nil()) {
126 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
129 result->NameType(tr("GEOM_EDGE"));
130 if(myGeomBase->Display(result))
131 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
133 catch(const SALOME::SALOME_Exception& S_ex) {
134 QtCatchCorbaException(S_ex);
140 //=====================================================================================
141 // function : MakeWireAndDisplay()
143 //=====================================================================================
144 void BuildGUI::MakeWireAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
147 GEOM::GEOM_Shape_var result = myGeom->MakeWire(listShapesIOR);
148 if(result->_is_nil()) {
149 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
152 result->NameType(tr("GEOM_WIRE"));
153 if(myGeomBase->Display(result))
154 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
156 catch(const SALOME::SALOME_Exception& S_ex) {
157 QtCatchCorbaException(S_ex);
163 //=====================================================================================
164 // function : MakeFaceAndDisplay()
166 //=====================================================================================
167 void BuildGUI::MakeFaceAndDisplay(GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar)
170 GEOM::GEOM_Shape_var result = myGeom->MakeFace(aWire, wantPlanar);
171 if(result->_is_nil()) {
172 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
176 result->NameType(tr("GEOM_PLANE"));
178 result->NameType(tr("GEOM_FACE"));
179 if(myGeomBase->Display(result))
180 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
182 catch(const SALOME::SALOME_Exception& S_ex) {
183 QtCatchCorbaException(S_ex);
189 //=====================================================================================
190 // function : MakeShellAndDisplay()
192 //=====================================================================================
193 void BuildGUI::MakeShellAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
196 GEOM::GEOM_Shape_var result = myGeom->MakeShell(listShapesIOR);
197 if(result->_is_nil()) {
198 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
201 result->NameType(tr("GEOM_SHELL"));
202 if(myGeomBase->Display(result))
203 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
205 catch(const SALOME::SALOME_Exception& S_ex) {
206 QtCatchCorbaException(S_ex);
212 //=====================================================================================
213 // function : MakeSolidAndDisplay()
215 //=====================================================================================
216 void BuildGUI::MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
219 GEOM::GEOM_Shape_var result = myGeom->MakeSolid(listShapesIOR);
220 if(result->_is_nil()) {
221 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
224 result->NameType(tr("GEOM_SOLID"));
225 if(myGeomBase->Display(result))
226 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
228 catch(const SALOME::SALOME_Exception& S_ex) {
229 QtCatchCorbaException(S_ex);
235 //=====================================================================================
236 // function : MakeCompoundAndDisplay()
238 //=====================================================================================
239 void BuildGUI::MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
242 GEOM::GEOM_Shape_var result = myGeom->MakeCompound(listShapesIOR);
243 if(result->_is_nil()) {
244 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
247 result->NameType(tr("GEOM_COMPOUND"));
248 if(myGeomBase->Display(result))
249 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
251 catch(const SALOME::SALOME_Exception& S_ex) {
252 QtCatchCorbaException(S_ex);
258 //=====================================================================================
260 //=====================================================================================
263 bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
264 {return BuildGUI::OnGUIEvent(theCommandID, parent);}