- case HYP_OK:
- switch (event)
- {
- case ADD_HYP:
- {
- ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO);
- SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
- ASSERT(algo);
- list<SMESHDS_Hypothesis*> originalUsedHyps
- = algo->GetUsedHypothesis((*_father), _subShape); // copy
-
- ret = _meshDS->AddHypothesis(_subShape, anHyp);
- if (ret)
- {
- ret = algo->CheckHypothesis((*_father),_subShape);
- if (! ret)
- {
- INFOS("two applying algo on the same shape not allowed");
- ret = _meshDS->RemoveHypothesis(_subShape, anHyp);
- ret = false;
- }
- else // compare SMESHDS_Hypothesis* lists (order important)
- {
- MESSAGE("---");
- const list<SMESHDS_Hypothesis*>& newUsedHyps
- = algo->GetUsedHypothesis((*_father), _subShape);
- modifiedHyp = (originalUsedHyps != newUsedHyps);
- }
- }
- }
- break;
- case ADD_ALGO: //already existing algo : on father ?
- ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO);
- if (anHyp->GetDim() <= SMESH_Gen::GetShapeDim(_subShape))
- {
- ret = _meshDS->AddHypothesis(_subShape, anHyp);
-// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)))
-// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType()))
- if (ret &&(anHyp->GetShapeType() & (1<< _subShape.ShapeType())))
- {
- SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
- if (algo == NULL) // two algo on the same subShape...
- {
- INFOS("two algo on the same subshape not allowed");
- ret = _meshDS->RemoveHypothesis(_subShape, anHyp);
- ret = false;
- }
- else
- {
- ret = algo->CheckHypothesis((*_father),_subShape);
- if (ret) SetAlgoState(HYP_OK);
- else SetAlgoState(MISSING_HYP);
- }
- }
- }
- break;
- case REMOVE_HYP:
- ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO);
- ret = _meshDS->RemoveHypothesis(_subShape, anHyp);
- if (ret)
- {
- SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
- ASSERT(algo);
- ret = algo->CheckHypothesis((*_father),_subShape);
- if (ret) SetAlgoState(HYP_OK);
- else SetAlgoState(MISSING_HYP);
- modifiedHyp = true;
- }
- break;
- case REMOVE_ALGO: // perhaps a father algo applies ?
- ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO);
- ret = _meshDS->RemoveHypothesis(_subShape, anHyp);
-// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)))
-// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType()))
- if (ret &&(anHyp->GetShapeType() & (1<< _subShape.ShapeType())))
- {
- SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
- if (algo == NULL) // no more algo applying on subShape...
- {
- SetAlgoState(NO_ALGO);
- }
- else
- {
- ret = algo->CheckHypothesis((*_father),_subShape);
- if (ret) SetAlgoState(HYP_OK);
- else SetAlgoState(MISSING_HYP);
- }
- }
- break;
- case ADD_FATHER_HYP:
- ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO);
- {
- SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
- ASSERT(algo);
- ret = algo->CheckHypothesis((*_father),_subShape);
- if (ret) SetAlgoState(HYP_OK);
- else SetAlgoState(MISSING_HYP);
- }
- break;
- case ADD_FATHER_ALGO: // detect if two algo of same dim on father
- ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO);
-// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))
-// if (anHyp->GetShapeType() == _subShape.ShapeType())
- if (anHyp->GetShapeType() & (1<< _subShape.ShapeType()))
- {
- SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
- if (algo == NULL) // two applying algo on father
- {
- MESSAGE("two applying algo on fatherShape...");
- SetAlgoState(NO_ALGO);
- }
- else
- {
- ret = algo->CheckHypothesis((*_father),_subShape);
- if (ret) SetAlgoState(HYP_OK);
- else SetAlgoState(MISSING_HYP);
- }
- }
- break;
- case REMOVE_FATHER_HYP:
- ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO);
- {
- SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
- ASSERT(algo);
- ret = algo->CheckHypothesis((*_father),_subShape);
- if (ret) SetAlgoState(HYP_OK);
- else SetAlgoState(MISSING_HYP);
- }
- break;
- case REMOVE_FATHER_ALGO:
- ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO);
-// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))
-// if (anHyp->GetShapeType() == _subShape.ShapeType())
- if (anHyp->GetShapeType() & (1<< _subShape.ShapeType()))
- {
- SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
- if (algo == NULL) // no more applying algo on father
- {
- SetAlgoState(NO_ALGO);
- }
- else
- {
- ret = algo->CheckHypothesis((*_father),_subShape);
- if (ret) SetAlgoState(HYP_OK);
- else SetAlgoState(MISSING_HYP);
- }
- }
- break;
- default:
- ASSERT(0);
- break;
- }
+ case MISSING_HYP:
+ switch (event)
+ {
+ case ADD_HYP: {
+ SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
+ ASSERT(algo);
+ if ( algo->CheckHypothesis((*_father),_subShape, ret ))
+ SetAlgoState(HYP_OK);
+ if (SMESH_Hypothesis::IsStatusFatal( ret ))
+ _meshDS->RemoveHypothesis(_subShape, anHyp);
+ else if (!_father->IsUsedHypothesis( anHyp, this ))
+ {
+ _meshDS->RemoveHypothesis(_subShape, anHyp);
+ ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
+ }
+ break;
+ }
+ case ADD_ALGO: { //already existing algo : on father ?
+ SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
+ ASSERT(algo);
+ if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))// ignore hyp status
+ SetAlgoState(HYP_OK);
+ else
+ SetAlgoState(MISSING_HYP);
+ break;
+ }
+ case REMOVE_HYP:
+ break;
+ case REMOVE_ALGO: { // perhaps a father algo applies ?
+ SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
+ if (algo == NULL) // no more algo applying on subShape...
+ {
+ SetAlgoState(NO_ALGO);
+ }
+ else
+ {
+ if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+ SetAlgoState(HYP_OK);
+ else
+ SetAlgoState(MISSING_HYP);
+ }
+ break;
+ }
+ case ADD_FATHER_HYP: {
+ SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
+ ASSERT(algo);
+ if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+ SetAlgoState(HYP_OK);
+ else
+ SetAlgoState(MISSING_HYP);
+ }
+ break;
+ case ADD_FATHER_ALGO: { // new father algo
+ SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
+ ASSERT( algo );
+ if ( algo == anHyp ) {
+ if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+ SetAlgoState(HYP_OK);
+ else
+ SetAlgoState(MISSING_HYP);
+ }
+ break;
+ }
+ case REMOVE_FATHER_HYP: // nothing to do