From: eap Date: Mon, 3 Sep 2012 08:26:53 +0000 (+0000) Subject: 0020833: EDF 1361 SMESH : Graphical Selection of the boundary faces in one clic X-Git-Tag: V6_6_0a1~150 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8203a3d57e33fec77bf4d3baf1b3c4020cb5fb49;p=modules%2Fsmesh.git 0020833: EDF 1361 SMESH : Graphical Selection of the boundary faces in one clic Change behavior of CoplanarFaces: normals of neighboring faces are compared and not that of the selected face and candidate faces --- diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index f9540e004..66601f3df 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -2737,30 +2737,37 @@ void CoplanarFaces::SetMesh( const SMDS_Mesh* theMesh ) return; const double radianTol = myToler * M_PI / 180.; - typedef SMDS_StdIterator< const SMDS_MeshElement*, SMDS_ElemIteratorPtr > TFaceIt; - std::set checkedFaces, checkedNodes; - std::list faceQueue( 1, face ); + std::set< SMESH_TLink > checkedLinks; + + std::list< pair< const SMDS_MeshElement*, gp_Vec > > faceQueue; + faceQueue.push_back( make_pair( face, myNorm )); while ( !faceQueue.empty() ) { - face = faceQueue.front(); - if ( checkedFaces.insert( face ).second ) + face = faceQueue.front().first; + myNorm = faceQueue.front().second; + faceQueue.pop_front(); + + for ( int i = 0, nbN = face->NbCornerNodes(); i < nbN; ++i ) { - gp_Vec norm = getNormale( static_cast(face), &normOK ); - if (!normOK || myNorm.Angle( norm ) <= radianTol) + const SMDS_MeshNode* n1 = face->GetNode( i ); + const SMDS_MeshNode* n2 = face->GetNode(( i+1 )%nbN); + if ( !checkedLinks.insert( SMESH_TLink( n1, n2 )).second ) + continue; + SMDS_ElemIteratorPtr fIt = n1->GetInverseElementIterator(SMDSAbs_Face); + while ( fIt->more() ) { - myCoplanarIDs.insert( face->GetID() ); - std::set neighborFaces; - for ( int i = 0; i < face->NbCornerNodes(); ++i ) + const SMDS_MeshElement* f = fIt->next(); + if ( f->GetNodeIndex( n2 ) > -1 ) { - const SMDS_MeshNode* n = face->GetNode( i ); - if ( checkedNodes.insert( n ).second ) - neighborFaces.insert( TFaceIt( n->GetInverseElementIterator(SMDSAbs_Face)), - TFaceIt()); + gp_Vec norm = getNormale( static_cast(f), &normOK ); + if (!normOK || myNorm.Angle( norm ) <= radianTol) + { + myCoplanarIDs.insert( f->GetID() ); + faceQueue.push_back( make_pair( f, norm )); + } } - faceQueue.insert( faceQueue.end(), neighborFaces.begin(), neighborFaces.end() ); } } - faceQueue.pop_front(); } } } @@ -2770,7 +2777,7 @@ bool CoplanarFaces::IsSatisfy( long theElementId ) } /* - *Class : RangeOfIds + *Class : RangeOfIds *Description : Predicate for Range of Ids. * Range may be specified with two ways. * 1. Using AddToRange method