X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FControls%2FSMESH_Controls.cxx;h=769096df4344b7e69a9d61ac59e8d7d6d903b5f9;hp=65ff05b9b3be6fd38e2e3f66580d831a37023cfd;hb=07589de92eb5d8e7d4e3bfde8b26f0d69251acf0;hpb=6f7386be594ca912c7b87c883e051abf7e331c79 diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 65ff05b9b..769096df4 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -31,9 +31,10 @@ #include "SMDS_QuadraticFaceOfNodes.hxx" #include "SMDS_VolumeTool.hxx" #include "SMESHDS_GroupBase.hxx" +#include "SMESHDS_GroupOnFilter.hxx" #include "SMESHDS_Mesh.hxx" -#include "SMESH_OctreeNode.hxx" #include "SMESH_MeshAlgos.hxx" +#include "SMESH_OctreeNode.hxx" #include @@ -2650,7 +2651,7 @@ GroupColor::GroupColor() bool GroupColor::IsSatisfy( long theId ) { - return (myIDs.find( theId ) != myIDs.end()); + return myIDs.count( theId ); } void GroupColor::SetType( SMDSAbs_ElementType theType ) @@ -2676,7 +2677,7 @@ static bool isEqual( const Quantity_Color& theColor1, void GroupColor::SetMesh( const SMDS_Mesh* theMesh ) { myIDs.clear(); - + const SMESHDS_Mesh* aMesh = dynamic_cast(theMesh); if ( !aMesh ) return; @@ -2684,20 +2685,24 @@ void GroupColor::SetMesh( const SMDS_Mesh* theMesh ) int nbGrp = aMesh->GetNbGroups(); if ( !nbGrp ) return; - + // iterates on groups and find necessary elements ids const std::set& aGroups = aMesh->GetGroups(); set::const_iterator GrIt = aGroups.begin(); - for (; GrIt != aGroups.end(); GrIt++) { + for (; GrIt != aGroups.end(); GrIt++) + { SMESHDS_GroupBase* aGrp = (*GrIt); if ( !aGrp ) continue; // check type and color of group - if ( !isEqual( myColor, aGrp->GetColor() ) ) - continue; - if ( myType != SMDSAbs_All && myType != (SMDSAbs_ElementType)aGrp->GetType() ) + if ( !isEqual( myColor, aGrp->GetColor() )) continue; + // IPAL52867 (prevent infinite recursion via GroupOnFilter) + if ( SMESHDS_GroupOnFilter * gof = dynamic_cast< SMESHDS_GroupOnFilter* >( aGrp )) + if ( gof->GetPredicate().get() == this ) + continue; + SMDSAbs_ElementType aGrpElType = (SMDSAbs_ElementType)aGrp->GetType(); if ( myType == aGrpElType || (myType == SMDSAbs_All && aGrpElType != SMDSAbs_Node) ) { // add elements IDS into control