]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Dump to python corrected.
authoradv <adv@opencascade.com>
Fri, 17 Jan 2014 06:34:54 +0000 (06:34 +0000)
committeradv <adv@opencascade.com>
Fri, 17 Jan 2014 06:34:54 +0000 (06:34 +0000)
src/HYDROData/HYDROData_Polyline3D.cxx

index d5a9425ef1d42dcb1fca13ec4a9a14a0960ce878..c8549930cf3ea682cb7b7e9ca7d898210d78911a 100644 (file)
@@ -34,19 +34,34 @@ HYDROData_Polyline3D::~HYDROData_Polyline3D()
 QStringList HYDROData_Polyline3D::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
   QStringList aResList = dumpObjectCreation( theTreatedObjects );
-  QString aName = GetObjPyName();
+  QString aPolylineName = GetObjPyName();
 
   Handle(HYDROData_PolylineXY) aRefPolyline = GetPolylineXY();
   setPythonReferenceObject( theTreatedObjects, aResList, aRefPolyline, "SetPolylineXY" );
 
-  Handle(HYDROData_ProfileUZ) aRefProfile = GetProfileUZ();
-  setPythonReferenceObject( theTreatedObjects, aResList, aRefProfile, "SetProfileUZ" );
-
-  Handle(HYDROData_IAltitudeObject) aRefBathymetry = GetAltitudeObject();
-  setPythonReferenceObject( theTreatedObjects, aResList, aRefBathymetry, "SetAltitudeObject" );
+  Handle(HYDROData_ProfileUZ) aRefProfileUZ = GetProfileUZ();
+  if ( !aRefProfileUZ.IsNull() )
+  {
+    Handle(HYDROData_Profile) aProfile = 
+      Handle(HYDROData_Profile)::DownCast( aRefProfileUZ->GetFatherObject() );
+    if ( !aProfile.IsNull() )
+    {
+      QString aProfileName = aProfile->GetObjPyName();
+      if ( !aProfileName.isEmpty() )
+      {
+        aResList << QString( "%1.SetProfileUZ( %2.GetProfileUZ() );" )
+                     .arg( aPolylineName ).arg( aProfileName );
+      }
+    }
+  }
+  else
+  {
+    Handle(HYDROData_IAltitudeObject) aRefBathymetry = GetAltitudeObject();
+    setPythonReferenceObject( theTreatedObjects, aResList, aRefBathymetry, "SetAltitudeObject" );
+  }
 
   aResList << QString( "" );
-  aResList << QString( "%1.Update();" ).arg( aName );
+  aResList << QString( "%1.Update();" ).arg( aPolylineName );
   aResList << QString( "" );
 
   return aResList;