X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_GroupOpDlg.cxx;h=69077f967f5ef8ec291f55ad8706943d2ef6b401;hp=33a4720eae91d96750b9cd35387ec164bc4723a5;hb=5c19bc1e1684ec6a466423361949ed7b60556968;hpb=5d68554076bbca0e1e95fb0db215a6c2b84b6c54 diff --git a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx index 33a4720ea..69077f967 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -30,38 +30,34 @@ #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" - -#include - -// SALOME GUI includes -#include -#include -#include -#include +#include "SMESH_TypeFilter.hxx" #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include - -// SALOME KERNEL includes -#include // Qt includes -#include -#include +#include +#include +#include #include -#include #include +#include +#include #include #include -#include #include -#include -#include -#include -#include +#include +#include #define SPACING 6 #define MARGIN 11 @@ -111,7 +107,7 @@ QWidget* SMESHGUI_GroupOpDlg::createMainFrame( QWidget* theParent ) aLay->setSpacing(SPACING); // ------------------------------------------------------ - QGroupBox* aNameGrp = new QGroupBox(tr("NAME"), aMainGrp); + QGroupBox* aNameGrp = new QGroupBox(tr("RESULT"), aMainGrp); QHBoxLayout* aNameGrpLayout = new QHBoxLayout(aNameGrp); aNameGrpLayout->setMargin(MARGIN); aNameGrpLayout->setSpacing(SPACING); @@ -229,6 +225,8 @@ void SMESHGUI_GroupOpDlg::Init() connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject())); + connect(mySMESHGUI, SIGNAL(SignalActivatedViewManager()), SLOT(onOpenView())); + connect(mySMESHGUI, SIGNAL(SignalCloseView()), SLOT(onCloseView())); // set selection mode if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) @@ -313,6 +311,7 @@ bool SMESHGUI_GroupOpDlg::isValid( const QList& theL */ void SMESHGUI_GroupOpDlg::onOk() { + SUIT_OverrideCursor oc; setIsApplyAndClose( true ); if ( onApply() ) reject(); @@ -334,6 +333,32 @@ void SMESHGUI_GroupOpDlg::reject() QDialog::reject(); } +//================================================================================= +// function : onOpenView() +// purpose : +//================================================================================= +void SMESHGUI_GroupOpDlg::onOpenView() +{ + if ( mySelector ) { + SMESH::SetPointRepresentation(false); + } + else { + mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector(); + mySMESHGUI->EmitSignalDeactivateDialog(); + setEnabled(true); + } +} + +//================================================================================= +// function : onCloseView() +// purpose : +//================================================================================= +void SMESHGUI_GroupOpDlg::onCloseView() +{ + onDeactivate(); + mySelector = 0; +} + /*! \brief SLOT called when "Help" button pressed shows "Help" page */ @@ -462,8 +487,12 @@ void SMESHGUI_GroupOpDlg::enterEvent(QEvent*) { mySMESHGUI->EmitSignalDeactivateDialog(); setEnabled(true); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ); + if ( aViewWindow ) { aViewWindow->SetSelectionMode(ActorSelection); + if (!mySelector) + mySelector = aViewWindow->GetSelector(); + } mySelectionMgr->installFilter(new SMESH_TypeFilter (SMESH::GROUP)); } @@ -499,7 +528,7 @@ void SMESHGUI_GroupOpDlg::setName( const QString& theName ) } /*! - \brief Provides reaction on “F1” button pressing + \brief Provides reaction on �F1� button pressing \param e key press event */ void SMESHGUI_GroupOpDlg::keyPressEvent( QKeyEvent* e ) @@ -952,35 +981,55 @@ void SMESHGUI_CutGroupsDlg::onSelectionDone() \param theModule module */ SMESHGUI_DimGroupDlg::SMESHGUI_DimGroupDlg( SMESHGUI* theModule ) -: SMESHGUI_GroupOpDlg( theModule ) + : SMESHGUI_GroupOpDlg( theModule ) { setWindowTitle( tr( "CREATE_GROUP_OF_UNDERLYING_ELEMS" ) ); setHelpFileName( "group_of_underlying_elements_page.html" ); QGroupBox* anArgGrp = getArgGrp(); - QLabel* aLbl = new QLabel( tr( "ELEMENTS_TYPE" ), anArgGrp ); - - myCombo = new QComboBox( anArgGrp ); - static QStringList anItems; - if ( anItems.isEmpty() ) + QLabel* aTypeLbl = new QLabel( tr( "ELEMENTS_TYPE" ), anArgGrp ); + + myTypeCombo = new QComboBox( anArgGrp ); + QStringList anItems; { - anItems.append( tr( "NODE" ) ); - anItems.append( tr( "EDGE" ) ); - anItems.append( tr( "FACE" ) ); - anItems.append( tr( "VOLUME" ) ); + anItems.append( tr( "MESH_NODE" ) ); + anItems.append( tr( "SMESH_EDGE" ) ); + anItems.append( tr( "SMESH_FACE" ) ); + anItems.append( tr( "SMESH_VOLUME" ) ); + anItems.append( tr( "SMESH_ELEM0D" ) ); + anItems.append( tr( "SMESH_BALL" ) ); } - myCombo->addItems( anItems ); - myCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - + myTypeCombo->addItems( anItems ); + myTypeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + QLabel* aNbNoLbl = new QLabel( tr( "NUMBER_OF_COMMON_NODES" ), anArgGrp ); + + myNbNoCombo = new QComboBox( anArgGrp ); + anItems.clear(); + { + anItems.append( tr( "ALL" ) ); + anItems.append( tr( "MAIN" ) ); + anItems.append( tr( "AT_LEAST_ONE" ) ); + anItems.append( tr( "MAJORITY" ) ); + } + myNbNoCombo->addItems( anItems ); + myNbNoCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myListWg = new QListWidget( anArgGrp ); + myUnderlOnlyChk = new QCheckBox( tr("UNDERLYING_ENTITIES_ONLY"), anArgGrp ); + myUnderlOnlyChk->setChecked( false ); + // layout QGridLayout* aLay = new QGridLayout( anArgGrp ); aLay->setSpacing( SPACING ); - aLay->addWidget( aLbl, 0, 0 ); - aLay->addWidget( myCombo, 0, 1 ); - aLay->addWidget( myListWg, 1, 0, 1, 2 ); + aLay->addWidget( aTypeLbl, 0, 0 ); + aLay->addWidget( myTypeCombo, 0, 1 ); + aLay->addWidget( aNbNoLbl, 1, 0 ); + aLay->addWidget( myNbNoCombo, 1, 1 ); + aLay->addWidget( myListWg, 2, 0, 1, 2 ); + aLay->addWidget( myUnderlOnlyChk, 3, 0 ); } /*! @@ -1008,7 +1057,7 @@ void SMESHGUI_DimGroupDlg::reset() */ SMESH::ElementType SMESHGUI_DimGroupDlg::getElementType() const { - return (SMESH::ElementType)( myCombo->currentIndex() + 1 ); + return (SMESH::ElementType)( myTypeCombo->currentIndex() + 1 ); } /*! @@ -1018,7 +1067,7 @@ SMESH::ElementType SMESHGUI_DimGroupDlg::getElementType() const */ void SMESHGUI_DimGroupDlg::setElementType( const SMESH::ElementType& theElemType ) { - myCombo->setCurrentIndex( theElemType - 1 ); + myTypeCombo->setCurrentIndex( theElemType - 1 ); } /*! @@ -1048,10 +1097,19 @@ bool SMESHGUI_DimGroupDlg::onApply() QStringList anEntryList; try { - SMESH::ListOfGroups_var aList = convert( myGroups ); + SMESH::ListOfIDSources_var aList = new SMESH::ListOfIDSources(); + aList->length( myGroups.count() ); + QList::const_iterator anIter = myGroups.begin(); + for ( int i = 0; anIter != myGroups.end(); ++anIter, ++i ) + aList[ i ] = SMESH::SMESH_IDSource::_narrow( *anIter ); + SMESH::ElementType anElemType = getElementType(); - SMESH::SMESH_Group_var aNewGrp = - aMesh->CreateDimGroup( aList, anElemType, aName.toLatin1().constData() ); + SMESH::NB_COMMON_NODES_ENUM aNbCoNodes = + (SMESH::NB_COMMON_NODES_ENUM) myNbNoCombo->currentIndex(); + + SMESH::SMESH_Group_var aNewGrp = + aMesh->CreateDimGroup( aList, anElemType, aName.toLatin1().constData(), + aNbCoNodes, myUnderlOnlyChk->isChecked() ); if ( !CORBA::is_nil( aNewGrp ) ) { aNewGrp->SetColor( getColor() ); @@ -1093,5 +1151,3 @@ void SMESHGUI_DimGroupDlg::onSelectionDone() myListWg->clear(); myListWg->addItems( aNames ); } - -