#include <SMESHGUI_GroupOpDlg.h>

Public Member Functions | |
| SMESHGUI_CutGroupsDlg (SMESHGUI *) | |
| Constructor. | |
| virtual | ~SMESHGUI_CutGroupsDlg () |
| Destructor. | |
| void | Init () |
| Init dialog fields, connect signals and slots, show dialog. | |
Protected Slots | |
| virtual bool | onApply () |
| SLOT called when apply button is pressed performs operation. | |
| virtual void | onSelectionDone () |
| SLOT, called when selection is changed, updates corresponding GUI controls. | |
| virtual void | setVisible (bool visible) |
| Calls onSelectionDone() and setVisible() method of base class. | |
Protected Member Functions | |
| virtual void | reset () |
| This virtual method redefined from the base class resets state of the dialog, initializes its fields with default value, etc. | |
| QString | getName () const |
| Gets name of group to be created. | |
| void | setName (const QString &theName) |
| Sets name of group to be created. | |
| QGroupBox * | getArgGrp () const |
| Gets pointer on arguments group box. | |
| void | setHelpFileName (const QString &theFName) |
| Sets help file name. | |
| SMESHGUI * | getSMESHGUI () const |
| Gets pointer to the module instance. | |
| bool | isValid (const QList< SMESH::SMESH_GroupBase_var > &theListGrp) |
| Validate list of groups used for operation. | |
| bool | getSelectedGroups (QList< SMESH::SMESH_GroupBase_var > &theOutList, QStringList &theOutNames) |
| Gets list of currently selected groups from selection manager. | |
| SMESH::ListOfGroups * | convert (const QList< SMESH::SMESH_GroupBase_var > &) |
| Converts QT-list of group to the list acceptable by IDL interface. | |
| SALOMEDS::Color | getColor () const |
| Get color to be assigned to group. | |
| void | setIsApplyAndClose (const bool theFlag) |
| Set value of the flag indicating that the dialog is accepted by Apply & Close button. | |
| bool | isApplyAndClose () const |
| Get value of the flag indicating that the dialog is accepted by Apply & Close button. | |
Private Attributes | |
| QPushButton * | myBtn1 |
| QPushButton * | myBtn2 |
| QListWidget * | myListWg1 |
| QListWidget * | myListWg2 |
| QList< SMESH::SMESH_GroupBase_var > | myGroups1 |
| QList< SMESH::SMESH_GroupBase_var > | myGroups2 |
Definition at line 186 of file SMESHGUI_GroupOpDlg.h.
| SMESHGUI_CutGroupsDlg::SMESHGUI_CutGroupsDlg | ( | SMESHGUI * | theModule | ) |
Constructor.
| theModule | module |
Definition at line 780 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.getArgGrp(), SMESH.GetResourceMgr(), SMESHGUI_GroupOpDlg.getSMESHGUI(), myBtn1, myBtn2, myListWg1, myListWg2, SMESHGUI_GroupOpDlg.setHelpFileName(), and SPACING.
: SMESHGUI_GroupOpDlg( theModule ) { setWindowTitle(tr("CUT_OF_GROUPS")); setHelpFileName( "using_operations_on_groups_page.html#cut_anchor" ); QGroupBox* anArgGrp = getArgGrp(); QPixmap aPix (SMESH::GetResourceMgr( getSMESHGUI() )->loadPixmap("SMESH", tr("ICON_SELECT"))); // frame 1 QFrame* aFrame1 = new QFrame( anArgGrp ); QLabel* aLbl1 = new QLabel( tr("MAIN_OBJECT"), aFrame1 ); aLbl1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myBtn1 = new QPushButton( aFrame1 ); myBtn1->setIcon(aPix); myListWg1 = new QListWidget( aFrame1 ); QGridLayout* aLay1 = new QGridLayout( aFrame1 ); aLay1->setSpacing( SPACING ); aLay1->addWidget( aLbl1, 0, 0 ); aLay1->addWidget( myBtn1, 0, 1 ); aLay1->addWidget( myListWg1, 1, 0, 1, 2 ); //QSpacerItem* aHSpacer1 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); //aLay1->addItem( aHSpacer1, 0, 2 ); // frame 2 QFrame* aFrame2 = new QFrame( anArgGrp ); QLabel* aLbl2 = new QLabel( tr("TOOL_OBJECT"), aFrame2 ); aLbl2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myBtn2 = new QPushButton( aFrame2 ); myBtn2->setIcon(aPix); myListWg2 = new QListWidget( aFrame2 ); QGridLayout* aLay2 = new QGridLayout( aFrame2 ); aLay2->setSpacing( SPACING ); aLay2->addWidget( aLbl2, 0, 0 ); aLay2->addWidget( myBtn2, 0, 1 ); aLay2->addWidget( myListWg2, 1, 0, 1, 2 ); //QSpacerItem* aHSpacer2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); //aLay2->addItem( aHSpacer2, 0, 2 ); // create button group QButtonGroup* aGrp = new QButtonGroup( anArgGrp ); aGrp->addButton( myBtn1, 0 ); aGrp->addButton( myBtn2, 1 ); myBtn1->setCheckable( true ); myBtn2->setCheckable( true ); aGrp->setExclusive( true ); myBtn1->setChecked( true ); // fill layout QHBoxLayout* aLay = new QHBoxLayout( anArgGrp ); aLay->setSpacing( SPACING ); aLay->addWidget( aFrame1 ); aLay->addWidget( aFrame2 ); }
| SMESHGUI_CutGroupsDlg::~SMESHGUI_CutGroupsDlg | ( | ) | [virtual] |
| SMESH::ListOfGroups * SMESHGUI_GroupOpDlg::convert | ( | const QList< SMESH::SMESH_GroupBase_var > & | theIn | ) | [protected, inherited] |
Converts QT-list of group to the list acceptable by IDL interface.
| theIn | input list |
Definition at line 396 of file SMESHGUI_GroupOpDlg.cxx.
Referenced by SMESHGUI_DimGroupDlg.onApply(), onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), and SMESHGUI_UnionGroupsDlg.onApply().
{
SMESH::ListOfGroups_var aList = new SMESH::ListOfGroups();
aList->length( theIn.count() );
QList<SMESH::SMESH_GroupBase_var>::const_iterator anIter = theIn.begin();
for ( int i = 0; anIter != theIn.end(); ++anIter, ++i )
aList[ i ] = *anIter;
return aList._retn();
}
| QGroupBox * SMESHGUI_GroupOpDlg::getArgGrp | ( | ) | const [protected, inherited] |
Gets pointer on arguments group box.
Definition at line 156 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.myArgGrp.
Referenced by SMESHGUI_CutGroupsDlg(), SMESHGUI_DimGroupDlg.SMESHGUI_DimGroupDlg(), SMESHGUI_IntersectGroupsDlg.SMESHGUI_IntersectGroupsDlg(), and SMESHGUI_UnionGroupsDlg.SMESHGUI_UnionGroupsDlg().
{
return myArgGrp;
}
| SALOMEDS::Color SMESHGUI_GroupOpDlg::getColor | ( | ) | const [protected, inherited] |
Get color to be assigned to group.
Definition at line 413 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.myColorBtn.
Referenced by SMESHGUI_DimGroupDlg.onApply(), onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), and SMESHGUI_UnionGroupsDlg.onApply().
{
QColor aQColor = myColorBtn->color();
SALOMEDS::Color aColor;
aColor.R = (float)aQColor.red() / 255.0;
aColor.G = (float)aQColor.green() / 255.0;
aColor.B = (float)aQColor.blue() / 255.0;
return aColor;
}
| QString SMESHGUI_GroupOpDlg::getName | ( | ) | const [protected, inherited] |
Gets name of group to be created.
Definition at line 494 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.myNameEdit.
Referenced by SMESHGUI_DimGroupDlg.onApply(), onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), and SMESHGUI_UnionGroupsDlg.onApply().
{
return myNameEdit->text();
}
| bool SMESHGUI_GroupOpDlg::getSelectedGroups | ( | QList< SMESH::SMESH_GroupBase_var > & | theOutList, |
| QStringList & | theOutNames | ||
| ) | [protected, inherited] |
Gets list of currently selected groups from selection manager.
| theOutList | out list of groups |
| theOutNames | out list of group of group names |
Definition at line 366 of file SMESHGUI_GroupOpDlg.cxx.
References SMESH_controls.aGroup, and SMESHGUI_GroupOpDlg.mySelectionMgr.
Referenced by SMESHGUI_DimGroupDlg.onSelectionDone(), onSelectionDone(), SMESHGUI_IntersectGroupsDlg.onSelectionDone(), and SMESHGUI_UnionGroupsDlg.onSelectionDone().
{
theOutList.clear();
theOutList.clear();
theOutNames.clear();
SALOME_ListIO aListIO;
mySelectionMgr->selectedObjects( aListIO );
SALOME_ListIteratorOfListIO anIter ( aListIO );
for ( ; anIter.More(); anIter.Next())
{
SMESH::SMESH_GroupBase_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIter.Value());
if ( !aGroup->_is_nil())
{
theOutList.append( aGroup );
theOutNames.append( aGroup->GetName() );
}
}
return theOutList.count() > 0;
}
| SMESHGUI * SMESHGUI_GroupOpDlg::getSMESHGUI | ( | ) | const [protected, inherited] |
Gets pointer to the module instance.
Definition at line 174 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.mySMESHGUI.
Referenced by SMESHGUI_DimGroupDlg.onApply(), onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), SMESHGUI_UnionGroupsDlg.onApply(), and SMESHGUI_CutGroupsDlg().
{
return mySMESHGUI;
}
| void SMESHGUI_GroupOpDlg::Init | ( | ) | [inherited] |
Init dialog fields, connect signals and slots, show dialog.
Definition at line 224 of file SMESHGUI_GroupOpDlg.cxx.
References SMESH.GetViewWindow(), GROUP, SMESHGUI_GroupOpDlg.mySelectionMgr, SMESHGUI_GroupOpDlg.mySMESHGUI, SMESHGUI_GroupOpDlg.onDeactivate(), SMESHGUI_GroupOpDlg.onSelectionDone(), and SMESHGUI.SetActiveDialogBox().
Referenced by SMESHGUI_GroupOpDlg.SMESHGUI_GroupOpDlg().
{
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
// selection and SMESHGUI
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnClose()));
// set selection mode
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
}
| bool SMESHGUI_GroupOpDlg::isApplyAndClose | ( | ) | const [protected, inherited] |
Get value of the flag indicating that the dialog is accepted by Apply & Close button.
Definition at line 551 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.myIsApplyAndClose.
Referenced by SMESHGUI_DimGroupDlg.onApply(), onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), and SMESHGUI_UnionGroupsDlg.onApply().
{
return myIsApplyAndClose;
}
| bool SMESHGUI_GroupOpDlg::isValid | ( | const QList< SMESH::SMESH_GroupBase_var > & | theListGrp | ) | [protected, inherited] |
Validate list of groups used for operation.
Checks whether they corresponds to the same face and have one type
| theListGrp | input list of groups |
Definition at line 245 of file SMESHGUI_GroupOpDlg.cxx.
Referenced by SMESHGUI_DimGroupDlg.onApply(), onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), and SMESHGUI_UnionGroupsDlg.onApply().
{
if ( theListGrp.isEmpty() )
{
SUIT_MessageBox::information( this, tr("SMESH_INSUFFICIENT_DATA"),
tr("INCORRECT_ARGUMENTS") );
return false;
}
int aMeshId = -1, aGrpType = -1;
QList<SMESH::SMESH_GroupBase_var>::const_iterator anIter;
for ( anIter = theListGrp.begin(); anIter != theListGrp.end(); ++anIter )
{
SMESH::SMESH_GroupBase_var aGrp = *anIter;
if ( CORBA::is_nil( aGrp ) )
continue; // nonsence
SMESH::SMESH_Mesh_var aMesh = aGrp->GetMesh();
if ( CORBA::is_nil( aMesh ) )
continue;
// mesh id
int aCurrId = aMesh->GetId();
if ( aMeshId == -1 )
aMeshId = aCurrId;
else
{
if ( aMeshId != aCurrId )
{
aMeshId = -1; // different meshes
break;
}
}
// group type
int aCurrType = aGrp->GetType();
if ( aGrpType == -1 )
aGrpType = aCurrType;
else
{
if ( aGrpType != aCurrType )
{
aGrpType = -1; // different types
break;
}
}
}
if ( aMeshId == -1 )
{
SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"),
tr("DIFF_MESHES"));
return false;
}
if ( aGrpType == -1 )
{
SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"),
tr("DIFF_TYPES"));
return false;
}
return true;
}
| bool SMESHGUI_CutGroupsDlg::onApply | ( | ) | [protected, virtual, slot] |
SLOT called when apply button is pressed performs operation.
Reimplemented from SMESHGUI_GroupOpDlg.
Definition at line 866 of file SMESHGUI_GroupOpDlg.cxx.
References _PTR(), SMESHGUI_GroupOpDlg.convert(), SMESHGUI_GroupOpDlg.getColor(), SMESHGUI_GroupOpDlg.getName(), SMESHGUI_GroupOpDlg.getSMESHGUI(), SMESHGUI_GroupOpDlg.isApplyAndClose(), SMESHGUI_GroupOpDlg.isValid(), SMESHGUI.Modified(), myGroups1, myGroups2, and reset().
{
if ( getSMESHGUI()->isActiveStudyLocked())
return false;
// Verify validity of group name
if ( getName() == "" )
{
SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"),
SMESHGUI_GroupOpDlg::tr("EMPTY_NAME"));
return false;
}
if ( myGroups1.isEmpty() || myGroups2.isEmpty() )
{
SUIT_MessageBox::information( this, tr("SMESH_INSUFFICIENT_DATA"),
SMESHGUI_GroupOpDlg::tr("INCORRECT_ARGUMENTS") );
return false;
}
QList<SMESH::SMESH_GroupBase_var> aGroups = myGroups1;
QList<SMESH::SMESH_GroupBase_var>::iterator anIter;
for ( anIter = myGroups2.begin(); anIter != myGroups2.end(); ++anIter )
aGroups.append( *anIter );
if ( !isValid( aGroups ) )
return false;
SMESH::SMESH_Mesh_var aMesh = myGroups1.first()->GetMesh();
QString aName = getName();
bool aRes = false;
QStringList anEntryList;
try
{
SMESH::ListOfGroups_var aList1 = convert( myGroups1 );
SMESH::ListOfGroups_var aList2 = convert( myGroups2 );
SMESH::SMESH_Group_var aNewGrp =
aMesh->CutListOfGroups( aList1, aList2, aName.toLatin1().constData() );
if ( !CORBA::is_nil( aNewGrp ) )
{
aNewGrp->SetColor( getColor() );
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aNewGrp ) )
anEntryList.append( aSObject->GetID().c_str() );
aRes = true;
}
}
catch( ... )
{
aRes = false;
}
if ( aRes )
{
SMESHGUI::Modified();
getSMESHGUI()->updateObjBrowser(true);
reset();
if( LightApp_Application* anApp =
dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
anApp->browseObjects( anEntryList, isApplyAndClose() );
return true;
}
else
{
SUIT_MessageBox::critical(this, tr("SMESH_ERROR"),
tr("SMESH_OPERATION_FAILED"));
return false;
}
}
| void SMESHGUI_CutGroupsDlg::onSelectionDone | ( | ) | [protected, virtual, slot] |
SLOT, called when selection is changed, updates corresponding GUI controls.
Reimplemented from SMESHGUI_GroupOpDlg.
Definition at line 939 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.getSelectedGroups(), myBtn2, myGroups1, myGroups2, myListWg1, and myListWg2.
{
QStringList aNames;
if ( myBtn2->isChecked() )
{
getSelectedGroups( myGroups2, aNames );
myListWg2->clear();
myListWg2->addItems( aNames );
}
else
{
getSelectedGroups( myGroups1, aNames );
myListWg1->clear();
myListWg1->addItems( aNames );
}
}
| void SMESHGUI_CutGroupsDlg::reset | ( | ) | [protected, virtual] |
This virtual method redefined from the base class resets state of the dialog, initializes its fields with default value, etc.
Reimplemented from SMESHGUI_GroupOpDlg.
Definition at line 851 of file SMESHGUI_GroupOpDlg.cxx.
References myGroups1, myGroups2, myListWg1, and myListWg2.
Referenced by onApply().
{
SMESHGUI_GroupOpDlg::reset();
myListWg1->clear();
myGroups1.clear();
myListWg2->clear();
myGroups2.clear();
}
| void SMESHGUI_GroupOpDlg::setHelpFileName | ( | const QString & | theFName | ) | [protected, inherited] |
Sets help file name.
| theFName | help file name |
Definition at line 165 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.myHelpFileName.
Referenced by SMESHGUI_CutGroupsDlg(), SMESHGUI_DimGroupDlg.SMESHGUI_DimGroupDlg(), SMESHGUI_IntersectGroupsDlg.SMESHGUI_IntersectGroupsDlg(), and SMESHGUI_UnionGroupsDlg.SMESHGUI_UnionGroupsDlg().
{
myHelpFileName = theFName;
}
| void SMESHGUI_GroupOpDlg::setIsApplyAndClose | ( | const bool | theFlag | ) | [protected, inherited] |
Set value of the flag indicating that the dialog is accepted by Apply & Close button.
| theFlag | value of the flag |
Definition at line 540 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.myIsApplyAndClose.
Referenced by SMESHGUI_GroupOpDlg.onOk().
{
myIsApplyAndClose = theFlag;
}
| void SMESHGUI_GroupOpDlg::setName | ( | const QString & | theName | ) | [protected, inherited] |
Sets name of group to be created.
| theName | name of group to be created |
Definition at line 504 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.myNameEdit.
{
myNameEdit->setText( theName );
}
| void SMESHGUI_GroupOpDlg::setVisible | ( | bool | visible | ) | [protected, virtual, slot, inherited] |
Calls onSelectionDone() and setVisible() method of base class.
| visible | the visible state of the dialog |
Definition at line 438 of file SMESHGUI_GroupOpDlg.cxx.
References ex21_lamp.height, and SMESHGUI_GroupOpDlg.onSelectionDone().
{
if ( visible )
{
onSelectionDone();
resize( minimumSizeHint().width(), sizeHint().height() );
}
QDialog::setVisible( visible );
}
QPushButton* SMESHGUI_CutGroupsDlg.myBtn1 [private] |
Definition at line 203 of file SMESHGUI_GroupOpDlg.h.
Referenced by SMESHGUI_CutGroupsDlg().
QPushButton* SMESHGUI_CutGroupsDlg.myBtn2 [private] |
Definition at line 204 of file SMESHGUI_GroupOpDlg.h.
Referenced by onSelectionDone(), and SMESHGUI_CutGroupsDlg().
QList<SMESH::SMESH_GroupBase_var> SMESHGUI_CutGroupsDlg.myGroups1 [private] |
Definition at line 207 of file SMESHGUI_GroupOpDlg.h.
Referenced by onApply(), onSelectionDone(), and reset().
QList<SMESH::SMESH_GroupBase_var> SMESHGUI_CutGroupsDlg.myGroups2 [private] |
Definition at line 208 of file SMESHGUI_GroupOpDlg.h.
Referenced by onApply(), onSelectionDone(), and reset().
QListWidget* SMESHGUI_CutGroupsDlg.myListWg1 [private] |
Definition at line 205 of file SMESHGUI_GroupOpDlg.h.
Referenced by onSelectionDone(), reset(), and SMESHGUI_CutGroupsDlg().
QListWidget* SMESHGUI_CutGroupsDlg.myListWg2 [private] |
Definition at line 206 of file SMESHGUI_GroupOpDlg.h.
Referenced by onSelectionDone(), reset(), and SMESHGUI_CutGroupsDlg().