Salome HOME
The data model has been rolled back to previous version.
[modules/hydro.git] / src / HYDROData / HYDROData_Polyline.cxx
index abac653b3d138eecfc95ddddebfaf99e4d32bf60..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>
 
@@ -62,7 +64,7 @@ QStringList HYDROData_Polyline::DumpToPython( MapOfTreatedObjects& theTreatedObj
 {
   QStringList aResList;
 
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
   if ( aDocument.IsNull() )
     return aResList;
                              
@@ -78,7 +80,7 @@ QStringList HYDROData_Polyline::DumpToPython( MapOfTreatedObjects& theTreatedObj
   aResList << QString( "" );
 
   int aDim = GetDimension();
-  aResList << QString( "%1.setDimension( %2 );" )
+  aResList << QString( "%1.SetDimension( %2 );" )
               .arg( aPolylineName ).arg( aDim );
 
   // Set polilyne data
@@ -121,8 +123,9 @@ QStringList HYDROData_Polyline::DumpToPython( MapOfTreatedObjects& theTreatedObj
       aResList << QString( "%1.append( %2 );" )
                   .arg( aPolylineDataName ).arg( aPolylineSectName );
     }
+    aResList << QString( "" );
 
-    aResList << QString( "%1.setPolylineData( %2 );" )
+    aResList << QString( "%1.SetPolylineData( %2 );" )
                   .arg( aPolylineName ).arg( aPolylineDataName );
   }
 
@@ -396,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++ )
   {
@@ -443,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_Wire aWire = aMakeWire.Wire();
-  SetTopShape( aWire );
+  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 );
 }