X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSMESHGUI%2FSMESHGUI_MeshOp.cxx;h=10521987a966074700026710e6e62c04366ae7c3;hb=a6c877f633bb393705e79b264adfdda5164ad8b1;hp=626081091cb9276978771eee3155646d58cdae48;hpb=e26ffcc005221f12d4ff91e074c4c8464ca044e4;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 626081091..10521987a 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -41,6 +41,7 @@ #include #include #include +#include // SALOME GUI includes #include @@ -2081,13 +2082,9 @@ void SMESHGUI_MeshOp::readMesh() } // Get name of geometry object - GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj ); - if ( !aGeomVar->_is_nil() ) - { - _PTR(SObject) aGeomSO = studyDS()->FindObjectID( aGeomVar->GetStudyEntry() ); - QString aShapeName = name( aGeomSO ); - myDlg->setObjectText( SMESHGUI_MeshDlg::Geom, aShapeName ); - } + CORBA::String_var name = SMESH::GetGeomName( pObj ); + if ( name.in() ) + myDlg->setObjectText( SMESHGUI_MeshDlg::Geom, name.in() ); } // Get hypotheses and algorithms assigned to the mesh/sub-mesh @@ -2535,33 +2532,40 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI int anCurrentAvailableAlgo = 0; bool isNone = true; switch ( theIndex ) { - case MT_ANY:{ + case MT_ANY: anCompareType = "ANY"; aDim = SMESH::DIM_3D; - } - break; - case MT_TRIANGULAR:{ + break; + case MT_TRIANGULAR: aDim = SMESH::DIM_2D; anCompareType = "TRIA"; - } - break; - case MT_QUADRILATERAL:{ + break; + case MT_QUADRILATERAL: aDim = SMESH::DIM_2D; anCompareType = "QUAD"; - } - break; - case MT_TETRAHEDRAL:{ + break; + case MT_TETRAHEDRAL: aDim = SMESH::DIM_3D; anCompareType = "TETRA"; - } - break; - case MT_HEXAHEDRAL:{ + break; + case MT_HEXAHEDRAL: aDim = SMESH::DIM_3D; anCompareType = "HEXA"; - } - break; + break; default:; } + + bool toCheckIsApplicableToAll = !myIsMesh; + GEOM::GEOM_Object_var aGeomVar; + QString anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); + if ( _PTR(SObject) so = studyDS()->FindObjectID( anEntry.toLatin1().data() )) + { + CORBA::Object_var obj = _CAST( SObject,so )->GetObject(); + aGeomVar = GEOM::GEOM_Object::_narrow( obj ); + if ( !aGeomVar->_is_nil() && toCheckIsApplicableToAll ) + toCheckIsApplicableToAll = ( aGeomVar->GetType() == GEOM_GROUP ); + } + if ( anCompareType == "ANY" ) { for ( int dim = SMESH::DIM_2D; dim <= SMESH::DIM_3D; dim++ ) @@ -2572,7 +2576,7 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI availableHyps( dim, Algo, anAvailableAlgs, anAvailableAlgsData ); //return current algo in current tab and set new algorithm list HypothesisData* algoCur; - if ( !isNone && !myAvailableHypData[dim][Algo].empty() ){ + if ( !isNone && !myAvailableHypData[dim][Algo].empty() ) { algoCur = myAvailableHypData[dim][Algo].at( currentHyp( dim, Algo ) ); } myAvailableHypData[dim][Algo].clear(); @@ -2580,19 +2584,14 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI for (int i = 0 ; i < anAvailableAlgsData.count(); i++) { HypothesisData* curAlgo = anAvailableAlgsData.at(i); - QString anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); - GEOM::GEOM_Object_var aGeomVar = GEOM::GEOM_Object::_nil(); - if ( _PTR(SObject) pGeom = studyDS()->FindObjectID( anEntry.toLatin1().data() )) - { - aGeomVar= GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() ); - } if ( aGeomVar->_is_nil() || - ( !aGeomVar->_is_nil() && SMESH::IsApplicable( curAlgo->TypeName, aGeomVar, !myIsMesh ))){ + SMESH::IsApplicable( curAlgo->TypeName, aGeomVar, toCheckIsApplicableToAll )) + { anAvailableAlgs.append( curAlgo->Label ); myAvailableHypData[dim][Algo].append( curAlgo ); } } - if ( !isNone && algoCur ){ + if ( !isNone && algoCur ) { for (int i = 0 ; i < myAvailableHypData[dim][Algo].count(); i++) { HypothesisData* algoAny = myAvailableHypData[dim][Algo].at(i); @@ -2603,7 +2602,7 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI } } } - else if ( !isNone ){ + else if ( !isNone ) { isAvailableChoiceAlgo = true; anCurrentAvailableAlgo = currentHyp( dim, Algo ); } @@ -2657,27 +2656,22 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI QStringList::const_iterator inElemType = algoIn->OutputTypes.begin(); for ( ; inElemType != algoIn->OutputTypes.end(); inElemType++ ) { - if ( *inElemType == anCurrentCompareType ){ + if ( *inElemType == anCurrentCompareType ) { isAvailableAlgo = true; break; } } - if ( isAvailableAlgo || algoIn->OutputTypes.count()==0 ){ - QString anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); - GEOM::GEOM_Object_var aGeomVar = GEOM::GEOM_Object::_nil(); - if ( _PTR(SObject) pGeom = studyDS()->FindObjectID( anEntry.toLatin1().data() )) - { - aGeomVar= GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() ); - } + if ( isAvailableAlgo || algoIn->OutputTypes.count()==0 ) { if ( aGeomVar->_is_nil() || myMaxShapeDim != dim || - ( !aGeomVar->_is_nil() && SMESH::IsApplicable( algoIn->TypeName, aGeomVar, !myIsMesh ))){ + SMESH::IsApplicable( algoIn->TypeName, aGeomVar, toCheckIsApplicableToAll )) + { anAvailableAlgs.append( algoIn->Label ); myAvailableHypData[dim][Algo].append( algoIn ); myFilteredAlgoData[dim].append( algoIn ); } } //algorithm will be active, if the chosen algorithm available in the current mesh type - if ( !isNoneAlg && isAvailableAlgo && algoIn->Label == anCurrentAlgo ){ + if ( !isNoneAlg && isAvailableAlgo && algoIn->Label == anCurrentAlgo ) { isAvailableChoiceAlgo = true; anCurrentAvailableAlgo = anAvailableAlgs.count() - 1 ; } @@ -2691,21 +2685,20 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI setCurrentHyp( dim, Algo, -1 ); } - int aMaxShapeDim = ( myMaxShapeDim != aDim) ? aDim : myMaxShapeDim; if ( isNone || isReqDisBound ) { - for ( int i = SMESH::DIM_0D; i <= aMaxShapeDim; i++ ) { + for ( int i = SMESH::DIM_0D; i <= myMaxShapeDim; i++ ) { if ( aDim != i ) { myDlg->disableTab( i ); setCurrentHyp(i, Algo, -1); } } } - else if ( !isNone ){ + else if ( !isNone ) { if ( aDim == SMESH::DIM_2D){ myDlg->disableTab( SMESH::DIM_3D ); setCurrentHyp( SMESH::DIM_3D, Algo, -1); } - for ( int i = aMaxShapeDim; i > SMESH::DIM_0D; i-- ) + for ( int i = myMaxShapeDim; i > SMESH::DIM_0D; i-- ) { isReqDisBound = ( currentHyp( i, Algo ) < 0 ) ? true : myAvailableHypData[i][Algo].at( currentHyp( i, Algo ) )->InputTypes.isEmpty(); @@ -2735,7 +2728,7 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI isAvailable = false; if ( HypothesisData* algoDataIn = SMESH::GetHypothesisData( currentHypoSet->current() )) { - for (int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++) + for (int i = SMESH::DIM_0D; i <= myMaxShapeDim; i++) { for (int j = 0; j < myAvailableHypData[i][Algo].count(); ++j) { HypothesisData* aCurAlgo = hypData( i, Algo, j );