]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Dump of calculation case to python partialy implemented.
authoradv <adv@opencascade.com>
Thu, 16 Jan 2014 11:44:56 +0000 (11:44 +0000)
committeradv <adv@opencascade.com>
Thu, 16 Jan 2014 11:44:56 +0000 (11:44 +0000)
src/HYDROData/HYDROData_CalculationCase.cxx

index 7beedc8dc2d056a1c44810a2dccf00180f366845..bfce3af46610d7a9b3923c18d25fa08c2030d7f1 100644 (file)
@@ -107,6 +107,7 @@ void HYDROData_CalculationCase::SetName( const QString& theName )
 QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
   QStringList aResList = dumpObjectCreation( theTreatedObjects );
+
   QString aCalculName = GetObjPyName();
 
   HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
@@ -115,12 +116,39 @@ QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTre
   {
     Handle(HYDROData_Object) aRefGeomObj =
       Handle(HYDROData_Object)::DownCast( anIter.Value() );
-    if ( !aRefGeomObj.IsNull() )
-      setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
+    setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
+  }
+  aResList << QString( "" );
+
+  QString aGroupName = HYDROData_Tool::GenerateNameForPython( theTreatedObjects, "case_geom_group" );
+
+  HYDROData_SequenceOfObjects aGeomGroups = GetGeometryGroups();
+  anIter.Init( aGeomGroups );
+  for ( ; anIter.More(); anIter.Next() )
+  {
+    Handle(HYDROData_ShapesGroup) aGeomGroup =
+      Handle(HYDROData_ShapesGroup)::DownCast( anIter.Value() );
+    if ( aGeomGroup.IsNull() )
+      continue;
+
+    Handle(HYDROData_Object) aFatherGeom =
+      Handle(HYDROData_Object)::DownCast( aGeomGroup->GetFatherObject() );
+    if ( aFatherGeom.IsNull() )
+      continue;
+
+    int aGroupId = aFatherGeom->GetGroupId( aGeomGroup );
+    aResList << QString( "%1 = %2.GetGroup( %3 );" )
+              .arg( aGroupName ).arg( aFatherGeom->GetObjPyName() ).arg( aGroupId );
+
+    aResList << QString( "%1.AddGeometryGroup( %2 );" ).arg( aCalculName ).arg( aGroupName );
   }
   aResList << QString( "" );
 
-  aResList << QString( "%1.SplitGeometryObjects();" ).arg( aCalculName );
+  Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
+  setPythonReferenceObject( theTreatedObjects, aResList, aBoundaryPolyline, "SetBoundaryPolyline" );
+  aResList << QString( "" );
+
+  aResList << QString( "%1.Update();" ).arg( aCalculName );
   aResList << QString( "" );
 
   // Now we restore the regions and zones order
@@ -134,11 +162,19 @@ QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTre
       continue;
 
     QString aRegionName = aRegion->GetName();
-    // TODO
-  }
 
-  aResList << QString( "" );
-  aResList << QString( "%1.Update();" ).arg( aCalculName );
+    HYDROData_SequenceOfObjects aZones = aRegion->GetZones();
+    HYDROData_SequenceOfObjects::Iterator aZonesIter( aZones );
+    for ( ; aZonesIter.More(); aZonesIter.Next() )
+    {
+      Handle(HYDROData_Zone) aRegZone =
+        Handle(HYDROData_Zone)::DownCast( aZonesIter.Value() );
+      if ( aRegZone.IsNull() )
+        continue;
+
+      // TODO
+    }
+  }
   aResList << QString( "" );
 
   return aResList;