-//================================================================================
-/*!
- * \brief Set a filtered list of available algorithms by mesh type
- * \param theTabIndex - Index of current active tab
- * \param theIndex - Index of current type of mesh
- */
-//================================================================================
-void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theIndex)
-{
- QStringList anAvailableAlgs;
- QString anCompareType = currentMeshTypeName( theIndex );
- int anCurrentAvailableAlgo = -1;
- bool isNone = true;
- int aDim = SMESH::DIM_3D;
- if ( theIndex == MT_TRIANGULAR || theIndex == MT_QUADRILATERAL)
- aDim = SMESH::DIM_2D;
- if ( anCompareType == "ANY" )
- {
- bool isReqDisBound = false;
- int aReqDim = SMESH::DIM_3D;
- for ( int dim = SMESH::DIM_3D; dim >= SMESH::DIM_2D; dim-- )
- {
- anCurrentAvailableAlgo = -1;
- isNone = currentHyp( dim, Algo ) < 0;
- //return current algo in current tab and set new algorithm list
- HypothesisData* algoCur;
- if ( !isNone && !myAvailableHypData[dim][Algo].empty() ) {
- algoCur = myAvailableHypData[dim][Algo].at( currentHyp( dim, Algo ) );
- }
- HypothesisData* prevAlgo = 0;
- HypothesisData* nextAlgo = 0;
- if ( dim == SMESH::DIM_2D ) {
- prevAlgo = hypData( SMESH::DIM_1D, Algo, currentHyp( SMESH::DIM_1D, Algo ) );
- if ( aDim == SMESH::DIM_3D )
- nextAlgo = hypData( SMESH::DIM_3D, Algo, currentHyp( SMESH::DIM_3D, Algo ) );
- }
- // retrieves a list of available algorithms from resources
- availableHyps( dim, Algo, anAvailableAlgs, myAvailableHypData[dim][Algo], prevAlgo, nextAlgo, anCompareType);
- anCurrentAvailableAlgo = myAvailableHypData[dim][Algo].indexOf( algoCur );
- myDlg->tab( dim )->setAvailableHyps( Algo, anAvailableAlgs );
- setCurrentHyp( dim, Algo, anCurrentAvailableAlgo );
- if ( anCurrentAvailableAlgo > -1 )
- isReqDisBound = algoCur->InputTypes.isEmpty();
- else if ( dim != SMESH::DIM_3D && currentHyp( SMESH::DIM_3D, Algo ) >= 0 )
- isReqDisBound = true;
- if ( isReqDisBound ) {
- aReqDim = dim;
- break;
- }
- }
- if ( !myIsOnGeometry )
- for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) {
- if ( i < SMESH::DIM_3D ) myDlg->disableTab( i );
- else myDlg->enableTab( i );
- }
- else
- for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) {
- if ( i > myMaxShapeDim || ( isReqDisBound && i < aReqDim ) ) myDlg->disableTab( i );
- else myDlg->enableTab( i );
- }
- myDlg->setCurrentTab( theTabIndex );
- }
- else
- {
- HypothesisData* anCurrentAlgo;
- bool isReqDisBound = true;
- QString anCurrentCompareType = anCompareType;
- isNone = currentHyp( aDim, Algo ) < 0;
- if ( !isNone && !myAvailableHypData[aDim][Algo].empty() )
- isReqDisBound = myAvailableHypData[aDim][Algo].at( currentHyp( aDim, Algo ) )->InputTypes.isEmpty();
- for ( int dim = aDim; dim >= SMESH::DIM_2D; dim-- )
- {
- bool isNoneAlg = currentHyp( dim, Algo ) < 0;
- anCurrentAvailableAlgo = -1;
- HypothesisData* prevAlgo = 0;
- HypothesisData* nextAlgo = 0;
- if ( dim == SMESH::DIM_2D ) {
- prevAlgo = hypData( SMESH::DIM_1D, Algo, currentHyp( SMESH::DIM_1D, Algo ) );
- if ( aDim == SMESH::DIM_3D )
- nextAlgo = hypData( SMESH::DIM_3D, Algo, currentHyp( SMESH::DIM_3D, Algo ) );
- }
- // finding algorithm which is selected
- if ( !isNoneAlg ) {
- anCurrentAlgo = myAvailableHypData[dim][Algo].at( currentHyp( dim, Algo ) );
- }
- // retrieves a list of available algorithms from resources
- availableHyps( dim, Algo, anAvailableAlgs, myAvailableHypData[dim][Algo], prevAlgo, nextAlgo, anCurrentCompareType );
- // finding and adding algorithm depending on the type mesh
- anCurrentAvailableAlgo = myAvailableHypData[dim][Algo].indexOf( anCurrentAlgo );
- //set new algorithm list and select the current algorithm
- myDlg->tab( dim )->setAvailableHyps( Algo, anAvailableAlgs );
- anCurrentCompareType = ( anCompareType == "HEXA" || anCompareType == "QUAD" ) ? "QUAD" : "TRIA";
- setCurrentHyp( dim, Algo, anCurrentAvailableAlgo );
- }
-
- if ( isNone || isReqDisBound ) {
- for ( int i = SMESH::DIM_0D; i <= myMaxShapeDim; i++ ) {
- if ( aDim != i ) {
- myDlg->disableTab( i );
- }
- }
- }
- else if ( !isNone ) {
- if ( aDim == SMESH::DIM_2D) {
- myDlg->disableTab( SMESH::DIM_3D );
- setCurrentHyp( SMESH::DIM_3D, Algo, -1);
- }
- for ( int i = myMaxShapeDim; i > SMESH::DIM_0D; i-- ) {
- bool isNoneAlg = currentHyp( i, Algo ) < 0;
- if ( !isNoneAlg )
- isReqDisBound = myAvailableHypData[i][Algo].at( currentHyp( i, Algo ) )->InputTypes.isEmpty();
- else
- isReqDisBound = true;
- if ( isReqDisBound && isNoneAlg ) {
- for (int j = i - 1; j >= SMESH::DIM_0D; j--) {
- if ( j < aDim && currentHyp( j+1, Algo ) < 0 ) {
- myDlg->disableTab( j );
- setCurrentHyp( j , Algo, -1 );
- }
- }
- break;
- }
- else if ( isNoneAlg ) {
- myDlg->disableTab( i );
- }
- }
- }
- myDlg->enableTab( aDim );
- myDlg->setCurrentTab( aDim );
- }