X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FBLSURFPlugin%2FBLSURFPlugin_BLSURF.cxx;h=cd4eef4631f4467d9fea118f63552ea404589e11;hb=488f48ca143d9bdb109acf0922c6d4d89f1df924;hp=abb3dfb8d4897f689c9e160faee62a5229b8dab4;hpb=a509bbe6d3d7ecad486ffe0483d82a07d99b9f83;p=plugins%2Fblsurfplugin.git diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index abb3dfb..cd4eef4 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -45,6 +45,7 @@ extern "C"{ #include #include #include +#include #include #include @@ -91,8 +92,6 @@ extern "C"{ #include #include #include -#include -#include #ifndef WIN32 #include @@ -2969,6 +2968,14 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, error(_comment); } + // Set event listeners + if ( _hypothesis ) + for ( int iF = 1; iF <= fmap.Size(); ++iF ) + { + const TopoDS_Shape& face = fmap( iF ); + SetEventListener( aMesh.GetSubMesh( face )); + } + // Issue 0019864. On DebianSarge, FE signals do not obey to OSD::SetSignal(false) #ifndef WIN32 if ( oldFEFlags > 0 ) @@ -3678,3 +3685,52 @@ void BLSURFPlugin_BLSURF::FillEntryToShape( const BLSURFPlugin_Hypothesis* entryToShape.insert({ entry, shape }); } } + +//================================================================================ +/*! + * \brief Sets event listener to submeshes if enforced mesh is defined + * \param subMesh - submesh where algo is set + * + * This method is called when a submesh gets HYP_OK algo_state. + * After being set, event listener is notified on each event of a submesh. + * By default none listener is set + */ +//================================================================================ + +void BLSURFPlugin_BLSURF::SetEventListener(SMESH_subMesh* faceSubMesh) +{ + if ( !_hypothesis ) + return; + + for ( const BLSURFPlugin_Hypothesis::EnforcedMesh& enfMesh : _hypothesis->GetEnforcedMeshes() ) + { + SMESH_Mesh* mesh1D; + _hypothesis->GetEnforcedSegments( enfMesh, mesh1D ); + if ( !mesh1D ) + continue; + + TopExp_Explorer edgeExp( mesh1D->GetShapeToMesh(), TopAbs_EDGE ); + if ( edgeExp.More() ) + StdMeshers_ProjectionUtils::SetEventListener( faceSubMesh, + edgeExp.Current(), + mesh1D ); + // StdMeshers_ProjectionUtils::SetEventListener( faceSubMesh, + // mesh1D->GetShapeToMesh(), + // mesh1D ); + } + return; +} + +//================================================================================ +/*! + * \brief Allow algo to do something after persistent restoration + * \param subMesh - restored submesh + * + * This method is called only if a submesh has HYP_OK algo_state. + */ +//================================================================================ + +void BLSURFPlugin_BLSURF::SubmeshRestored(SMESH_subMesh* subMesh) +{ + SetEventListener( subMesh ); +}