From: asl Date: Mon, 27 Oct 2014 11:28:13 +0000 (+0000) Subject: refs #476: more robust resolving conflicts X-Git-Tag: BR_hydro_v_1_0_4~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=725562568b5fda2f805d2e761c755a98ebab7460;p=modules%2Fhydro.git refs #476: more robust resolving conflicts --- diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 7dd9f93a..b8e0d9f0 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -312,6 +312,12 @@ void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Docume if( aRegion.IsNull() ) continue; Handle(HYDROData_Zone) aRegionZone = aRegion->addNewZone( theDoc, aZonesPref, aSplitData.Face(), aSplitData.ObjectNames ); + + if( aSplitData.ObjectNames.count() > 1 && aMergeType==HYDROData_Zone::Merge_UNKNOWN ) + { + qDebug( "Error in algorithm: unresolved conflicts" ); + } + switch( aMergeType ) { case HYDROData_Zone::Merge_ZMIN: diff --git a/src/HYDROData/HYDROData_PriorityQueue.cxx b/src/HYDROData/HYDROData_PriorityQueue.cxx index 5934062f..76b475d1 100644 --- a/src/HYDROData/HYDROData_PriorityQueue.cxx +++ b/src/HYDROData/HYDROData_PriorityQueue.cxx @@ -29,19 +29,38 @@ HYDROData_PriorityQueue::~HYDROData_PriorityQueue() Handle(HYDROData_Object) HYDROData_PriorityQueue::GetMostPriorityObject( const QStringList& theZoneObjects, HYDROData_Zone::MergeAltitudesType& theMergeType ) const { + QStringList aSortedZoneObjects; + for( int i=myGeomObjects.Lower(), n=myGeomObjects.Upper(); i<=n; i++ ) + { + QString aName = myGeomObjects.Value( i )->GetName(); + if( theZoneObjects.contains( aName ) ) + aSortedZoneObjects.append( aName ); + } + Handle(HYDROData_Object) aMostPriorityObj; - theMergeType = HYDROData_Zone::Merge_Object; - QStringList::const_iterator anIt = theZoneObjects.begin(), aLast = theZoneObjects.end(); + theMergeType = HYDROData_Zone::Merge_UNKNOWN; + QStringList::const_iterator anIt = aSortedZoneObjects.begin(), aLast = aSortedZoneObjects.end(); for( ; anIt!=aLast; anIt++ ) { HYDROData_Zone::MergeAltitudesType aLocalMerge = HYDROData_Zone::Merge_UNKNOWN; Handle(HYDROData_Object) anObj = myNames[*anIt]; if( !anObj.IsNull() ) - if( aMostPriorityObj.IsNull() || IsMorePriority( anObj, aMostPriorityObj, aLocalMerge ) ) + { + if( aMostPriorityObj.IsNull() ) { aMostPriorityObj = anObj; - theMergeType = aLocalMerge; + continue; } + + bool isMorePriority = IsMorePriority( anObj, aMostPriorityObj, aLocalMerge ); + + if( isMorePriority ) + aMostPriorityObj = anObj; + + if( aLocalMerge != HYDROData_Zone::Merge_UNKNOWN && + ( theMergeType==HYDROData_Zone::Merge_UNKNOWN || isMorePriority ) ) + theMergeType = aLocalMerge; + } } return aMostPriorityObj; }