]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
bug #265: name of boundary polyline
authorasl <asl@opencascade.com>
Fri, 20 Dec 2013 07:08:43 +0000 (07:08 +0000)
committerasl <asl@opencascade.com>
Fri, 20 Dec 2013 07:08:43 +0000 (07:08 +0000)
src/HYDROData/HYDROData_Bathymetry.cxx

index cb9ee5c6008023a63dfba06402b110236cb6560c..ea455bd2fe388b4e3e61e2ae9f8743e755de090b 100644 (file)
@@ -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;