X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHDS%2FSMESHDS_GroupBase.cxx;h=89542aded12723b5e7ed9ba4dab172a9052c2971;hp=383d796a29d9ac6015a3d73010cf6c9785d8796e;hb=HEAD;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6 diff --git a/src/SMESHDS/SMESHDS_GroupBase.cxx b/src/SMESHDS/SMESHDS_GroupBase.cxx index 383d796a2..cc133c455 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.cxx +++ b/src/SMESHDS/SMESHDS_GroupBase.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, 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,16 +46,16 @@ 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! */ //============================================================================= -int SMESHDS_GroupBase::GetID (const int theIndex) +smIdType SMESHDS_GroupBase::GetID (const int theIndex) { if (myCurIndex < 1 || myCurIndex > theIndex) { myIterator = GetElements(); @@ -73,7 +75,7 @@ int SMESHDS_GroupBase::GetID (const int theIndex) */ //============================================================================= -const SMDS_MeshElement* SMESHDS_GroupBase::findInMesh (const int theID) const +const SMDS_MeshElement* SMESHDS_GroupBase::findInMesh (const smIdType theID) const { SMDSAbs_ElementType aType = GetType(); const SMDS_MeshElement* aElem = NULL; @@ -105,10 +107,10 @@ void SMESHDS_GroupBase::resetIterator() //purpose : //======================================================================= -int SMESHDS_GroupBase::Extent() const +smIdType SMESHDS_GroupBase::Extent() const { SMDS_ElemIteratorPtr it = GetElements(); - int nb = 0; + smIdType nb = 0; if ( it ) for ( ; it->more(); it->next() ) nb++; @@ -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() ); } @@ -131,7 +136,7 @@ bool SMESHDS_GroupBase::IsEmpty() //purpose : //======================================================================= -bool SMESHDS_GroupBase::Contains (const int theID) +bool SMESHDS_GroupBase::Contains (const smIdType theID) { if ( SMDS_ElemIteratorPtr it = GetElements() ) { while ( it->more() ) @@ -179,9 +184,9 @@ void SMESHDS_GroupBase::SetColorGroup(int theColorGroup) if ( aR < 0. || aR > 1. || // PAL19395 aG < 0. || aG > 1. || aB < 0. || aB > 1. ) -// #ifdef _DEBUG_ -// cout << "SMESHDS_GroupBase::SetColorGroup("<