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:
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;
}