X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_CalculationCase.cxx;h=ff5dd2980a6078f20982a483ab1d1b56403585eb;hb=83437139f2e5e8f7c7d4268866b8b9c42bebdcb2;hp=6db6d6462a27f3365c09bc1b81a1bd50e3605f39;hpb=ccf1fc3746f78940dffc56d4958695c39a2a3088;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 6db6d646..ff5dd298 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -82,7 +82,7 @@ #include #endif -#define _DEVDEBUG_ +//#define _DEVDEBUG_ #include "HYDRO_trace.hxx" IMPLEMENT_STANDARD_RTTIEXT(HYDROData_CalculationCase, HYDROData_Entity) @@ -674,31 +674,31 @@ void HYDROData_CalculationCase::UpdateRegionsOrder() if ( aDocument.IsNull() ) return; + QString aRegsPref = CALCULATION_REGIONS_PREF; + std::map IndToRegion; //index in the name of region to region itself HYDROData_SequenceOfObjects aRegions = GetRegions(); HYDROData_SequenceOfObjects::Iterator anIter( aRegions ); + QString aName; + int aVal; for ( ; anIter.More(); anIter.Next() ) { - Handle(HYDROData_Region) aRegion = - Handle(HYDROData_Region)::DownCast( anIter.Value() ); + Handle(HYDROData_Region) aRegion = Handle(HYDROData_Region)::DownCast( anIter.Value() ); if ( aRegion.IsNull() ) continue; - aRegion->SetName( "" ); + if (HYDROData_Tool::ExtractGeneratedObjectName(aRegion->GetName(), aVal, aName) && aName == aRegsPref) + IndToRegion[aVal] = aRegion; } - QString aRegsPref = CALCULATION_REGIONS_PREF; - - anIter.Init( aRegions ); - for ( ; anIter.More(); anIter.Next() ) - { - Handle(HYDROData_Region) aRegion = - Handle(HYDROData_Region)::DownCast( anIter.Value() ); - if ( aRegion.IsNull() ) - continue; - - QString aRegionName = HYDROData_Tool::GenerateObjectName( aDocument, aRegsPref ); - aRegion->SetName( aRegionName ); - } + int nbR = aRegions.Length(); + std::map::iterator it = IndToRegion.begin(); + for( int i = 1; it != IndToRegion.end(); ++it ) + if (it->first <= nbR + 1) + { + QString aNewName = QString("%1_%2").arg(aRegsPref).arg(QString::number(i)); + it->second->SetName(aNewName); + i++; + } } void HYDROData_CalculationCase::RemoveRegion( const Handle(HYDROData_Region)& theRegion ) @@ -746,19 +746,19 @@ 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()); + 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, theMethod ); else { - //DEBTRACE("GetAltitudeForPoint Region " << aRefRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString() << " ---------------------------"); + DEBTRACE("GetAltitudeForPoint Region " << aRefRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString() << " ---------------------------"); aResAltitude = GetAltitudeForPoint( thePoint, aZone, theMethod ); } } else { - //DEBTRACE(" --- GetAltitudeForPoint No Zone ---"); + DEBTRACE(" --- GetAltitudeForPoint No Zone ---"); } return aResAltitude; @@ -768,7 +768,7 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& const Handle(HYDROData_Zone)& theZone, int theMethod) const { - //DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString()); + DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString()); double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude(); if ( theZone.IsNull() ) { @@ -777,15 +777,15 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& } HYDROData_Zone::MergeType aZoneMergeType = theZone->GetMergeType(); - //DEBTRACE("aZoneMergeType " << aZoneMergeType); + DEBTRACE("aZoneMergeType " << aZoneMergeType); if ( !theZone->IsMergingNeed() ) { aZoneMergeType = HYDROData_Zone::Merge_UNKNOWN; - //DEBTRACE("---"); + DEBTRACE("---"); } else if ( aZoneMergeType == HYDROData_Zone::Merge_UNKNOWN ) { - //DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString() << " Merge_UNKNOWN"); + DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString() << " Merge_UNKNOWN"); return aResAltitude; } @@ -804,14 +804,14 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& } else { - //DEBTRACE("aZoneInterpolator == NULL"); + DEBTRACE("aZoneInterpolator == NULL"); aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint ); } } } else { - //DEBTRACE("aZoneMergeType != HYDROData_Zone::Merge_Object"); + DEBTRACE("aZoneMergeType != HYDROData_Zone::Merge_Object"); HYDROData_SequenceOfObjects aZoneObjects = theZone->GetObjects(); HYDROData_SequenceOfObjects::Iterator anIter( aZoneObjects ); for ( ; anIter.More(); anIter.Next() ) @@ -834,7 +834,7 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& } else { - //DEBTRACE("aZoneInterpolator == NULL"); + DEBTRACE("aZoneInterpolator == NULL"); aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint, theMethod ); }