From: eap Date: Fri, 23 Nov 2007 11:00:01 +0000 (+0000) Subject: PAL16617 (Modification/Transformation operations with copy don't create a new mesh) X-Git-Tag: V3_2_9rc2~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=01d3112966074a8ded0dfac703a5dca4f4868512;p=modules%2Fsmesh.git PAL16617 (Modification/Transformation operations with copy don't create a new mesh) + QString UniqueMeshName(const char* theBaseName, const char* thePostfix); --- diff --git a/src/SMESHGUI/SMESHGUI_MeshUtils.cxx b/src/SMESHGUI/SMESHGUI_MeshUtils.cxx index b8e5c3055..ccbdaff7d 100644 --- a/src/SMESHGUI/SMESHGUI_MeshUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshUtils.cxx @@ -20,6 +20,7 @@ #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_Utils.h" +#include "SALOMEDSClient_Study.hxx" #include "SALOMEconfig.h" #include CORBA_SERVER_HEADER(SMESH_Group) @@ -44,4 +45,27 @@ namespace SMESH return SMESH_Mesh::_nil(); } + QString UniqueMeshName(const char* theBaseName, const char* thePostfix) + { + QString baseName = theBaseName; + if ( thePostfix/* && !name.contains( postfix )*/) { // add postfix + baseName += "_"; + baseName += thePostfix; + } + if(_PTR(Study) aStudy = GetActiveStudyDocument()) { + QString name = baseName; + while ( !aStudy->FindObjectByName( name.latin1(), "SMESH" ).empty() ) { + int nb = 0; + if ( name[ name.length()-1 ].isNumber() ) { + int nbBeg = name.findRev("_"); + nb = name.right( name.length() - nbBeg - 1 ).toInt(); + name = name.left( nbBeg ); + } + name += QString("_%1").arg( nb+1 ); + } + return name; + } + return QString(""); + } + } diff --git a/src/SMESHGUI/SMESHGUI_MeshUtils.h b/src/SMESHGUI/SMESHGUI_MeshUtils.h index 15a2b5472..f5897a3d0 100644 --- a/src/SMESHGUI/SMESHGUI_MeshUtils.h +++ b/src/SMESHGUI/SMESHGUI_MeshUtils.h @@ -25,11 +25,14 @@ #include "SALOMEconfig.h" #include CORBA_SERVER_HEADER(SMESH_Mesh) +#include + namespace SMESH{ SMESH_Mesh_var GetMeshByIO(const Handle(SALOME_InteractiveObject)& theIO); + QString UniqueMeshName(const char* theBaseName, const char* thePostfix); }