+
+//================================================================================
+/*!
+ * \brief Find TopoDS_Shape for each hyper-patch study entry in a hypothesis
+ */
+//================================================================================
+
+void BLSURFPlugin_BLSURF::FillEntryToShape( const BLSURFPlugin_Hypothesis* hyp,
+ std::map< std::string, TopoDS_Shape > & entryToShape )
+{
+ SMESH_Gen_i* smeshGen = SMESH_Gen_i::GetSMESHGen();
+ for ( const ::BLSURFPlugin_Hypothesis::THyperPatchEntries& entries : hyp->GetHyperPatchEntries() )
+ for ( const std::string& entry : entries )
+ {
+ GEOM::GEOM_Object_var go = smeshGen->GetGeomObjectByEntry( entry );
+ TopoDS_Shape shape = smeshGen->GeomObjectToShape( go );
+ if ( !shape.IsNull() )
+ 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 );
+}