Salome HOME
Import of profiles corrected.
[modules/hydro.git] / src / HYDROData / HYDROData_Tool.cxx
index c217725ab2e48741aef2f8397b07306ed75da90d..fee6e1105dc018dac99aff70dd9077297291c9bb 100644 (file)
@@ -68,7 +68,8 @@ void HYDROData_Tool::SetMustBeUpdatedImages(
 
 QString HYDROData_Tool::GenerateObjectName( const Handle(HYDROData_Document)& theDoc,
                                             const QString&                    thePrefix,
-                                            const QStringList&                theUsedNames )
+                                            const QStringList&                theUsedNames,
+                                            const bool                        theIsTryToUsePurePrefix )
 {
   QStringList aNamesList( theUsedNames );
 
@@ -89,14 +90,18 @@ QString HYDROData_Tool::GenerateObjectName( const Handle(HYDROData_Document)& th
 
   QString aName;
 
-  int anId = 1;
-  while( anId < 1000 )
-  {
-    aName = QString( "%1_%2" ).arg( thePrefix ).arg( QString::number( anId++ ) );
+  if ( theIsTryToUsePurePrefix && !aNamesList.contains( thePrefix ) ) {
+    aName = thePrefix;
+  } else {
+    int anId = 1;
+    while( anId < 1000 )
+    {
+      aName = QString( "%1_%2" ).arg( thePrefix ).arg( QString::number( anId++ ) );
 
-    // check that there are no other objects with the same name in the document
-    if ( !aNamesList.contains( aName ) )
-      break;
+      // check that there are no other objects with the same name in the document
+      if ( !aNamesList.contains( aName ) )
+        break;
+    }
   }
 
   return aName;