From: adv Date: Thu, 16 Jan 2014 11:44:56 +0000 (+0000) Subject: Dump of calculation case to python partialy implemented. X-Git-Tag: BR_hydro_v_1_0~79 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=588778e6312f2266cc8b571d6433e8a340cfe8e9;p=modules%2Fhydro.git Dump of calculation case to python partialy implemented. --- diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 7beedc8d..bfce3af4 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -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;