Salome HOME
merge master
[modules/hydro.git] / src / HYDROData / HYDROData_CalculationCase.cxx
index 6c4239054597b9bc78597bc808343bfec3061902..58d15770f88c2b5172aaafee04b51771aede958e 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#ifdef WIN32
-  #pragma warning ( disable: 4251 )
-#endif
-
 #include "HYDROData_CalculationCase.h"
 #include "HYDROData_ArtificialObject.h"
 #include "HYDROData_IAltitudeObject.h"
 #include "HYDROData_NaturalObject.h"
 #include "HYDROData_PolylineXY.h"
 #include "HYDROData_StricklerTable.h"
-#include "HYDROData_SplittedShapesGroup.h"
+#include "HYDROData_LandCoverMap.h"
+#include "HYDROData_SplitShapesGroup.h"
 #include "HYDROData_Region.h"
 #include "HYDROData_Tool.h"
 #include "HYDROData_GeomTool.h"
 
+#ifdef WIN32
+  #pragma warning ( disable: 4251 )
+#endif
+
 #ifndef LIGHT_MODE
 #include <GEOMBase.h>
 #endif
 
+#ifdef WIN32
+  #pragma warning ( default: 4251 )
+#endif
+
 #include <QSet>
 
 #include <TopoDS.hxx>
 #include <BRepBuilderAPI_MakeVertex.hxx>
 #endif
 
-#ifdef WIN32
-  #pragma warning ( default: 4251 )
-#endif
-
 #define EXPORT_NAME "HYDRO_" + GetName()
 
+#include <SALOME_NamingService.hxx>
+#include <SALOME_LifeCycleCORBA.hxx>
+
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 IMPLEMENT_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_CalculationCase, HYDROData_Entity)
 
 HYDROData_CalculationCase::HYDROData_CalculationCase()
-: HYDROData_Entity()
+: HYDROData_Entity( Geom_2d_and_groups )
 {
 }
 
@@ -96,14 +103,14 @@ void HYDROData_CalculationCase::SetName( const QString& theName )
     // Update names of regions and its zones
     UpdateRegionsNames( GetRegions(), anOldCaseName, theName );
 
-    HYDROData_SequenceOfObjects aGroups = GetSplittedGroups();
+    HYDROData_SequenceOfObjects aGroups = GetSplitGroups();
 
     HYDROData_SequenceOfObjects::Iterator anIter;
     anIter.Init( aGroups );
     for ( ; anIter.More(); anIter.Next() )
     {
-      Handle(HYDROData_SplittedShapesGroup) aGroup =
-        Handle(HYDROData_SplittedShapesGroup)::DownCast( anIter.Value() );
+      Handle(HYDROData_SplitShapesGroup) aGroup =
+        Handle(HYDROData_SplitShapesGroup)::DownCast( anIter.Value() );
       if ( aGroup.IsNull() )
         continue;
 
@@ -114,7 +121,8 @@ void HYDROData_CalculationCase::SetName( const QString& theName )
   HYDROData_Entity::SetName( theName );
 }
 
-QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+QStringList HYDROData_CalculationCase::DumpToPython( const QString&       thePyScriptPath,
+                                                     MapOfTreatedObjects& theTreatedObjects ) const
 {
   QStringList aResList = dumpObjectCreation( theTreatedObjects );
   aResList.prepend( "# Calculation case" );
@@ -131,7 +139,7 @@ QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTre
   {
     Handle(HYDROData_Object) aRefGeomObj =
       Handle(HYDROData_Object)::DownCast( anIter.Value() );
-    setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
+    setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
   }
   aResList << QString( "" );
 
@@ -159,7 +167,7 @@ QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTre
   }
 
   Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline();
-  setPythonReferenceObject( theTreatedObjects, aResList, aBoundaryPolyline, "SetBoundaryPolyline" );
+  setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aBoundaryPolyline, "SetBoundaryPolyline" );
 
   if( aMode==AUTOMATIC )
     DumpRulesToPython( aCalculName, aResList );
@@ -172,7 +180,7 @@ QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTre
   {
     // Now we restore the
     // - regions and zones order
-    DumpRegionsToPython( aResList, theTreatedObjects, GetRegions() );   
+    DumpRegionsToPython( aResList, thePyScriptPath, theTreatedObjects, GetRegions() );   
   }
 
   // Export calculation case
