]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Implement improvement PAL13394: disk building from circle
authorrnv <rnv@opencascade.com>
Wed, 27 Sep 2006 11:17:03 +0000 (11:17 +0000)
committerrnv <rnv@opencascade.com>
Wed, 27 Sep 2006 11:17:03 +0000 (11:17 +0000)
src/BuildGUI/BuildGUI_FaceDlg.cxx
src/GEOMGUI/GEOM_msg_en.po
src/GEOMImpl/GEOMImpl_ShapeDriver.cxx

index 36d8605a98b90e8974001bb2054ac281f2620dd9..953c54f8f22e50e405b4a11ae012e8377af84676 100644 (file)
@@ -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 );
 }
 
 
index 721eef1bb4d88eb662b762db8aa4dd6b1f42e6a9..57a0ada9645a36dedaed0a2bbc650f58dd9ec9c5 100644 (file)
@@ -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"
index 019ad172b60e5c8db016fa2b2dec9e2ca67c850c..dc199ffee5d209d0580085ee477ae12220750d89 100644 (file)
@@ -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();