0021180: EDF 1772 SMESH: Set of hypothesis in 1D

This commit is contained in:
vsr 2011-02-09 15:25:51 +00:00
parent 3c96a71bde
commit 2fee37828a
2 changed files with 24 additions and 18 deletions

View File

@ -479,9 +479,13 @@ void SMESHGUI_MeshDlg::setMaxHypoDim( const int maxDim )
const int DIM = maxDim; const int DIM = maxDim;
for ( int dim = Dim0D; dim <= Dim3D; ++dim ) { for ( int dim = Dim0D; dim <= Dim3D; ++dim ) {
bool enable = ( dim <= DIM ); bool enable = ( dim <= DIM );
if ( !enable ) if ( !enable ) {
myTabs[ dim ]->reset(); myTabs[ dim ]->reset();
myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ dim ] ), enable ); disableTab( dim );
}
else {
enableTab( dim );
}
} }
// deselect desabled tab // deselect desabled tab
if ( !myTabWg->isTabEnabled( myTabWg->currentIndex() ) ) if ( !myTabWg->isTabEnabled( myTabWg->currentIndex() ) )
@ -507,7 +511,7 @@ void SMESHGUI_MeshDlg::setHypoSets( const QStringList& theSets )
for ( int i = 0, n = theSets.count(); i < n; i++ ) { for ( int i = 0, n = theSets.count(); i < n; i++ ) {
aHypoSetPopup->addAction( theSets[ i ] ); aHypoSetPopup->addAction( theSets[ i ] );
} }
myHypoSetButton->setEnabled( !aHypoSetPopup->isEmpty() ); myHypoSetButton->setEnabled( !aHypoSetPopup->isEmpty() && isTabEnabled( Dim3D ) );
} }
//================================================================================ //================================================================================
@ -565,6 +569,7 @@ void SMESHGUI_MeshDlg::setGeomPopupEnabled( const bool enable )
//================================================================================ //================================================================================
void SMESHGUI_MeshDlg::disableTab(const int theTabId) { void SMESHGUI_MeshDlg::disableTab(const int theTabId) {
myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ), false ); myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ), false );
if ( theTabId == Dim3D ) myHypoSetButton->setEnabled( false );
} }
//================================================================================ //================================================================================
@ -575,6 +580,10 @@ void SMESHGUI_MeshDlg::disableTab(const int theTabId) {
//================================================================================ //================================================================================
void SMESHGUI_MeshDlg::enableTab(const int theTabId) { void SMESHGUI_MeshDlg::enableTab(const int theTabId) {
myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ), true ); myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ), true );
if ( theTabId == Dim3D ) {
QMenu* aHypoSetPopup = myHypoSetButton->menu();
myHypoSetButton->setEnabled( aHypoSetPopup && !aHypoSetPopup->actions().isEmpty() );
}
} }
//================================================================================ //================================================================================

View File

@ -474,7 +474,7 @@ void SMESHGUI_MeshOp::selectionDone()
{ {
// Enable tabs according to shape dimension // Enable tabs according to shape dimension
int shapeDim = 3; int shapeDim = -1;
QStringList aGEOMs; QStringList aGEOMs;
myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs); myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
@ -504,7 +504,7 @@ void SMESHGUI_MeshOp::selectionDone()
} }
if (aSeq->length() > 0) { if (aSeq->length() > 0) {
shapeDim = 0; //shapeDim = 0;
for (int iss = 0; iss < aSeq->length() && shapeDim < 3; iss++) { for (int iss = 0; iss < aSeq->length() && shapeDim < 3; iss++) {
GEOM::GEOM_Object_var aGeomVar = aSeq[iss]; GEOM::GEOM_Object_var aGeomVar = aSeq[iss];
switch ( aGeomVar->GetShapeType() ) { switch ( aGeomVar->GetShapeType() ) {
@ -512,18 +512,15 @@ void SMESHGUI_MeshOp::selectionDone()
case GEOM::SHELL: case GEOM::SHELL:
{ {
//shapeDim = 3; // Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab //shapeDim = 3; // Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab
shapeDim = (shapeDim < 2) ? 2 : shapeDim;
TopoDS_Shape aShape; TopoDS_Shape aShape;
if (GEOMBase::GetShape(aGeomVar, aShape)) { bool isClosed = GEOMBase::GetShape(aGeomVar, aShape) && /*aShape.Closed()*/BRep_Tool::IsClosed(aShape);
if (/*aShape.Closed()*/BRep_Tool::IsClosed(aShape)) shapeDim = qMax(isClosed ? 3 : 2, shapeDim);
shapeDim = 3;
}
} }
break; break;
case GEOM::FACE: shapeDim = (shapeDim < 2) ? 2 : shapeDim; break; case GEOM::FACE: shapeDim = qMax(2, shapeDim); break;
case GEOM::WIRE: case GEOM::WIRE:
case GEOM::EDGE: shapeDim = (shapeDim < 1) ? 1 : shapeDim; break; case GEOM::EDGE: shapeDim = qMax(1, shapeDim); break;
case GEOM::VERTEX: break; case GEOM::VERTEX: shapeDim = qMax(0, shapeDim); break;
default: default:
{ {
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -531,18 +528,18 @@ void SMESHGUI_MeshOp::selectionDone()
TopExp_Explorer exp (aShape, TopAbs_SHELL); TopExp_Explorer exp (aShape, TopAbs_SHELL);
if (exp.More()) { if (exp.More()) {
//shapeDim = 3; // Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab //shapeDim = 3; // Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab
shapeDim = (shapeDim < 2) ? 2 : shapeDim; shapeDim = qMax(2, shapeDim);
for (; exp.More() && shapeDim == 2; exp.Next()) { for (; exp.More() && shapeDim == 2; exp.Next()) {
if (/*exp.Current().Closed()*/BRep_Tool::IsClosed(exp.Current())) if (/*exp.Current().Closed()*/BRep_Tool::IsClosed(exp.Current()))
shapeDim = 3; shapeDim = 3;
} }
} }
else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() ) else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() )
shapeDim = (shapeDim < 2) ? 2 : shapeDim; shapeDim = qMax(2, shapeDim);
else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() ) else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() )
shapeDim = (shapeDim < 1) ? 1 : shapeDim; shapeDim = qMax(1, shapeDim);
else else if ( exp.Init( aShape, TopAbs_VERTEX ), exp.More() )
;//shapeDim = 0; shapeDim = qMax(0, shapeDim);
} }
} }
} }