Salome HOME
mask traces
[modules/hydro.git] / src / HYDROData / HYDROData_Polyline3D.cxx
index 858a0a6c7b73641ecef7d6b5231707b8c1488308..7ce105bb3877014a583ff8a5dc6b632f074e60e5 100644 (file)
@@ -50,7 +50,7 @@
 
 #include <TopTools_SequenceOfShape.hxx>
 
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
 #include <QColor>
@@ -153,14 +153,14 @@ void HYDROData_Polyline3D::Update()
 
   bool anIsSectionClosed = aPolylineXY->IsClosedSection( 0 );
   HYDROData_IPolyline::SectionType aSectionType = aPolylineXY->GetSectionType( 0 );
-  NCollection_Sequence<Polyline3DPoint> aResPoints = GetProfilePoints3D();
+  NCollection_Sequence<Polyline3DPoint> aResPoints = GetProfilePoints3D(false);
 
   TopoDS_Wire aResWire = HYDROData_PolylineXY::BuildWire( aSectionType, anIsSectionClosed, aResPoints );
   SetTopShape( aResWire );
   SetShape3D( aResWire );
 } 
 
-HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetProfilePoints3D()
+HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetProfilePoints3D(bool IsConvertToGlobal)
 {
   Handle(HYDROData_PolylineXY) aPolylineXY = GetPolylineXY();
   if ( aPolylineXY.IsNull() )
@@ -213,6 +213,15 @@ HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetProfilePoints3D(
   // Add last point as is
   aResPoints.Append( Polyline3DPoint( aLastPoint.X(), aLastPoint.Y(), aLastParPoint.Y() ) );
 
+  if (IsConvertToGlobal)
+  {
+    Handle(HYDROData_Document) aDoc = HYDROData_Document::Document();
+    for (int i=1;i<=aResPoints.Size();i++)
+    {
+      gp_XYZ& point = aResPoints.ChangeValue(i);
+      aDoc->Transform( point, false );
+    }
+  }
   return aResPoints;
 }
 
@@ -340,7 +349,7 @@ Handle(HYDROData_ProfileUZ) HYDROData_Polyline3D::GetChildProfileUZ( const bool
   if ( !theIsCreate || !aProfileUZ.IsNull() )
     return aProfileUZ;
 
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document();
   if ( aDocument.IsNull() )
     return aProfileUZ;