@@ -244,6 +252,9 @@ HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetAllReferenceObjects()
   if ( !aBoundaryPolyline.IsNull() )
     aResSeq.Append( aBoundaryPolyline );
 
+  HYDROData_SequenceOfObjects aSeqOfGeomObjs = GetGeometryObjects();
+  aResSeq.Append( aSeqOfGeomObjs );
+
   // Regions
   HYDROData_SequenceOfObjects aSeqOfRegions = GetRegions();
   aResSeq.Append( aSeqOfRegions );
@@ -258,7 +269,7 @@ void HYDROData_CalculationCase::Update()
 
   // At first we remove previously created objects
   RemoveRegions();
-  RemoveSplittedGroups();
+  RemoveSplitGroups();
 
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
   if ( aDocument.IsNull() )
@@ -321,6 +332,7 @@ void HYDROData_CalculationCase::CreateRegionsDef( const Handle(HYDROData_Documen
 void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc,
                                                    const HYDROData_SplitToZonesTool::SplitDataList& theZones )
 {
+  DEBTRACE("HYDROData_CalculationCase::CreateRegionsAuto");
   QMap<QString, Handle(HYDROData_Region)> aRegionsMap; //object name to region
   QMap<QString, QString> aRegionNameToObjNameMap;
   QString aZonesPref = CALCULATION_ZONES_PREF;
@@ -363,6 +375,7 @@ void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Docume
     Handle(HYDROData_Entity) aMergeEntity = aRegObj;
     Handle(HYDROData_Object) aMergeObject = Handle(HYDROData_Object)::DownCast( aMergeEntity );
     if ( !aMergeObject.IsNull() ) {
+      DEBTRACE("aMergeEntity " << aMergeEntity->GetName().toStdString());
       aMergeEntity = aMergeObject->GetAltitudeObject();
     }
 
@@ -404,7 +417,7 @@ void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Docume
 void HYDROData_CalculationCase::CreateEdgeGroupsDef( const Handle(HYDROData_Document)& theDoc,
                                                      const HYDROData_SplitToZonesTool::SplitDataList& theEdges )
 {
-  QMap<QString,Handle(HYDROData_SplittedShapesGroup)> aSplittedEdgesGroupsMap;
+  QMap<QString,Handle(HYDROData_SplitShapesGroup)> aSplitEdgesGroupsMap;
 
   HYDROData_SplitToZonesTool::SplitDataListIterator anIter( theEdges );
   while( anIter.hasNext() )
@@ -421,20 +434,20 @@ void HYDROData_CalculationCase::CreateEdgeGroupsDef( const Handle(HYDROData_Docu
     QString aStr = aSplitData.ObjectNames.join(" "); 
          cout << " CCase: Names = "<<aStr.toStdString() << " size = " <<aSplitData.ObjectNames.size() <<endl; 
 #endif
-    Handle(HYDROData_SplittedShapesGroup) aSplittedGroup;
-    if ( !aSplittedEdgesGroupsMap.contains( anObjName ) )
+    Handle(HYDROData_SplitShapesGroup) aSplitGroup;
+    if ( !aSplitEdgesGroupsMap.contains( anObjName ) )
     {
-      aSplittedGroup = addNewSplittedGroup( CALCULATION_GROUPS_PREF + anObjName );
-      aSplittedEdgesGroupsMap.insert( anObjName, aSplittedGroup );
+      aSplitGroup = addNewSplitGroup( CALCULATION_GROUPS_PREF + anObjName );
+      aSplitEdgesGroupsMap.insert( anObjName, aSplitGroup );
     }
     else
     {
-      aSplittedGroup = aSplittedEdgesGroupsMap[ anObjName ];
+      aSplitGroup = aSplitEdgesGroupsMap[ anObjName ];
     }
-    if ( aSplittedGroup.IsNull() )
+    if ( aSplitGroup.IsNull() )
       continue;
 
-    aSplittedGroup->AddShape( aSplitData.Shape );
+    aSplitGroup->AddShape( aSplitData.Shape );
   }
 }
 
@@ -449,7 +462,7 @@ bool HYDROData_CalculationCase::AddGeometryObject( const Handle(HYDROData_Object
   AddReferenceObject( theObject, DataTag_GeometryObject );
   
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_2d );
 
   return true;
 }
@@ -467,7 +480,7 @@ void HYDROData_CalculationCase::RemoveGeometryObject( const Handle(HYDROData_Obj
   RemoveReferenceObject( theObject->Label(), DataTag_GeometryObject );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_CalculationCase::RemoveGeometryObjects()
@@ -475,7 +488,7 @@ void HYDROData_CalculationCase::RemoveGeometryObjects()
   ClearReferenceObjects( DataTag_GeometryObject );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 bool HYDROData_CalculationCase::AddGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup )
@@ -489,7 +502,7 @@ bool HYDROData_CalculationCase::AddGeometryGroup( const Handle(HYDROData_ShapesG
   AddReferenceObject( theGroup, DataTag_GeometryGroup );
   
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_Groups );
 
   return true;
 }
@@ -507,7 +520,7 @@ void HYDROData_CalculationCase::RemoveGeometryGroup( const Handle(HYDROData_Shap
   RemoveReferenceObject( theGroup->Label(), DataTag_GeometryGroup );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_Groups );
 }
 
 void HYDROData_CalculationCase::RemoveGeometryGroups()
@@ -515,7 +528,7 @@ void HYDROData_CalculationCase::RemoveGeometryGroups()
   ClearReferenceObjects( DataTag_GeometryGroup );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_Groups );
 }
 
 void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline )
@@ -525,7 +538,8 @@ void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_Poly
   SetReferenceObject( thePolyline, DataTag_Polyline );
 
   // Indicate model of the need to update zones splitting
-  SetToUpdate( !IsEqual( aPrevPolyline, thePolyline ) || IsMustBeUpdated() );
+  if( !IsEqual( aPrevPolyline, thePolyline ) )
+    Changed( Geom_2d );
 }
 
 Handle(HYDROData_PolylineXY) HYDROData_CalculationCase::GetBoundaryPolyline() const
