From e7f5bc581afad29a0214d2232dcfbed523fc43c6 Mon Sep 17 00:00:00 2001 From: asl Date: Fri, 20 Dec 2013 07:08:43 +0000 Subject: [PATCH] bug #265: name of boundary polyline --- src/HYDROData/HYDROData_Bathymetry.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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; -- 2.39.2