Salome HOME
initial ver.
[modules/hydro.git] / src / HYDROData / HYDROData_Entity.cxx
index 6f3eea802050309a39c355c0cd47b671b4fa588b..eb977ea8270007301a696b820b4db1db93fac6ed 100644 (file)
@@ -1,8 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+// Copyright (C) 2014-2015  EDF-R&D
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
@@ -171,7 +167,8 @@ HYDROData_Entity::~HYDROData_Entity()
 {
 }
 
-void HYDROData_Entity::CopyTo( const Handle(HYDROData_Entity)& theDestination ) const
+void HYDROData_Entity::CopyTo( const Handle(HYDROData_Entity)& theDestination,
+                               bool isGenerateNewName ) const
 {
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
   if ( aDocument.IsNull() ) {
@@ -181,23 +178,26 @@ void HYDROData_Entity::CopyTo( const Handle(HYDROData_Entity)& theDestination )
   TDF_CopyLabel aCopy(myLab, theDestination->Label());
   aCopy.Perform();
          
-  // generate a new unique name for the clone object:
-  // case 1: Image_1 -> Image_2
-  // case 2: ImageObj -> ImageObj_1
-  QString aName = theDestination->GetName();
-  QString aPrefix = aName;
-  if( aName.contains( '_' ) ) { // case 1
-    QString aSuffix = aName.section( '_', -1 );
-    bool anIsInteger = false;
-    aSuffix.toInt( &anIsInteger );
-    if( anIsInteger )
-      aPrefix = aName.section( '_', 0, -2 );
-  } else { // case 2
-    aPrefix = aName;
-  }
+  if( isGenerateNewName )
+  {
+    // generate a new unique name for the clone object:
+    // case 1: Image_1 -> Image_2
+    // case 2: ImageObj -> ImageObj_1
+    QString aName = theDestination->GetName();
+    QString aPrefix = aName;
+    if( aName.contains( '_' ) ) { // case 1
+      QString aSuffix = aName.section( '_', -1 );
+      bool anIsInteger = false;
+      aSuffix.toInt( &anIsInteger );
+      if( anIsInteger )
+        aPrefix = aName.section( '_', 0, -2 );
+    } else { // case 2
+      aPrefix = aName;
+    }
 
-  aName = HYDROData_Tool::GenerateObjectName( aDocument, aPrefix );
-  theDestination->SetName( aName );
+    aName = HYDROData_Tool::GenerateObjectName( aDocument, aPrefix );
+    theDestination->SetName( aName );
+  }
 }
 
 Handle(HYDROData_Entity) HYDROData_Entity::GetFatherObject() const
@@ -603,6 +603,9 @@ QString HYDROData_Entity::getPyTypeID() const
     case KIND_SPLITTED_GROUP:    return "KIND_SPLITTED_GROUP";
     case KIND_STREAM_ALTITUDE:   return "KIND_STREAM_ALTITUDE";
     case KIND_OBSTACLE_ALTITUDE: return "KIND_OBSTACLE_ALTITUDE";
+    case KIND_STRICKLER_TABLE:   return "KIND_STRICKLER_TABLE";
+    case KIND_LAND_COVER:        return "KIND_LAND_COVER";
+    case KIND_LAND_COVER_MAP:    return "KIND_LAND_COVER_MAP";
     default:                     return "KIND_UNKNOWN"; ///! Unrecognized object
   }
 }