From: rnv Date: Wed, 27 Sep 2006 11:17:03 +0000 (+0000) Subject: Implement improvement PAL13394: disk building from circle X-Git-Tag: V3_2_3pre1~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=70cba03a1c3f62c5cf6a772ea8dd2c28ee57c5eb;p=modules%2Fgeom.git Implement improvement PAL13394: disk building from circle --- diff --git a/src/BuildGUI/BuildGUI_FaceDlg.cxx b/src/BuildGUI/BuildGUI_FaceDlg.cxx index 36d8605a9..953c54f8f 100644 --- a/src/BuildGUI/BuildGUI_FaceDlg.cxx +++ b/src/BuildGUI/BuildGUI_FaceDlg.cxx @@ -28,6 +28,7 @@ #include "BuildGUI_FaceDlg.h" #include "GEOMImpl_Types.hxx" +#include "TColStd_MapOfInteger.hxx" #include "SUIT_Session.h" #include "SalomeApp_Application.h" @@ -64,7 +65,7 @@ BuildGUI_FaceDlg::BuildGUI_FaceDlg(GeometryGUI* theGeometryGUI, QWidget* parent, GroupWire = new DlgRef_1Sel1Check_QTD(this, "GroupWire"); GroupWire->GroupBox1->setTitle(tr("GEOM_FACE_FFW")); - GroupWire->TextLabel1->setText(tr("GEOM_WIRES")); + GroupWire->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupWire->CheckButton1->setText(tr("GEOM_FACE_OPT")); GroupWire->PushButton1->setPixmap(image1); @@ -100,7 +101,10 @@ void BuildGUI_FaceDlg::Init() GroupWire->CheckButton1->setChecked(TRUE); - globalSelection( GEOM_WIRE ); + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_EDGE ); + aMap.Add( GEOM_WIRE ); + globalSelection( aMap ); /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); @@ -160,7 +164,7 @@ void BuildGUI_FaceDlg::SelectionIntoArgument() if (!myWires.length()) return; if(aNbSel != 1) - aName = tr("%1_wires").arg(aNbSel); + aName = tr("%1_objects").arg(aNbSel); myEditCurrentArgument->setText( aName ); @@ -178,7 +182,11 @@ void BuildGUI_FaceDlg::SetEditCurrentArgument() if (send != GroupWire->PushButton1) return; - globalSelection( GEOM_WIRE ); + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_EDGE ); + aMap.Add( GEOM_WIRE ); + globalSelection( aMap ); + myEditCurrentArgument = GroupWire->LineEdit1; myEditCurrentArgument->setFocus(); @@ -195,7 +203,10 @@ void BuildGUI_FaceDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; - globalSelection( GEOM_WIRE ); + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_EDGE ); + aMap.Add( GEOM_WIRE ); + globalSelection( aMap ); } diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 721eef1bb..57a0ada96 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -903,7 +903,7 @@ msgstr "Create A Face" #: GeometryGUI_FaceDlg.cxx:78 msgid "GEOM_FACE_FFW" -msgstr "Face from a wire" +msgstr "Face from a closed wire and edge" #: GeometryGUI_FaceDlg.cxx:103 msgid "GEOM_FACE_OPT" diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx index 019ad172b..dc199ffee 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -170,8 +170,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const if (!MW.IsDone()) { Standard_ConstructionError::Raise("Wire construction failed"); } - //W = TopoDS::Wire(aShapeBase); - W = MW; + W = MW; } else { Standard_NullObject::Raise @@ -189,17 +188,30 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const Standard_ConstructionError::Raise("No wires given"); } - // first wire + // first wire or edge Handle(GEOM_Function) aRefWire = Handle(GEOM_Function)::DownCast(aShapes->Value(1)); TopoDS_Shape aWire = aRefWire->GetValue(); - if (aWire.IsNull() || aWire.ShapeType() != TopAbs_WIRE) { - Standard_NullObject::Raise("Shape for face construction is null or not a wire"); + if (aWire.IsNull()) Standard_NullObject::Raise("Argument Shape is null"); + TopoDS_Wire W1; + if(aWire.ShapeType() == TopAbs_WIRE) { + W1 = TopoDS::Wire(aWire); + } + else if(aWire.ShapeType() == TopAbs_EDGE && aWire.Closed()) { + BRepBuilderAPI_MakeWire MW; + MW.Add(TopoDS::Edge(aWire)); + if (!MW.IsDone()) { + Standard_ConstructionError::Raise("Wire construction failed"); + } + W1 = MW; + } + else { + Standard_NullObject::Raise + ("Shape for face construction is neither a wire nor closed edge"); } - TopoDS_Wire W = TopoDS::Wire(aWire); // basic face TopoDS_Shape FFace; - GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), FFace); + GEOMImpl_Block6Explorer::MakeFace(W1, aCI.GetIsPlanar(), FFace); if (FFace.IsNull()) { Standard_ConstructionError::Raise("Face construction failed"); } @@ -221,11 +233,24 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const Handle(GEOM_Function) aRefWire_i = Handle(GEOM_Function)::DownCast(aShapes->Value(ind)); TopoDS_Shape aWire_i = aRefWire_i->GetValue(); - if (aWire_i.IsNull() || aWire_i.ShapeType() != TopAbs_WIRE) { - Standard_NullObject::Raise("Shape for face construction is null or not a wire"); - } - - FR.Add(TopoDS::Wire(aWire_i)); + if (aWire_i.IsNull()) Standard_NullObject::Raise("Argument Shape is null"); + TopoDS_Wire W_i; + if(aWire_i.ShapeType() == TopAbs_WIRE) { + W_i = TopoDS::Wire(aWire_i); + } + else if(aWire_i.ShapeType() == TopAbs_EDGE && aWire_i.Closed()) { + BRepBuilderAPI_MakeWire MW1; + MW1.Add(TopoDS::Edge(aWire_i)); + if (!MW1.IsDone()) { + Standard_ConstructionError::Raise("Wire construction failed"); + } + W_i = MW1; + } + else { + Standard_NullObject::Raise + ("Shape for face construction is neither a wire nor closed edges"); + } + FR.Add(W_i); } FR.Perform();