@@ -541,7 +555,7 @@ void HYDROData_CalculationCase::RemoveBoundaryPolyline()
   ClearReferenceObjects( DataTag_Polyline );
 
   // Indicate model of the need to update zones splitting
-  SetToUpdate( !aPrevPolyline.IsNull() || IsMustBeUpdated() );
+  Changed( Geom_2d );
 }
 
 void HYDROData_CalculationCase::SetStricklerTable( const Handle(HYDROData_StricklerTable)& theStricklerTable )
@@ -551,7 +565,8 @@ void HYDROData_CalculationCase::SetStricklerTable( const Handle(HYDROData_Strick
   SetReferenceObject( theStricklerTable, DataTag_StricklerTable );
 
   // Indicate model of the need to update land covers partition
-  SetToUpdate( !IsEqual( aPrevStricklerTable, theStricklerTable ) || IsMustBeUpdated() );
+  if( !IsEqual( aPrevStricklerTable, theStricklerTable ) )
+    Changed( Geom_No );
 }
 
 Handle(HYDROData_StricklerTable) HYDROData_CalculationCase::GetStricklerTable() const
@@ -567,11 +582,26 @@ void HYDROData_CalculationCase::RemoveStricklerTable()
   ClearReferenceObjects( DataTag_StricklerTable );
 
   // Indicate model of the need to update land covers partition
-  SetToUpdate( !aPrevStricklerTable.IsNull() || IsMustBeUpdated() );
+  Changed( Geom_No );
+}
+
+Handle(HYDROData_LandCoverMap) HYDROData_CalculationCase::GetLandCoverMap() const
+{
+  Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast(
+    GetReferenceObject( DataTag_LandCoverMap ) );
+  return aMap;
+}
+
+void HYDROData_CalculationCase::SetLandCoverMap( const Handle(HYDROData_LandCoverMap)& theMap )
+{
+  SetReferenceObject( theMap, DataTag_LandCoverMap );
 }
 
 Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone )
 {
+  Changed( Geom_No );
+  Changed( Geom_No );
+  Changed( Geom_No );
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
   Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF );
   if ( aNewRegion.IsNull() )
@@ -672,14 +702,14 @@ void HYDROData_CalculationCase::RemoveRegions()
   myLab.FindChild( DataTag_ChildRegion ).ForgetAllAttributes();
 }
 
-HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetSplittedGroups() const
+HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetSplitGroups() const
 {
-  return GetReferenceObjects( DataTag_SplittedGroups );
+  return GetReferenceObjects( DataTag_SplitGroups );
 }
 
