#include <HYDROData_Bathymetry.h>
#include <SUIT_DataObject.h>
+#include <QSet>
HYDROGUI_Zone::HYDROGUI_Zone( SUIT_DataObject* theParent,
Handle(HYDROData_Zone) theData,
if ( !aZone.IsNull() )
{
HYDROData_SequenceOfObjects aSeq = aZone->GetGeometryObjects();
- if ( ( aZone->IsMergingNeed() && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN )
- || aSeq.Length() == 1 )
+ bool isMergingNeed = aZone->IsMergingNeed();
+ if ( ( isMergingNeed && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN )
+ || ( aSeq.Length() == 1 ) || ( !isMergingNeed ) )
{
// Collect all used bathymetries names when merging is necessary
// or just get the name of bathymetry of a single geometry object
+ // or just get the name of a single bathymetry
HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
+ QSet<QString> aNamesSet;
+ QString aName;
for ( ; anIter.More(); anIter.Next() )
{
Handle(HYDROData_Object) aRefGeomObj =
Handle(HYDROData_Bathymetry) aBathymetry = aRefGeomObj->GetBathymetry();
if ( !aBathymetry.IsNull() )
{
- aRes += aBathymetry->GetName() + ", ";
+ aName = aBathymetry->GetName();
+ if ( !isMergingNeed )
+ {
+ // Get the first geometry object's bathymetry name and go out
+ aRes = aName;
+ break;
+ }
+
+ if ( !aNamesSet.contains( aName ) )
+ {
+ aRes += aName + ", ";
+ aNamesSet.insert( aName );
+ }
}
}
}
- if ( aRes.length() > 1 )
+ // Remove the last comma if necessary
+ if ( isMergingNeed && ( aRes.length() > 1 ) )
{
aRes.remove( aRes.length() - 2, 2 );
}