+//================================================================================
+/*!
+ * \brief Update list of algorithms and hypotheses according to currently selected
+ * algorithm, geometry and mesh type
+ */
+//================================================================================
+void SMESHGUI_MeshOp::setFilteredAlgoData()
+{
+ // keep current algorithms
+ HypothesisData* curAlgos[ 4 ];
+ for ( int dim = 0; dim <= 3; ++dim )
+ curAlgos[ dim ] = hypData( dim, Algo, currentHyp( dim, Algo ));
+
+ // find out myMaxShapeDim by checking algorithm applicability to geometry
+
+ int curMeshType = myDlg->currentMeshType();
+ myDlg->setCurrentMeshType( MT_ANY );
+ QStringList algosAvailable;
+ // get available algorithms taking into account geometry only
+ if ( myGeom->_is_nil() )
+ {
+ myMaxShapeDim = 3;
+
+ if ( myToCreate ) // readMesh() has done it if !myToCreate
+ for ( int dim = 0; dim <= 3; ++dim )
+ availableHyps( dim, Algo, algosAvailable, myAvailableHypData[ dim ][ Algo ] );
+ }
+ else
+ {
+ if ( myGeomEntry != myLastGeomEntry )
+ myHypMapIsApplicable.clear();
+
+ for ( int dim = 0; dim <= 3; ++dim )
+ {
+ availableHyps( dim, Algo, algosAvailable, myAvailableHypData[ dim ][ Algo ] );
+ if ( algosAvailable.count() )
+ myMaxShapeDim = dim;
+ }
+ if ( !myGeomEntry.isEmpty() )
+ myLastGeomEntry = myGeomEntry;
+ }
+ myDlg->setMaxHypoDim( myMaxShapeDim );
+
+ // set mesh types according to myMaxShapeDim
+ updateMeshTypeList();
+
+ // update available hypo-sets that depend on geometry and mesh type
+ myDlg->setCurrentMeshType( Max( MT_ANY, curMeshType ));
+ updateHypoSets(); // it sets myAvailableHypData by curMeshType
+
+ // restore current algorithms according to changed myAvailableHypData
+ for ( int dim = 0; dim <= 3; ++dim )
+ {
+ int algoIndex = myAvailableHypData[ dim ][ Algo ].indexOf( curAlgos[ dim ]);
+ while ( algosAvailable.count() <= algoIndex )
+ algosAvailable << "";
+ myDlg->tab( dim )->setAvailableHyps( Algo, algosAvailable );
+ setCurrentHyp( dim, Algo, algoIndex );
+ if ( algoIndex < 0 )
+ curAlgos[ dim ] = 0;
+ }
+
+ // find a selected algo, current or of highest dimension
+ int algoDim = myDlg->currentTab();
+ if ( !curAlgos[ algoDim ])
+ for ( algoDim = SMESH::DIM_3D; algoDim >= SMESH::DIM_0D; algoDim-- )
+ if ( curAlgos[ algoDim ] )
+ break;
+ if ( algoDim < SMESH::DIM_0D )
+ algoDim = myMaxShapeDim;
+
+ // set algorithms and hypotheses according to all parameters (mesh type etc)
+ onAlgoSelected( currentHyp( algoDim, Algo ), algoDim );
+}
+