X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_CalculationCase.cxx;h=633e063a11bd09049454f202a3ff9c69738b5e2f;hb=f9d37ee66fa46871478d806faa54de237225d3c6;hp=fef44bd1741569f6fb7ffead13ba75e45e49d84e;hpb=e2a86f95793c73c1e2339d42ce38bb07af0f0bff;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index fef44bd1..633e063a 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -171,6 +171,12 @@ QStringList HYDROData_CalculationCase::DumpToPython( const QString& thePyS Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline(); setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aBoundaryPolyline, "SetBoundaryPolyline" ); + Handle(HYDROData_StricklerTable) aStricklerTable = GetStricklerTable(); + setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aStricklerTable, "SetStricklerTable" ); + + Handle(HYDROData_LandCoverMap) aLandCoverMap = GetLandCoverMap(); + setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aLandCoverMap, "SetLandCoverMap" ); + if( aMode==AUTOMATIC ) DumpRulesToPython( aCalculName, aResList ); @@ -1068,9 +1074,9 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, // Get faces bool isAllNotSubmersible = true; - TopTools_ListOfShape aFaces; HYDROData_SequenceOfObjects aCaseRegions = GetRegions(); HYDROData_SequenceOfObjects::Iterator aRegionIter( aCaseRegions ); + NCollection_IndexedDataMap aFacesToNames; for ( ; aRegionIter.More(); aRegionIter.Next() ) { Handle(HYDROData_Region) aRegion = @@ -1082,7 +1088,7 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, isAllNotSubmersible = false; TopoDS_Shape aRegionShape = aRegion->GetShape( &aSeqOfGroupsDefs ); - aFaces.Append( aRegionShape ); + aFacesToNames.Add( aRegionShape, aRegion->GetName() ); } bool aRes = false; @@ -1092,7 +1098,7 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, } else if ( isAllNotSubmersible ) { theErrorMsg = QString("there are no submersible regions."); } else { - aRes = Export( theGeomEngine, theStudy, aFaces, aSeqOfGroupsDefs, theGeomObjEntry );; + aRes = Export( theGeomEngine, theStudy, aFacesToNames, aSeqOfGroupsDefs, theGeomObjEntry );; } if( aRes && !GetLandCoverMap().IsNull() && !GetStricklerTable().IsNull() ) @@ -1105,7 +1111,7 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, - const TopTools_ListOfShape& theFaces, + const NCollection_IndexedDataMap& aFacesToName, const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs, QString& theGeomObjEntry ) const { @@ -1116,10 +1122,9 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var TCollection_AsciiString aNam("Sh_"); int i=1; #endif - TopTools_ListIteratorOfListOfShape aFaceIter( theFaces ); - for ( ; aFaceIter.More(); aFaceIter.Next() ) + for ( int i = 1; i <= aFacesToName.Extent(); i++ ) { - TopoDS_Shape aShape = aFaceIter.Value(); + const TopoDS_Shape& aShape = aFacesToName.FindKey(i); if ( aShape.IsNull() ) continue; @@ -1151,6 +1156,19 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var aSewing.Perform(); TopoDS_Shape aSewedShape = aSewing.SewedShape(); + NCollection_IndexedDataMap aFacesToNameModif; + + for ( int i = 1; i <= aFacesToName.Extent(); i++ ) + { + const TopoDS_Shape& CurShape = aFacesToName.FindKey(i); + const QString& Qstr = aFacesToName.FindFromIndex(i); + if (aSewing.IsModified(CurShape)) + aFacesToNameModif.Add(aSewing.Modified(CurShape), Qstr); + else + aFacesToNameModif.Add(CurShape, Qstr); + } + + // If the sewed shape is empty - return false if ( aSewedShape.IsNull() || !TopoDS_Iterator( aSewedShape ).More() ) return false; @@ -1161,7 +1179,7 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var // Publish the sewed shape QString aName = EXPORT_NAME; GEOM::GEOM_Object_ptr aMainShape = - HYDROData_GeomTool::publishShapeInGEOM( theGeomEngine, theStudy, aSewedShape, aName, theGeomObjEntry ); + HYDROData_GeomTool::ExplodeShapeInGEOMandPublish( theGeomEngine, theStudy, aSewedShape, aFacesToNameModif, aName, theGeomObjEntry ); if ( aMainShape->_is_nil() ) return false;