-void HYDROData_CalculationCase::RemoveSplittedGroups()
+void HYDROData_CalculationCase::RemoveSplitGroups()
 {
-  myLab.FindChild( DataTag_SplittedGroups ).ForgetAllAttributes();
+  myLab.FindChild( DataTag_SplitGroups ).ForgetAllAttributes();
 }
 
 double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint ) const
@@ -696,10 +726,20 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
   Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint );
   if ( !aZone.IsNull() )
   {
+    //DEBTRACE("GetAltitudeForPoint Region " << theRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString());
     Handle(HYDROData_Region) aRefRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() );
     if ( IsEqual( aRefRegion, theRegion ) )
       aResAltitude = GetAltitudeForPoint( thePoint, aZone );
+    else
+      {
+        DEBTRACE("GetAltitudeForPoint Region " << aRefRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString() << " ---------------------------");
+        aResAltitude = GetAltitudeForPoint( thePoint, aZone );
+      }
   }
+  else
+    {
+      DEBTRACE(" --- GetAltitudeForPoint No Zone ---");
+    }
 
   return aResAltitude;
 }
@@ -707,17 +747,24 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
 double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&                  thePoint,
                                                        const Handle(HYDROData_Zone)& theZone ) const
 {
+  //DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString());
   double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude();
   if ( theZone.IsNull() )
+  {
+       DEBTRACE("Zone nulle");
     return aResAltitude;
+  }
 
   HYDROData_Zone::MergeType aZoneMergeType = theZone->GetMergeType();
+  //DEBTRACE("aZoneMergeType " << aZoneMergeType);
   if ( !theZone->IsMergingNeed() )
   {
     aZoneMergeType = HYDROData_Zone::Merge_UNKNOWN;
+    //DEBTRACE("---");
   }
   else if ( aZoneMergeType == HYDROData_Zone::Merge_UNKNOWN )
   {
+       DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString() << " Merge_UNKNOWN");
     return aResAltitude;
   }
 
@@ -730,15 +777,20 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
     {
       if ( aZoneInterpolator != NULL )
       {
+       DEBTRACE("aZoneInterpolator != NULL");
         aZoneInterpolator->SetAltitudeObject( aMergeAltitude );
         aResAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
       }
       else
+      {
+       DEBTRACE("aZoneInterpolator == NULL");
         aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint );
+      }
     }
   }
   else
   {
+       //DEBTRACE("aZoneMergeType != HYDROData_Zone::Merge_Object");
     HYDROData_SequenceOfObjects aZoneObjects = theZone->GetObjects();
     HYDROData_SequenceOfObjects::Iterator anIter( aZoneObjects );
     for ( ; anIter.More(); anIter.Next() )
@@ -755,11 +807,15 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY&
       double aPointAltitude = 0.0;
       if ( aZoneInterpolator != NULL )
       {
+       DEBTRACE("aZoneInterpolator != NULL");
         aZoneInterpolator->SetAltitudeObject( anObjAltitude );
         aPointAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
       }
       else
+      {
+       //DEBTRACE("aZoneInterpolator == NULL");
         aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint );
+      }
 
       if ( ValuesEquals( aPointAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) )
         continue;
