// Author : Nicolas REJNERI
// Module : SMESH
-#ifdef WNT
+#ifdef WIN32
#define NOMINMAX
#endif
return _myMeshDS->AddNodeWithID(anElemNode->X(), anElemNode->Y(), anElemNode->Z(),
anElemNode->GetID());
}
+ void RemoveAll()
+ {
+ GetMeshDS()->ClearMesh();
+ }
};// struct TPreviewMesh
static SMESH_NodeSearcher * theNodeSearcher = 0;
}
myMesh = mesh;
myMeshPartIOR = meshPartIOR;
- if ( SMESH_subMesh* myMainSubMesh = mesh->GetSubMeshContaining(1) ) {
- const TDependsOnMap & subMeshes = myMainSubMesh->DependsOn();
- TDependsOnMap::const_iterator sm;
- for (sm = subMeshes.begin(); sm != subMeshes.end(); sm++)
- sm->second->SetEventListener( this, 0, sm->second );
+ SMESH_subMesh* sm = mesh->GetSubMesh( mesh->GetShapeToMesh() );
+ SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator( /*includeSelf=*/true );
+ while ( smIt->more() )
+ {
+ sm = smIt->next();
+ sm->SetEventListener( this, 0, sm );
}
}
}
//!< delete self from all submeshes
void Unset(SMESH_Mesh* mesh)
{
- if ( SMESH_subMesh* myMainSubMesh = mesh->GetSubMeshContaining(1) ) {
- const TDependsOnMap & subMeshes = myMainSubMesh->DependsOn();
- TDependsOnMap::const_iterator sm;
- for (sm = subMeshes.begin(); sm != subMeshes.end(); sm++)
- sm->second->DeleteEventListener( this );
+ if ( SMESH_subMesh* sm = mesh->GetSubMeshContaining(1) ) {
+ SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator( /*includeSelf=*/true );
+ while ( smIt->more() )
+ smIt->next()->DeleteEventListener( this );
}
myMesh = 0;
}
void arrayToSet(const SMESH::long_array & IDs,
const SMESHDS_Mesh* aMesh,
TIDSortedElemSet& aMap,
- const SMDSAbs_ElementType aType = SMDSAbs_All )
+ const SMDSAbs_ElementType aType = SMDSAbs_All,
+ SMDS_MeshElement::Filter* aFilter = NULL)
{
SMDS_MeshElement::NonNullFilter filter1;
SMDS_MeshElement::TypeFilter filter2( aType );
- SMDS_MeshElement::Filter & filter =
- ( aType == SMDSAbs_All ) ? (SMDS_MeshElement::Filter&) filter1 : filter2;
+
+ if ( aFilter == NULL )
+ aFilter = ( aType == SMDSAbs_All ) ? (SMDS_MeshElement::Filter*) &filter1 : (SMDS_MeshElement::Filter*) &filter2;
+
+ SMDS_MeshElement::Filter & filter = *aFilter;
if ( aType == SMDSAbs_Node )
for (int i=0; i<IDs.length(); i++) {
SMESH_MeshEditor_i::~SMESH_MeshEditor_i()
{
+ PortableServer::POA_var poa = SMESH_Gen_i::GetPOA();
+ PortableServer::ObjectId_var anObjectId = poa->servant_to_id(this);
+ poa->deactivate_object(anObjectId.in());
+
//deleteAuxIDSources();
delete myPreviewMesh; myPreviewMesh = 0;
delete myPreviewEditor; myPreviewEditor = 0;
void SMESH_MeshEditor_i::initData(bool deleteSearchers)
{
if ( myIsPreviewMode ) {
- if ( myPreviewMesh ) myPreviewMesh->Clear();
+ if ( myPreviewMesh ) myPreviewMesh->RemoveAll();
}
else {
if ( deleteSearchers )
initData();
SMESHDS_Mesh* aMesh = getMeshDS();
- TIDSortedElemSet faces;
- arrayToSet(IDsOfElements, aMesh, faces, SMDSAbs_Face);
+ TIDSortedElemSet faces,copyFaces;
+ SMDS_MeshElement::GeomFilter triaFilter(SMDSGeom_TRIANGLE);
+ arrayToSet(IDsOfElements, aMesh, faces, SMDSAbs_Face, & triaFilter);
+ TIDSortedElemSet* workElements = & faces;
+
+ if ( myIsPreviewMode ) {
+ SMDSAbs_ElementType select = SMDSAbs_Face;
+ getPreviewMesh( SMDSAbs_Face )->Copy( faces, copyFaces, select );
+ workElements = & copyFaces;
+ }
SMESH::NumericalFunctor_i* aNumericalFunctor =
dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() );
else
aCrit = aNumericalFunctor->GetNumericalFunctor();
- // Update Python script
- TPythonDump() << "isDone = " << this << ".TriToQuad( "
- << IDsOfElements << ", " << aNumericalFunctor << ", " << TVar( MaxAngle ) << " )";
-
+ if ( !myIsPreviewMode ) {
+ // Update Python script
+ TPythonDump() << "isDone = " << this << ".TriToQuad( "
+ << IDsOfElements << ", " << aNumericalFunctor << ", " << TVar( MaxAngle ) << " )";
+ }
- bool stat = getEditor().TriToQuad( faces, aCrit, MaxAngle );
+ bool stat = getEditor().TriToQuad( *workElements, aCrit, MaxAngle );
declareMeshModified( /*isReComputeSafe=*/!stat );
return stat;
SMESH::long_array_var anElementsId = theObject->GetIDs();
CORBA::Boolean isDone = TriToQuad(anElementsId, Criterion, MaxAngle);
- SMESH::NumericalFunctor_i* aNumericalFunctor =
- SMESH::DownCast<SMESH::NumericalFunctor_i*>( Criterion );
+ if ( !myIsPreviewMode ) {
+ SMESH::NumericalFunctor_i* aNumericalFunctor =
+ SMESH::DownCast<SMESH::NumericalFunctor_i*>( Criterion );
- // Update Python script
- aTPythonDump << "isDone = " << this << ".TriToQuadObject("
- << theObject << ", " << aNumericalFunctor << ", " << TVar( MaxAngle ) << " )";
+ // Update Python script
+ aTPythonDump << "isDone = " << this << ".TriToQuadObject("
+ << theObject << ", " << aNumericalFunctor << ", " << TVar( MaxAngle ) << " )";
+ }
return isDone;
int id = getEditor().BestSplit(quad, aCrit);
declareMeshModified( /*isReComputeSafe=*/ id < 1 );
+ return id;
}
SMESH_CATCH( SMESH::throwCorbaException );