Salome HOME
export of 3D poly to SHP (lot 5)
[modules/hydro.git] / src / HYDROData / HYDROData_Polyline3D.cxx
index 15959d971f698ca5499aa347c7d7f3dc604470af..858a0a6c7b73641ecef7d6b5231707b8c1488308 100644 (file)
@@ -153,9 +153,22 @@ void HYDROData_Polyline3D::Update()
 
   bool anIsSectionClosed = aPolylineXY->IsClosedSection( 0 );
   HYDROData_IPolyline::SectionType aSectionType = aPolylineXY->GetSectionType( 0 );
+  NCollection_Sequence<Polyline3DPoint> aResPoints = GetProfilePoints3D();
+
+  TopoDS_Wire aResWire = HYDROData_PolylineXY::BuildWire( aSectionType, anIsSectionClosed, aResPoints );
+  SetTopShape( aResWire );
+  SetShape3D( aResWire );
+} 
+
+HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetProfilePoints3D()
+{
+  Handle(HYDROData_PolylineXY) aPolylineXY = GetPolylineXY();
+  if ( aPolylineXY.IsNull() )
+    return Polyline3DPoints();
+
   HYDROData_IPolyline::PointsList aPolylinePoints = aPolylineXY->GetPoints( 0 );
   if ( aPolylinePoints.IsEmpty() )
-    return;
+    return Polyline3DPoints();
 
   Handle(HYDROData_ProfileUZ) aProfileUZ = GetProfileUZ();
 
@@ -164,11 +177,11 @@ void HYDROData_Polyline3D::Update()
     aProfileUZ = GetChildProfileUZ();
 
   if ( aProfileUZ.IsNull() )
-    return;
+    return Polyline3DPoints();
 
   HYDROData_IPolyline::PointsList aProfilePoints = aProfileUZ->GetPoints();
   if ( aProfilePoints.IsEmpty() )
-    return;
+    return NCollection_Sequence<HYDROData_Polyline3D::Polyline3DPoint>();
 
   const HYDROData_IPolyline::Point& aFirstPoint = aPolylinePoints.First();
   const HYDROData_IPolyline::Point& aLastPoint = aPolylinePoints.Last();
@@ -200,10 +213,8 @@ void HYDROData_Polyline3D::Update()
   // Add last point as is
   aResPoints.Append( Polyline3DPoint( aLastPoint.X(), aLastPoint.Y(), aLastParPoint.Y() ) );
 
-  TopoDS_Wire aResWire = HYDROData_PolylineXY::BuildWire( aSectionType, anIsSectionClosed, aResPoints );
-  SetTopShape( aResWire );
-  SetShape3D( aResWire );
-} 
+  return aResPoints;
+}
 
 QColor HYDROData_Polyline3D::DefaultFillingColor() const
 {