@@ -795,6 +851,7 @@ NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
   const NCollection_Sequence<gp_XY>& thePoints,
   const Handle(HYDROData_Region)&    theRegion ) const
 {
+  //DEBTRACE("HYDROData_CalculationCase::GetAltitudesForPoints " << theRegion->GetName().toStdString());
   NCollection_Sequence<double> aResSeq;
 
   for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
@@ -827,8 +884,15 @@ NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
 
 double HYDROData_CalculationCase::GetStricklerCoefficientForPoint( const gp_XY& thePoint ) const
 {
-  //TODO: #652
-  return 0.0;
+  Handle( HYDROData_LandCoverMap ) aMap = GetLandCoverMap();
+  Handle( HYDROData_StricklerTable ) aTable = GetStricklerTable();
+  if( aMap.IsNull() )
+    return 0.0;
+
+  QString aType;
+  aMap->FindByPoint( thePoint, aType );
+  double aCoeff = aTable->Get( aType, 0.0 );
+  return aCoeff;
 }
 
 Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const
@@ -922,14 +986,14 @@ Handle(HYDROData_Region) HYDROData_CalculationCase::addNewRegion( const Handle(H
   return aNewRegion;
 }
 
-Handle(HYDROData_SplittedShapesGroup) HYDROData_CalculationCase::addNewSplittedGroup( const QString& theName )
+Handle(HYDROData_SplitShapesGroup) HYDROData_CalculationCase::addNewSplitGroup( const QString& theName )
 {
-  TDF_Label aNewLab = myLab.FindChild( DataTag_SplittedGroups ).NewChild();
+  TDF_Label aNewLab = myLab.FindChild( DataTag_SplitGroups ).NewChild();
 
-  Handle(HYDROData_SplittedShapesGroup) aNewGroup =
-    Handle(HYDROData_SplittedShapesGroup)::DownCast( 
-      HYDROData_Iterator::CreateObject( aNewLab, KIND_SPLITTED_GROUP ) );
-  AddReferenceObject( aNewGroup, DataTag_SplittedGroups );
+  Handle(HYDROData_SplitShapesGroup) aNewGroup =
+    Handle(HYDROData_SplitShapesGroup)::DownCast( 
+      HYDROData_Iterator::CreateObject( aNewLab, KIND_SPLIT_GROUP ) );
+  AddReferenceObject( aNewGroup, DataTag_SplitGroups );
 
   aNewGroup->SetName( theName );
 
@@ -959,9 +1023,9 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var  theGeomEngine,
   HYDROData_ShapesGroup::SeqOfGroupsDefs aSeqOfGroupsDefs;
 
   // Get groups definitions
-  HYDROData_SequenceOfObjects aSplittedGroups = GetSplittedGroups();
+  HYDROData_SequenceOfObjects aSplitGroups = GetSplitGroups();
 
-  HYDROData_SequenceOfObjects::Iterator anIter( aSplittedGroups );
+  HYDROData_SequenceOfObjects::Iterator anIter( aSplitGroups );
   for ( ; anIter.More(); anIter.Next() )
   {
     // Get shapes group
@@ -1007,6 +1071,11 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var  theGeomEngine,
     aRes = Export( theGeomEngine, theStudy, aFaces, aSeqOfGroupsDefs, theGeomObjEntry );;
   }
 
+  if( aRes && !GetLandCoverMap().IsNull() && !GetStricklerTable().IsNull() )
+  {
+    QString aTelemacFileName = GetName() + ".telemac";
+    aRes = GetLandCoverMap()->ExportTelemac( aTelemacFileName, 1E-2, GetStricklerTable() );
+  }
   return aRes;
 }
 
@@ -1174,7 +1243,7 @@ void HYDROData_CalculationCase::ClearRules( HYDROData_CalculationCase::DataTag t
 
   // Indicate model of the need to update splitting
   if ( theIsSetToUpdate ) {
-    SetToUpdate( true );
+    Changed( Geom_2d );
   }
 }
 
@@ -1188,7 +1257,7 @@ void HYDROData_CalculationCase::AddRule( const Handle(HYDROData_Entity)&    theO
   HYDROData_PriorityQueue::AddRule( aRulesLab, theObject1, thePriority, theObject2, theMergeType );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 QString HYDROData_CalculationCase::DumpRules() const
@@ -1203,7 +1272,7 @@ void HYDROData_CalculationCase::SetAssignmentMode( AssignmentMode theMode )
   TDataStd_Integer::Set( aModeLab, ( int ) theMode );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 HYDROData_CalculationCase::AssignmentMode HYDROData_CalculationCase::GetAssignmentMode() const
@@ -1263,6 +1332,7 @@ void HYDROData_CalculationCase::UpdateRegionsNames( const HYDROData_SequenceOfOb
 }
 
 void HYDROData_CalculationCase::DumpRegionsToPython( QStringList& theResList,
+                                                     const QString& thePyScriptPath,
                                                      MapOfTreatedObjects& theTreatedObjects,
                                                      const HYDROData_SequenceOfObjects& theRegions ) const
 {
@@ -1276,7 +1346,7 @@ void HYDROData_CalculationCase::DumpRegionsToPython( QStringList& theResList,
       continue;
 
     theTreatedObjects.insert( aRegion->GetName(), aRegion );
-    QStringList aRegDump = aRegion->DumpToPython( theTreatedObjects );
+    QStringList aRegDump = aRegion->DumpToPython( thePyScriptPath, theTreatedObjects );
     theResList << aRegDump;
   }
 }