Salome HOME
The data model has been rolled back to previous version.
[modules/hydro.git] / src / HYDROData / HYDROData_Polyline.cxx
index 8e6b3d766f00ac112d036f6670709b591bf367bc..c88500016d63b6b7988316f23ba52ef6bbdd3042 100755 (executable)
@@ -23,6 +23,8 @@
 #include <TopoDS.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Wire.hxx>
+#include <BRep_Builder.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
 
 #include <QStringList>
 
@@ -397,6 +399,8 @@ void HYDROData_Polyline::UpdateWire( const PolylineData& theSections )
 
   double aZValue = ZValue();
 
+  TopTools_ListOfShape aSectionWiresList;
+
   int aSectionCount = theSections.size();
   for( int aSectionId = 0; aSectionId < aSectionCount; aSectionId++ )
   {
@@ -444,10 +448,25 @@ void HYDROData_Polyline::UpdateWire( const PolylineData& theSections )
         aMakeSectionWire.Add( anEdge );
       }
       TopoDS_Wire aSectionWire = aMakeSectionWire.Wire();
+      aSectionWiresList.Append( aSectionWire );
       aMakeWire.Add( aSectionWire );
     }
   }
 
-  TopoDS_Shape aShape = aMakeWire.Shape();
+  TopoDS_Shape aShape;
+  if ( aMakeWire.IsDone() ) {
+    aShape = aMakeWire.Shape();
+  } else {
+    // build compound
+    TopoDS_Compound aCompound;
+    BRep_Builder aBuilder;
+    aBuilder.MakeCompound( aCompound );
+    TopTools_ListIteratorOfListOfShape anIter( aSectionWiresList );
+    for ( ; anIter.More(); anIter.Next() ) {
+      aBuilder.Add( aCompound, anIter.Value() );
+    }
+    aShape = aCompound;
+  }
+
   SetTopShape( aShape );
 }