mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-14 02:30:33 +05:00
PAL13473 (Build repetitive mesh):
an arg added to constructor of SMESH_subMeshEventListener
This commit is contained in:
parent
e17285fe3d
commit
d4a97eee6e
@ -1491,12 +1491,12 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
||||
break;
|
||||
}
|
||||
|
||||
if ( _algoState != oldAlgoState )
|
||||
if ( _algoState != oldAlgoState || event == MODIF_HYP )
|
||||
{
|
||||
if (_algoState == HYP_OK && algo )
|
||||
algo->SetEventListener( this );
|
||||
if ( oldAlgoState == HYP_OK )
|
||||
DeleteOwnListeners();
|
||||
if (_algoState == HYP_OK && algo )
|
||||
algo->SetEventListener( this );
|
||||
}
|
||||
NotifyListenersOnEvent( event, COMPUTE_EVENT );
|
||||
|
||||
@ -1883,8 +1883,8 @@ void SMESH_subMesh::DeleteEventListener(EventListener* listener)
|
||||
map< EventListener*, EventListenerData* >::iterator l_d =
|
||||
myEventListeners.find( listener );
|
||||
if ( l_d != myEventListeners.end() ) {
|
||||
delete l_d->first;
|
||||
delete l_d->second;
|
||||
if ( l_d->first->IsDeletable() ) delete l_d->first;
|
||||
if ( l_d->second->IsDeletable() ) delete l_d->second;
|
||||
myEventListeners.erase( l_d );
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,10 @@ struct SMESH_subMeshEventListenerData;
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
class SMESH_subMeshEventListener {
|
||||
bool myIsDeletable; //!< if true, it will be deleted by SMESH_subMesh
|
||||
public:
|
||||
SMESH_subMeshEventListener(bool isDeletable):myIsDeletable(isDeletable) {}
|
||||
bool IsDeletable() const { return myIsDeletable; }
|
||||
/*!
|
||||
* \brief Do something on a certain event
|
||||
* \param event - algo_event or compute_event itself (of SMESH_subMesh)
|
||||
@ -69,11 +72,13 @@ public:
|
||||
|
||||
struct SMESH_subMeshEventListenerData
|
||||
{
|
||||
//!< to recognize data type
|
||||
int myType;
|
||||
//!< generally: submeshes depending on the one storing this data
|
||||
std::list<SMESH_subMesh*> mySubMeshes;
|
||||
//!< subMesh where data
|
||||
bool myIsDeletable; //!< if true, it will be deleted by SMESH_subMesh
|
||||
int myType; //!< to recognize data type
|
||||
std::list<SMESH_subMesh*> mySubMeshes; //!< generally: submeshes depending
|
||||
// on the one storing this data
|
||||
public:
|
||||
SMESH_subMeshEventListenerData(bool isDeletable):myIsDeletable(isDeletable) {}
|
||||
bool IsDeletable() const { return myIsDeletable; }
|
||||
|
||||
/*!
|
||||
* \brief Create a default listener data.
|
||||
@ -82,12 +87,12 @@ struct SMESH_subMeshEventListenerData
|
||||
* \retval SMESH_subMeshEventListenerData* - a new listener data
|
||||
*
|
||||
* See SMESH_subMeshEventListener::ProcessEvent() to know how the default
|
||||
* listener uses it
|
||||
* listener uses it (implementation is in SMESH_subMesh.cxx)
|
||||
*/
|
||||
static SMESH_subMeshEventListenerData* MakeData(SMESH_subMesh* dependentSM,
|
||||
const int type = 0)
|
||||
{
|
||||
SMESH_subMeshEventListenerData* data = new SMESH_subMeshEventListenerData;
|
||||
SMESH_subMeshEventListenerData* data = new SMESH_subMeshEventListenerData(true);
|
||||
data->mySubMeshes.push_back( dependentSM );
|
||||
data->myType = type;
|
||||
return data;
|
||||
|
@ -354,7 +354,7 @@ void StdMeshers_Projection_1D::SetEventListener(SMESH_subMesh* subMesh)
|
||||
srcMesh->GetSubMesh( _sourceHypo->GetSourceEdge() );
|
||||
|
||||
if ( srcEdgeSM != subMesh )
|
||||
subMesh->SetEventListener( new SMESH_subMeshEventListener(),
|
||||
subMesh->SetEventListener( new SMESH_subMeshEventListener(true),
|
||||
SMESH_subMeshEventListenerData::MakeData( subMesh ),
|
||||
srcEdgeSM );
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ void StdMeshers_Projection_2D::SetEventListener(SMESH_subMesh* subMesh)
|
||||
SMESH_subMesh* srcFaceSM =
|
||||
srcMesh->GetSubMesh( _sourceHypo->GetSourceFace() );
|
||||
|
||||
subMesh->SetEventListener( new SMESH_subMeshEventListener(),
|
||||
subMesh->SetEventListener( new SMESH_subMeshEventListener(true),
|
||||
SMESH_subMeshEventListenerData::MakeData( subMesh ),
|
||||
srcFaceSM );
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ void StdMeshers_Projection_3D::SetEventListener(SMESH_subMesh* subMesh)
|
||||
srcMesh->GetSubMesh( _sourceHypo->GetSource3DShape() );
|
||||
|
||||
if ( srcShapeSM != subMesh )
|
||||
subMesh->SetEventListener( new SMESH_subMeshEventListener(),
|
||||
subMesh->SetEventListener( new SMESH_subMeshEventListener(true),
|
||||
SMESH_subMeshEventListenerData::MakeData( subMesh ),
|
||||
srcShapeSM );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user