PAL13473 (Build repetitive mesh):

fix pb that it is impossible to add local "Nb.Segments" if a global
	"Automatic length" is already assigned
This commit is contained in:
eap 2006-12-06 16:06:43 +00:00
parent caa7efae04
commit 9023e8dc7e

View File

@ -72,6 +72,7 @@ static int MYDEBUG = 0;
static int MYDEBUG = 0; static int MYDEBUG = 0;
#endif #endif
#define cSMESH_Hyp(h) static_cast<const SMESH_Hypothesis*>(h)
//============================================================================= //=============================================================================
/*! /*!
@ -513,8 +514,13 @@ SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
} }
//======================================================================= //=======================================================================
//function : GetHypothesis /*!
//purpose : * \brief Return the hypothesis assigned to the shape
* \param aSubShape - the shape to check
* \param aFilter - the hypothesis filter
* \param andAncestors - flag to check hypos assigned to ancestors of the shape
* \retval SMESH_Hypothesis* - the first hypo passed through aFilter
*/
//======================================================================= //=======================================================================
const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubShape, const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubShape,
@ -525,7 +531,7 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubS
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape); const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin(); list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
for ( ; hyp != hypList.end(); hyp++ ) { for ( ; hyp != hypList.end(); hyp++ ) {
const SMESH_Hypothesis * h = static_cast<const SMESH_Hypothesis*>( *hyp ); const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp );
if ( aFilter.IsOk( h, aSubShape)) if ( aFilter.IsOk( h, aSubShape))
return h; return h;
} }
@ -538,7 +544,7 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubS
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(it.Value()); const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(it.Value());
list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin(); list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
for ( ; hyp != hypList.end(); hyp++ ) { for ( ; hyp != hypList.end(); hyp++ ) {
const SMESH_Hypothesis * h = static_cast<const SMESH_Hypothesis*>( *hyp ); const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp );
if (aFilter.IsOk( h, it.Value() )) if (aFilter.IsOk( h, it.Value() ))
return h; return h;
} }
@ -547,11 +553,6 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubS
return 0; return 0;
} }
//=======================================================================
//function : GetHypotheses
//purpose :
//=======================================================================
//================================================================================ //================================================================================
/*! /*!
* \brief Return hypothesis assigned to the shape * \brief Return hypothesis assigned to the shape
@ -571,21 +572,30 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
set<string> hypTypes; // to exclude same type hypos from the result list set<string> hypTypes; // to exclude same type hypos from the result list
int nbHyps = 0; int nbHyps = 0;
// only one main hypothesis is allowed
bool mainHypFound = false;
// fill in hypTypes // fill in hypTypes
list<const SMESHDS_Hypothesis*>::const_iterator hyp; list<const SMESHDS_Hypothesis*>::const_iterator hyp;
for ( hyp = aHypList.begin(); hyp != aHypList.end(); hyp++ ) for ( hyp = aHypList.begin(); hyp != aHypList.end(); hyp++ ) {
if ( hypTypes.insert( (*hyp)->GetName() ).second ) if ( hypTypes.insert( (*hyp)->GetName() ).second )
nbHyps++; nbHyps++;
if ( !cSMESH_Hyp(*hyp)->IsAuxiliary() )
mainHypFound = true;
}
// get hypos from aSubShape // get hypos from aSubShape
{ {
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape); const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ ) for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
if ( aFilter.IsOk (static_cast<const SMESH_Hypothesis*>( *hyp ), aSubShape) && if ( aFilter.IsOk (cSMESH_Hyp( *hyp ), aSubShape) &&
( cSMESH_Hyp(*hyp)->IsAuxiliary() || !mainHypFound ) &&
hypTypes.insert( (*hyp)->GetName() ).second ) hypTypes.insert( (*hyp)->GetName() ).second )
{ {
aHypList.push_back( *hyp ); aHypList.push_back( *hyp );
nbHyps++; nbHyps++;
if ( !cSMESH_Hyp(*hyp)->IsAuxiliary() )
mainHypFound = true;
} }
} }
@ -600,10 +610,14 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
continue; continue;
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(it.Value()); const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(it.Value());
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ ) for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
if (aFilter.IsOk( static_cast<const SMESH_Hypothesis*>( *hyp ), it.Value() ) && if (aFilter.IsOk( cSMESH_Hyp( *hyp ), it.Value() ) &&
hypTypes.insert( (*hyp)->GetName() ).second ) { ( cSMESH_Hyp(*hyp)->IsAuxiliary() || !mainHypFound ) &&
hypTypes.insert( (*hyp)->GetName() ).second )
{
aHypList.push_back( *hyp ); aHypList.push_back( *hyp );
nbHyps++; nbHyps++;
if ( !cSMESH_Hyp(*hyp)->IsAuxiliary() )
mainHypFound = true;
} }
} }
} }
@ -804,7 +818,7 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* t
{ {
Unexpect aCatch(SalomeException); Unexpect aCatch(SalomeException);
const SMESH_Hypothesis* hyp = static_cast<const SMESH_Hypothesis*>(theChangedHyp); const SMESH_Hypothesis* hyp = cSMESH_Hyp(theChangedHyp);
const SMESH_Algo *foundAlgo = 0; const SMESH_Algo *foundAlgo = 0;
SMESH_HypoFilter algoKind( SMESH_HypoFilter::IsAlgo() ); SMESH_HypoFilter algoKind( SMESH_HypoFilter::IsAlgo() );