+namespace
+{
+ // --------------------------------------------------------------------------------
+ /*!
+ * \brief an event listener updating submehses of EDGEs according to
+ * events on the target FACE submesh
+ */
+ struct EventProparatorToEdges : public SMESH_subMeshEventListener
+ {
+ EventProparatorToEdges(): SMESH_subMeshEventListener(/*isDeletable=*/false,
+ "Projection_1D2D::EventProparatorToEdges")
+ {}
+ static EventProparatorToEdges* Instance() { static EventProparatorToEdges E; return &E; }
+
+ static void Set(SMESH_subMesh* faceSubMesh)
+ {
+ SMESH_subMeshEventListenerData* edgeSubMeshes =
+ new SMESH_subMeshEventListenerData(/*isDeletable=*/true);
+ SMESH_Mesh* mesh = faceSubMesh->GetFather();
+ TopExp_Explorer eExp( faceSubMesh->GetSubShape(), TopAbs_EDGE );
+ for ( ; eExp.More(); eExp.Next() )
+ edgeSubMeshes->mySubMeshes.push_back( mesh->GetSubMesh( eExp.Current() ));
+
+ // set a listener
+ faceSubMesh->SetEventListener( Instance(), edgeSubMeshes, faceSubMesh );
+ }
+ };
+ // --------------------------------------------------------------------------------
+ /*!
+ * \brief Structure used to temporary remove EventProparatorToEdges from faceSubMesh
+ * in order to prevent propagation of CLEAN event from FACE to EDGEs during
+ * StdMeshers_Projection_1D2D::Compute(). The CLEAN event is emmited by Pattern mapper
+ * and causes removal of faces generated on adjacent FACEs.
+ */
+ struct UnsetterOfEventProparatorToEdges
+ {
+ SMESH_subMesh* _faceSubMesh;
+ UnsetterOfEventProparatorToEdges( SMESH_subMesh* faceSubMesh ):_faceSubMesh(faceSubMesh)
+ {
+ faceSubMesh->DeleteEventListener( EventProparatorToEdges::Instance() );
+ }
+ ~UnsetterOfEventProparatorToEdges()
+ {
+ EventProparatorToEdges::Set(_faceSubMesh);
+ }
+ };
+}