PAL10513. Desable tabs according to shape dimention at edition as well

This commit is contained in:
eap 2005-11-14 14:11:48 +00:00
parent 52c4d72583
commit 773894ff04

View File

@ -276,48 +276,50 @@ void SMESHGUI_MeshOp::selectionDone()
// Enable tabs according to shape dimension // Enable tabs according to shape dimension
int shapeDim = 3; int shapeDim = 3;
if ( myToCreate ) try
{ {
try GEOM::GEOM_Object_var aGeomVar;
{ QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() );
_PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() ); if ( pGeom ) {
if ( pGeom ) { aGeomVar = GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
GEOM::GEOM_Object_var aGeomVar = }
GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() ); else {
if ( !aGeomVar->_is_nil() ) { QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
shapeDim = 0; _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() );
switch ( aGeomVar->GetShapeType() ) { aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
case GEOM::SOLID: }
case GEOM::SHELL: shapeDim = 3; break; if ( !aGeomVar->_is_nil() ) {
case GEOM::FACE: shapeDim = 2; break; shapeDim = 0;
case GEOM::WIRE: switch ( aGeomVar->GetShapeType() ) {
case GEOM::EDGE: shapeDim = 1; break; case GEOM::SOLID:
case GEOM::VERTEX: shapeDim = 0; break; case GEOM::SHELL: shapeDim = 3; break;
default: case GEOM::FACE: shapeDim = 2; break;
TopoDS_Shape aShape; case GEOM::WIRE:
if ( GEOMBase::GetShape(aGeomVar, aShape)) { case GEOM::EDGE: shapeDim = 1; break;
TopExp_Explorer exp( aShape, TopAbs_SHELL ); case GEOM::VERTEX: shapeDim = 0; break;
if ( exp.More() ) default:
shapeDim = 3; TopoDS_Shape aShape;
else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() ) if ( GEOMBase::GetShape(aGeomVar, aShape)) {
shapeDim = 2; TopExp_Explorer exp( aShape, TopAbs_SHELL );
else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() ) if ( exp.More() )
shapeDim = 1; shapeDim = 3;
else else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() )
shapeDim = 0; shapeDim = 2;
} else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() )
} shapeDim = 1;
else
shapeDim = 0;
} }
} }
} }
catch ( const SALOME::SALOME_Exception& S_ex ) }
{ catch ( const SALOME::SALOME_Exception& S_ex )
SalomeApp_Tools::QtCatchCorbaException( S_ex ); {
} SalomeApp_Tools::QtCatchCorbaException( S_ex );
catch ( ... ) }
{ catch ( ... )
} {
} }
myDlg->setMaxHypoDim( shapeDim ); myDlg->setMaxHypoDim( shapeDim );
} }