-// 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
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;
}
//=============================================================================
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;
}