- int index = -1;
- if ( isAlgo )
- {
- QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, aDim );
- index = aHypTypeNameList.findIndex( aHypoTypeName );
- if ( index < 0 ) continue;
- setCurrentHyp ( aDim, aHypType, index );
- }
- else
- {
- // try to find an existing hypo
- QValueList<SMESH::SMESH_Hypothesis_var> & aList = myExistingHyps[ aDim ][ aHypType ];
- int /*iHyp = 0,*/ nbHyp = aList.count();
-// for ( ; iHyp < nbHyp; ++iHyp )
-// {
-// SMESH::SMESH_Hypothesis_var aHyp = aList[ iHyp ];
-// if ( !aHyp->_is_nil() && aHypoTypeName == aHyp->GetName() ) {
-// index = iHyp;
-// break;
-// }
-// }
- if ( index >= 0 ) // found
- {
- // select the found hypothesis
- setCurrentHyp ( aDim, aHypType, index );
- }
- else
- {
- // create a hypothesis
- QString aClientLibName = aHypData->ClientLibName;
- if ( aClientLibName == "" ) {
- // Call hypothesis creation server method (without GUI)
- SMESH::CreateHypothesis( aHypoTypeName, aHypData->Label, isAlgo );
- }
- else {
- // Get hypotheses creator client (GUI)
- SMESHGUI_GenericHypothesisCreator* aCreator =
- SMESH::GetHypothesisCreator( aHypoTypeName );
- if ( aCreator )
- {
- // When create or edit a submesh, try to initialize a new hypothesis
- // with values used to mesh a subshape
- SMESH::SMESH_Hypothesis_var initParamHyp =
- getInitParamsHypothesis( aHypoTypeName, aHypData->ServerLibName );
- aCreator->create( initParamHyp, myDlg );
- }
- else
- {
- SMESH::CreateHypothesis( aHypoTypeName, aHypData->Label, isAlgo );
- }
- }
- QStringList aNewHyps;
- _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
- existingHyps( aDim, aHypType, aFather, aNewHyps, aList );
- if ( aList.count() > nbHyp )
- {
- for ( int i = nbHyp; i < aNewHyps.count(); i++ )
- myDlg->tab( aDim )->addHyp( aHypType, aNewHyps[ i ] );
- }
- }
+ if (isAlgo) {
+ QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses(isAlgo, aDim);
+ int index = aHypTypeNameList.findIndex(aHypoTypeName);
+ if (index < 0) continue;
+ setCurrentHyp(aDim, aHypType, index);
+ } else {
+ createHypothesis(aDim, aHypType, aHypoTypeName);