From: asl Date: Fri, 20 Dec 2013 07:08:43 +0000 (+0000) Subject: bug #265: name of boundary polyline X-Git-Tag: BR_hydro_v_0_6~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e7f5bc581afad29a0214d2232dcfbed523fc43c6;p=modules%2Fhydro.git bug #265: name of boundary polyline --- diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index cb9ee5c6..ea455bd2 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -489,7 +489,24 @@ bool HYDROData_Bathymetry::CreateBoundaryPolyline() const if( aResult.IsNull() ) return false; - aResult->SetName( GetName() + "_boundary" ); + //search free name + QString aName = GetName() + "_boundary", anIndexedName; + Handle_HYDROData_Entity aFound = HYDROData_Tool::FindObjectByName( aDocument, aName ); + if( aFound.IsNull() ) + aResult->SetName( aName ); + else + { + //use index + aName += "_%0"; + int i = 1; + while( !aFound.IsNull() ) + { + anIndexedName = aName.arg( i ); + aFound = HYDROData_Tool::FindObjectByName( aDocument, anIndexedName ); + i++; + } + aResult->SetName( anIndexedName ); + } double Xmin = 0.0, Xmax = 0.0, Ymin = 0.0, Ymax = 0.0; bool isFirst = true;