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_Gen::ListOfIOR& listShapesIOR,
168 const Standard_Boolean wantPlanar)
171 GEOM::GEOM_Shape_var result = myGeom->MakeFace(listShapesIOR, wantPlanar);
172 if(result->_is_nil()) {
173 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
177 result->NameType(tr("GEOM_PLANE"));
179 result->NameType(tr("GEOM_FACE"));
180 if(myGeomBase->Display(result))
181 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
183 catch(const SALOME::SALOME_Exception& S_ex) {
184 QtCatchCorbaException(S_ex);
190 //=====================================================================================
191 // function : MakeShellAndDisplay()
193 //=====================================================================================
194 void BuildGUI::MakeShellAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
197 GEOM::GEOM_Shape_var result = myGeom->MakeShell(listShapesIOR);
198 if(result->_is_nil()) {
199 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
202 result->NameType(tr("GEOM_SHELL"));
203 if(myGeomBase->Display(result))
204 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
206 catch(const SALOME::SALOME_Exception& S_ex) {
207 QtCatchCorbaException(S_ex);
213 //=====================================================================================
214 // function : MakeSolidAndDisplay()
216 //=====================================================================================
217 void BuildGUI::MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
220 GEOM::GEOM_Shape_var result = myGeom->MakeSolid(listShapesIOR);
221 if(result->_is_nil()) {
222 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
225 result->NameType(tr("GEOM_SOLID"));
226 if(myGeomBase->Display(result))
227 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
229 catch(const SALOME::SALOME_Exception& S_ex) {
230 QtCatchCorbaException(S_ex);
236 //=====================================================================================
237 // function : MakeCompoundAndDisplay()
239 //=====================================================================================
240 void BuildGUI::MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
243 GEOM::GEOM_Shape_var result = myGeom->MakeCompound(listShapesIOR);
244 if(result->_is_nil()) {
245 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
248 result->NameType(tr("GEOM_COMPOUND"));
249 if(myGeomBase->Display(result))
250 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
252 catch(const SALOME::SALOME_Exception& S_ex) {
253 QtCatchCorbaException(S_ex);
259 //=====================================================================================
261 //=====================================================================================
264 bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
265 {return BuildGUI::OnGUIEvent(theCommandID, parent);}