IMP23371: [CEA 1441] Define the faces where we impose the boundary layer from the dialog box of MG-Hybrid

This commit is contained in:
eap 2016-12-20 15:53:36 +03:00
parent 7eec94a3ae
commit dca6c871d2
2 changed files with 52 additions and 22 deletions

View File

@ -37,6 +37,7 @@
#include <SALOME_ListIO.hxx> #include <SALOME_ListIO.hxx>
#include <SUIT_OverrideCursor.h> #include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h> #include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SVTK_Selector.h> #include <SVTK_Selector.h>
#include <SVTK_ViewModel.h> #include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h> #include <SVTK_ViewWindow.h>
@ -72,30 +73,36 @@
StdMeshersGUI_SubShapeSelectorWdg StdMeshersGUI_SubShapeSelectorWdg
::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent, ::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent,
TopAbs_ShapeEnum subShType, TopAbs_ShapeEnum subShType,
const bool toShowList ): const bool toShowList,
const bool toShowActivateBtn ):
QWidget( parent ), QWidget( parent ),
myMaxSize( -1 ), myMaxSize( -1 ),
myPreviewActor( 0 ) myPreviewActor( 0 )
{ {
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) ); QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
QGridLayout* edgesLayout = new QGridLayout( this ); QGridLayout* layout = new QGridLayout( this );
edgesLayout->setMargin( MARGIN ); layout->setMargin( MARGIN );
edgesLayout->setSpacing( SPACING ); layout->setSpacing( SPACING );
if ( toShowList ) if ( toShowList )
{ {
myListWidget = new QListWidget( this ); QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this ); myListWidget = new QListWidget( this );
myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this ); myActivateButton = new QPushButton( iconSelect, "", this );
myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this );
myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this );
myListWidget->setSelectionMode( QListWidget::ExtendedSelection ); myListWidget->setSelectionMode( QListWidget::ExtendedSelection );
myListWidget->setMinimumWidth(300); myListWidget->setMinimumWidth(300);
myListWidget->setWrapping(true);
myActivateButton->setCheckable( true );
} }
else else
{ {
myListWidget = 0; myListWidget = 0;
myAddButton = 0; myActivateButton = 0;
myRemoveButton = 0; myAddButton = 0;
myRemoveButton = 0;
} }
myInfoLabel = new QLabel( this ); myInfoLabel = new QLabel( this );
myPrevButton = new QPushButton( "<<", this ); myPrevButton = new QPushButton( "<<", this );
@ -103,21 +110,27 @@ StdMeshersGUI_SubShapeSelectorWdg
if ( myListWidget ) if ( myListWidget )
{ {
edgesLayout->addWidget(myListWidget, 0, 0, 3, 3); int row = 0;
edgesLayout->addWidget(myAddButton, 0, 3); layout->addWidget(myListWidget, row, 0, 3+toShowActivateBtn, 3);
edgesLayout->addWidget(myRemoveButton, 1, 3); if ( toShowActivateBtn )
edgesLayout->addWidget(myInfoLabel, 3, 0, 1, 3); layout->addWidget( myActivateButton, row++, 3 );
edgesLayout->addWidget(myPrevButton, 4, 0); else
edgesLayout->addWidget(myNextButton, 4, 2); myActivateButton->hide();
layout->addWidget(myAddButton, row, 3);
layout->addWidget(myRemoveButton, ++row, 3);
++row;
layout->addWidget(myInfoLabel, ++row, 0, 1, 3);
layout->addWidget(myPrevButton, ++row, 0);
layout->addWidget(myNextButton, row, 2);
edgesLayout->setRowStretch(2, 5); layout->setRowStretch(row-2, 5);
edgesLayout->setColumnStretch(1, 5); layout->setColumnStretch(1, 5);
} }
else // show only Prev and Next buttons else // show only Prev and Next buttons
{ {
edgesLayout->addWidget(myInfoLabel, 0, 0, 1, 2); layout->addWidget(myInfoLabel, 0, 0, 1, 2);
edgesLayout->addWidget(myPrevButton, 1, 0); layout->addWidget(myPrevButton, 1, 0);
edgesLayout->addWidget(myNextButton, 1, 1); layout->addWidget(myNextButton, 1, 1);
} }
//myInfoLabel->setMinimumWidth(300); //myInfoLabel->setMinimumWidth(300);
//myInfoLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); //myInfoLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
@ -187,6 +200,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::init()
myRemoveButton->setEnabled( false ); myRemoveButton->setEnabled( false );
connect( myListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); connect( myListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged()));
connect( myActivateButton, SIGNAL( toggled(bool) ), SLOT( ActivateSelection(bool)));
connect( myAddButton, SIGNAL(clicked()), SLOT(onAdd())); connect( myAddButton, SIGNAL(clicked()), SLOT(onAdd()));
connect( myRemoveButton, SIGNAL(clicked()), SLOT(onRemove())); connect( myRemoveButton, SIGNAL(clicked()), SLOT(onRemove()));
} }
@ -248,6 +262,15 @@ void StdMeshersGUI_SubShapeSelectorWdg::ShowPreview( bool visible)
void StdMeshersGUI_SubShapeSelectorWdg::ActivateSelection( bool toActivate ) void StdMeshersGUI_SubShapeSelectorWdg::ActivateSelection( bool toActivate )
{ {
// adjust state of myActivateButton
if ( myActivateButton &&
myActivateButton != sender() &&
myActivateButton->isChecked() != toActivate )
{
myActivateButton->toggle();
return;
}
if ( !mySelectionMgr ) return; if ( !mySelectionMgr ) return;
if ( toActivate ) if ( toActivate )
@ -258,6 +281,9 @@ void StdMeshersGUI_SubShapeSelectorWdg::ActivateSelection( bool toActivate )
{ {
disconnect(mySelectionMgr, 0, this, 0 ); disconnect(mySelectionMgr, 0, this, 0 );
} }
if ( sender() == myActivateButton )
ShowPreview( toActivate );
} }
//================================================================================ //================================================================================

View File

@ -52,7 +52,8 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget
public: public:
StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0, StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0,
TopAbs_ShapeEnum subShType = TopAbs_EDGE, TopAbs_ShapeEnum subShType = TopAbs_EDGE,
const bool toShowList = true); const bool toShowList = true,
const bool toShowActivateBtn = false);
~StdMeshersGUI_SubShapeSelectorWdg(); ~StdMeshersGUI_SubShapeSelectorWdg();
SMESH::long_array_var GetListOfIDs(); SMESH::long_array_var GetListOfIDs();
@ -80,6 +81,8 @@ public:
vtkRenderer* GetRenderer() { return myRenderer; } vtkRenderer* GetRenderer() { return myRenderer; }
SMESH_PreviewActorsCollection* GetActorCollection() { return myPreviewActor; } SMESH_PreviewActorsCollection* GetActorCollection() { return myPreviewActor; }
void ClearSelected(); void ClearSelected();
public slots:
void ActivateSelection( bool ); void ActivateSelection( bool );
signals: signals:
@ -114,6 +117,7 @@ private:
vtkRenderer* myRenderer; vtkRenderer* myRenderer;
QListWidget* myListWidget; QListWidget* myListWidget;
QPushButton* myActivateButton;
QPushButton* myAddButton; QPushButton* myAddButton;
QPushButton* myRemoveButton; QPushButton* myRemoveButton;
QLabel* myInfoLabel; QLabel* myInfoLabel;