+ // get hyps compatible with curAlgo
+ if ( curAlgo )
+ {
+ // check if a selected hyp is compatible with the curAlgo
+ if ( !curHyp->_is_nil() ) {
+ HypothesisData* hypData = SMESH::GetHypothesisData( curHyp->GetName() );
+ if ( !isCompatible( curAlgo, hypData, type ))
+ curHyp = SMESH::SMESH_Hypothesis::_nil();
+ }
+ existingHyps( dim, type, pObj, anExisting, myExistingHyps[ dim ][ type ], curAlgo);
+ availableHyps( dim, type, anAvailable, myAvailableHypData[ dim ][ type ], curAlgo);
+ }
+ // set list of hypotheses
+ myDlg->tab( dim )->setAvailableHyps( type, anAvailable );
+ myDlg->tab( dim )->setExistingHyps( type, anExisting );
+
+ // set current existing hypothesis
+ if ( !curHyp->_is_nil() && !anExisting.isEmpty() )
+ hypIndex = this->find( curHyp, myExistingHyps[ dim ][ type ]);
+ else
+ hypIndex = -1;
+ if ( !isSubmesh && hypIndex < 0 && anExisting.count() == 1 ) {
+ // none is yet selected => select the sole existing if it is not optional
+ CORBA::String_var hypTypeName = myExistingHyps[ dim ][ type ].first().first->GetName();
+ bool isOptional = true;
+ if ( algoByDim[ dim ] &&
+ SMESH::IsAvailableHypothesis( algoByDim[ dim ], hypTypeName.in(), isOptional ) &&
+ !isOptional )
+ hypIndex = 0;
+ }
+ setCurrentHyp( dim, type, hypIndex );
+ }
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Creates and selects hypothesis of hypotheses set
+ * \param theSetName - The name of hypotheses set
+ */
+//================================================================================
+void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
+{
+ myHypoSet = SMESH::GetHypothesesSet(theSetName);
+ if (!myHypoSet)
+ return;
+
+ // clear all hyps
+ for (int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++) {
+ setCurrentHyp(dim, Algo, -1);
+ setCurrentHyp(dim, AddHyp, -1);
+ setCurrentHyp(dim, MainHyp, -1);
+ }
+
+ myHypoSet->init(true); //algorithms
+ processSet();
+ myHypoSet->init(false); //hypotheses
+ processSet();
+ myHypoSet = 0;
+}
+
+//================================================================================
+/*!
+ * \brief One step of hypothesis/algorithm list creation
+ *
+ * Creates a hypothesis or an algorithm for current item of internal list of names myHypoSet
+ */
+//================================================================================
+void SMESHGUI_MeshOp::processSet()
+{
+ myHypoSet->next();
+ if( !myHypoSet->more() )
+ return;
+
+ bool isAlgo = myHypoSet->isAlgo();
+ QString aHypoTypeName = myHypoSet->current();
+ HypothesisData* aHypData = SMESH::GetHypothesisData(aHypoTypeName);
+ if (!aHypData)
+ {
+ processSet();
+ return;
+ }
+
+ int aDim = aHypData->Dim[0];
+ // create or/and set
+ if (isAlgo)
+ {
+ int index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
+ if ( index < 0 )
+ {
+ QStringList anAvailable;
+ availableHyps( aDim, Algo, anAvailable, myAvailableHypData[aDim][Algo] );
+ myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailable );
+ index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
+ }
+ setCurrentHyp( aDim, Algo, index );
+ onAlgoSelected( index, aDim );
+ processSet();
+ }
+ else
+ {
+ bool mainHyp = true;
+ QStringList anAvailable;
+ availableHyps( aDim, MainHyp, anAvailable, myAvailableHypData[aDim][MainHyp] );
+ myDlg->tab( aDim )->setAvailableHyps( MainHyp, anAvailable );
+ int index = myAvailableHypData[aDim][MainHyp].indexOf( aHypData );
+ if ( index < 0 )
+ {
+ mainHyp = false;
+ index = myAvailableHypData[aDim][AddHyp].indexOf( aHypData );
+ }
+ if (index >= 0)
+ createHypothesis(aDim, mainHyp ? MainHyp : AddHyp, aHypoTypeName);
+ else
+ processSet();
+ }