Salome HOME
23636: EDF 18217 - Problem when suppressing CAD
[modules/smesh.git] / src / SMESHDS / SMESHDS_GroupBase.cxx
index 383d796a29d9ac6015a3d73010cf6c9785d8796e..0aad7f8a3483d57a652ba1a24eed77e9b07ac2f9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  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
@@ -6,7 +6,7 @@
 // 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
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -32,6 +32,8 @@
 
 using namespace std;
 
+Quantity_Color SMESHDS_GroupBase::myDefaultColor = Quantity_Color( 0.0, 0.0, 0.0, Quantity_TOC_RGB );
+
 //=============================================================================
 /*!
  *  
@@ -44,12 +46,12 @@ SMESHDS_GroupBase::SMESHDS_GroupBase (const int                 theID,
        myID(theID), myMesh(theMesh), myType(theType), myStoreName(""),
        myCurIndex(0), myCurID(-1)
 {
-  myColor = Quantity_Color( 0.0, 0.0, 0.0, Quantity_TOC_RGB );
+  myColor = myDefaultColor;
 }
 
 //=============================================================================
 /*!
- *  
+ *  Don't use it!
  */
 //=============================================================================
 
@@ -122,6 +124,9 @@ int SMESHDS_GroupBase::Extent() const
 
 bool SMESHDS_GroupBase::IsEmpty()
 {
+  if ( myMesh->GetMeshInfo().NbElements( myType ) == 0 )
+    // avoid long iteration over sub-meshes of a complex sub-mesh of a group on geometry
+    return true;
   SMDS_ElemIteratorPtr it = GetElements();
   return ( !it || !it->more() );
 }