]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #476: more robust resolving conflicts
authorasl <asl@opencascade.com>
Mon, 27 Oct 2014 11:28:13 +0000 (11:28 +0000)
committerasl <asl@opencascade.com>
Mon, 27 Oct 2014 11:28:13 +0000 (11:28 +0000)
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_PriorityQueue.cxx

index 7dd9f93a419adeba960563a67c248fe4e2f32837..b8e0d9f0a266f96d360469bd07d86591a4c0cf91 100644 (file)
@@ -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:
index 5934062f9a4deb0a6ba772d22ce2eb76d2c4757d..76b475d1d421225a7f8bfdba221b9528316b4a56 100644 (file)
@@ -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;
 }