22364: EDF SMESH: Create Mesh dialog box improvement: hide inapplicable algorithms/hypotheses

Improve code readability
This commit is contained in:
eap 2014-02-26 13:50:42 +04:00
parent 056dd851f2
commit 7c09ac523c
2 changed files with 24 additions and 26 deletions

View File

@ -281,20 +281,16 @@ namespace SMESH
// fill list of hypotheses/algorithms // fill list of hypotheses/algorithms
THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap; THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap;
THypothesisDataMap::ConstIterator anIter; THypothesisDataMap::ConstIterator anIter;
for ( anIter = pMap.begin(); anIter != pMap.end(); anIter++ ) { for ( anIter = pMap.begin(); anIter != pMap.end(); anIter++ )
{
HypothesisData* aData = anIter.value(); HypothesisData* aData = anIter.value();
if(!aData || aData->Label.isEmpty()) continue; if (( aData && !aData->Label.isEmpty() ) &&
if (( theDim < 0 || aData->Dim.contains( theDim )) && ( theDim < 0 || aData->Dim.contains( theDim )) &&
( isAlgo || aData->IsAuxOrNeedHyp == isAux ) && ( isAlgo || aData->IsAuxOrNeedHyp == isAux ) &&
( aData->Context == "ANY" || aData->Context == context )) ( aData->Context == "ANY" || aData->Context == context ) &&
( !checkGeometry || aData->IsNeedGeometry == isNeedGeometry ))
{ {
if (checkGeometry) { aHypList.append(anIter.key());
if (aData->IsNeedGeometry == isNeedGeometry)
aHypList.append(anIter.key());
}
else {
aHypList.append(anIter.key());
}
} }
} }
return aHypList; return aHypList;

View File

@ -1399,20 +1399,22 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
QStringList anAvailable; QStringList anAvailable;
// check that tab enable, if algorithm building needed algo is one less than dimension // check that tab enabled of one less dimension
if ( algoData && myIsOnGeometry && !algoData->InputTypes.isEmpty() && if ( aDim > SMESH::DIM_0D )
( aDim > SMESH::DIM_0D ) && !isAccessibleDim( aDim - 1 ) ){ {
myDlg->enableTab( aDim - 1 ); if ( isAccessibleDim( aDim - 1 ) )
} {
if ( (myDlg->currentMeshType() != MT_ANY) && if (( myDlg->currentMeshType() != MT_ANY ) &&
(( !algoData && ( aDim > SMESH::DIM_0D ) && isAccessibleDim( aDim - 1 )) || ( !algoData || ( myIsOnGeometry && algoData->InputTypes.isEmpty() )))
( algoData && myIsOnGeometry && algoData->InputTypes.isEmpty() && for (int i = aDim - 1; i >= SMESH::DIM_0D; i--)
( aDim > SMESH::DIM_0D ) && isAccessibleDim( aDim - 1 ) ) ) ){ if ( isAccessibleDim( i ) ) {
for (int i = aDim - 1; i >= SMESH::DIM_0D; i--){ myDlg->disableTab( i );
if ( isAccessibleDim( i ) ) { setCurrentHyp(i, Algo, -1);
myDlg->disableTab( i ); }
setCurrentHyp(i, Algo, -1); }
} else if ( algoData && myIsOnGeometry && !algoData->InputTypes.isEmpty() )
{
myDlg->enableTab( aDim - 1 );
} }
} }