X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHDS%2FSMESHDS_Group.cxx;h=dc222d204b71aa14b1f6051a7da92d0ab8867e29;hb=6d32f944a0a115b6419184c50b57bf7c4eef5786;hp=e6df602ff343532c4a4bda2185c1ee3ed681d323;hpb=4c16067d4281f56bd07d3f92fb63fff9c0c1d169;p=modules%2Fsmesh.git diff --git a/src/SMESHDS/SMESHDS_Group.cxx b/src/SMESHDS/SMESHDS_Group.cxx index e6df602ff..dc222d204 100644 --- a/src/SMESHDS/SMESHDS_Group.cxx +++ b/src/SMESHDS/SMESHDS_Group.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2019 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 @@ -105,15 +105,14 @@ bool SMESHDS_Group::Add (const int theID) bool SMESHDS_Group::Add (const SMDS_MeshElement* aElem ) { - if (!aElem || myGroup.Contains(aElem)) - return false; - - if (myGroup.IsEmpty()) - SetType( aElem->GetType() ); - - myGroup.Add (aElem); - resetIterator(); - return true; + bool added = false; + if ( aElem ) + { + added = myGroup.Add (aElem); + if ( added ) + resetIterator(); + } + return added; } //============================================================================= @@ -124,12 +123,14 @@ bool SMESHDS_Group::Add (const SMDS_MeshElement* aElem ) bool SMESHDS_Group::Remove (const int theID) { - const SMDS_MeshElement* aElem = findInMesh (theID); - if (!aElem || !myGroup.Contains(aElem)) - return false; - myGroup.Remove (aElem); - resetIterator(); - return true; + bool removed = false; + if ( const SMDS_MeshElement* aElem = findInMesh( theID )) + { + removed = myGroup.Remove (aElem); + if ( removed ) + resetIterator(); + } + return removed; }