+ myAvailableHypData[ dim ][ type ].clear();
+ QStringList anAvailable, anExisting;
+
+ HypothesisData* curAlgo = algoByDim[ dim ];
+ int hypIndex = currentHyp( dim, type );
+
+ SMESH::SMESH_Hypothesis_var curHyp;
+ if ( hypIndex >= 0 && hypIndex < myExistingHyps[ dim ][ type ].count() )
+ curHyp = myExistingHyps[ dim ][ type ][ hypIndex ];
+
+ if ( !myToCreate && !curAlgo && !curHyp->_is_nil() ) { // edition, algo not selected
+ // try to find algo by selected hypothesis in order to keep it selected
+ bool algoDeselectedByUser = ( theDim < 0 && aDim == dim );
+ QString curHypType = curHyp->GetName();
+ if ( !algoDeselectedByUser &&
+ myObjHyps[ dim ][ type ].count() > 0 &&
+ curHypType == myObjHyps[ dim ][ type ][ 0 ]->GetName())
+ {
+ HypothesisData* hypData = SMESH::GetHypothesisData( curHyp->GetName() );
+ for ( int i = 0 ; i < myAvailableHypData[ dim ][ Algo ].count(); ++i ) {
+ curAlgo = myAvailableHypData[ dim ][ Algo ][ i ];
+ if ( curAlgo && hypData && isCompatible( curAlgo, hypData, type ))
+ break;
+ else
+ curAlgo = 0;
+ }
+ }
+ }
+ // 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
+ QString hypTypeName = myExistingHyps[ dim ][ type ][ 0 ]->GetName();
+ bool isOptional = true;
+ if ( algoByDim[ dim ] &&
+ SMESH::IsAvailableHypothesis( algoByDim[ dim ], hypTypeName, 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 )
+{
+ HypothesesSet* aHypoSet = SMESH::GetHypothesesSet(theSetName);
+ if (!aHypoSet) return;
+
+ // clear all hyps
+ for (int dim = SMESH::DIM_1D; dim <= SMESH::DIM_3D; dim++) {
+ setCurrentHyp(dim, Algo, -1);
+ setCurrentHyp(dim, AddHyp, -1);
+ setCurrentHyp(dim, MainHyp, -1);
+ }
+
+ for (int aHypType = Algo; aHypType < AddHyp; aHypType++) {
+ bool isAlgo = (aHypType == Algo);
+
+ // set hyps from the set
+ QStringList* aHypoList = isAlgo ? &aHypoSet->AlgoList : &aHypoSet->HypoList;
+ for (int i = 0, n = aHypoList->count(); i < n; i++) {