#include <SMESHGUI_GroupOpDlg.h>

Public Member Functions | |
| SMESHGUI_UnionGroupsDlg (SMESHGUI *) | |
| Constructor. | |
| virtual | ~SMESHGUI_UnionGroupsDlg () |
| 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 | |
| QListWidget * | myListWg |
| QList< SMESH::SMESH_GroupBase_var > | myGroups |
Definition at line 134 of file SMESHGUI_GroupOpDlg.h.
| SMESHGUI_UnionGroupsDlg::SMESHGUI_UnionGroupsDlg | ( | SMESHGUI * | theModule | ) |
Constructor.
| theModule | module |
Definition at line 562 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.getArgGrp(), myListWg, and SMESHGUI_GroupOpDlg.setHelpFileName().
: SMESHGUI_GroupOpDlg( theModule ) { setWindowTitle(tr("UNION_OF_GROUPS")); setHelpFileName( "using_operations_on_groups_page.html#union_anchor" ); QGroupBox* anArgGrp = getArgGrp(); myListWg = new QListWidget( anArgGrp ); QHBoxLayout* aLay = new QHBoxLayout( anArgGrp ); aLay->addWidget( myListWg ); }
| SMESHGUI_UnionGroupsDlg::~SMESHGUI_UnionGroupsDlg | ( | ) | [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(), SMESHGUI_CutGroupsDlg.onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), and 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_CutGroupsDlg(), SMESHGUI_DimGroupDlg.SMESHGUI_DimGroupDlg(), SMESHGUI_IntersectGroupsDlg.SMESHGUI_IntersectGroupsDlg(), and 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(), SMESHGUI_CutGroupsDlg.onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), and 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(), SMESHGUI_CutGroupsDlg.onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), and 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(), SMESHGUI_CutGroupsDlg.onSelectionDone(), SMESHGUI_IntersectGroupsDlg.onSelectionDone(), and 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(), SMESHGUI_CutGroupsDlg.onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), onApply(), and SMESHGUI_CutGroupsDlg.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(), SMESHGUI_CutGroupsDlg.onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), and 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(), SMESHGUI_CutGroupsDlg.onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), and 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_UnionGroupsDlg::onApply | ( | ) | [protected, virtual, slot] |
SLOT called when apply button is pressed performs operation.
Reimplemented from SMESHGUI_GroupOpDlg.
Definition at line 597 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(), myGroups, 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 ( !isValid( myGroups ) )
return false;
SMESH::SMESH_Mesh_var aMesh = myGroups.first()->GetMesh();
QString aName = getName();
bool aRes = false;
QStringList anEntryList;
try
{
SMESH::ListOfGroups_var aList = convert( myGroups );
SMESH::SMESH_Group_var aNewGrp =
aMesh->UnionListOfGroups( aList, 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_UnionGroupsDlg::onSelectionDone | ( | ) | [protected, virtual, slot] |
SLOT, called when selection is changed, updates corresponding GUI controls.
Reimplemented from SMESHGUI_GroupOpDlg.
Definition at line 657 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.getSelectedGroups(), myGroups, and myListWg.
{
QStringList aNames;
getSelectedGroups( myGroups, aNames );
myListWg->clear();
myListWg->addItems( aNames );
}
| void SMESHGUI_UnionGroupsDlg::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 586 of file SMESHGUI_GroupOpDlg.cxx.
References myGroups, and myListWg.
Referenced by onApply().
{
SMESHGUI_GroupOpDlg::reset();
myListWg->clear();
myGroups.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_CutGroupsDlg(), SMESHGUI_DimGroupDlg.SMESHGUI_DimGroupDlg(), SMESHGUI_IntersectGroupsDlg.SMESHGUI_IntersectGroupsDlg(), and 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 );
}
QList<SMESH::SMESH_GroupBase_var> SMESHGUI_UnionGroupsDlg.myGroups [private] |
Definition at line 152 of file SMESHGUI_GroupOpDlg.h.
Referenced by onApply(), onSelectionDone(), and reset().
QListWidget* SMESHGUI_UnionGroupsDlg.myListWg [private] |
Definition at line 151 of file SMESHGUI_GroupOpDlg.h.
Referenced by onSelectionDone(), reset(), and SMESHGUI_UnionGroupsDlg().