#include <SMESHGUI_GroupOpDlg.h>

Public Member Functions | |
| SMESHGUI_DimGroupDlg (SMESHGUI *) | |
| Constructor. | |
| virtual | ~SMESHGUI_DimGroupDlg () |
| Destructor. | |
| SMESH::ElementType | getElementType () const |
| Gets elements type. | |
| void | setElementType (const SMESH::ElementType &theElemType) |
| Sets elements type. | |
| 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 | |
| QComboBox * | myCombo |
| QListWidget * | myListWg |
| QList< SMESH::SMESH_GroupBase_var > | myGroups |
Definition at line 217 of file SMESHGUI_GroupOpDlg.h.
| SMESHGUI_DimGroupDlg::SMESHGUI_DimGroupDlg | ( | SMESHGUI * | theModule | ) |
Constructor.
| theModule | module |
Definition at line 962 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.getArgGrp(), myCombo, myListWg, SMESHGUI_GroupOpDlg.setHelpFileName(), and SPACING.
: SMESHGUI_GroupOpDlg( theModule ) { setWindowTitle( tr( "CREATE_GROUP_OF_UNDERLYING_ELEMS" ) ); setHelpFileName( "creating_groups_page.html#gui_create_dim_group" ); QGroupBox* anArgGrp = getArgGrp(); QLabel* aLbl = new QLabel( tr( "ELEMENTS_TYPE" ), anArgGrp ); myCombo = new QComboBox( anArgGrp ); static QStringList anItems; if ( anItems.isEmpty() ) { anItems.append( tr( "NODE" ) ); anItems.append( tr( "EDGE" ) ); anItems.append( tr( "FACE" ) ); anItems.append( tr( "VOLUME" ) ); } myCombo->addItems( anItems ); myCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myListWg = new QListWidget( anArgGrp ); // 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 ); }
| SMESHGUI_DimGroupDlg::~SMESHGUI_DimGroupDlg | ( | ) | [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 onApply(), SMESHGUI_CutGroupsDlg.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_CutGroupsDlg(), 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 onApply(), SMESHGUI_CutGroupsDlg.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;
}
| SMESH::ElementType SMESHGUI_DimGroupDlg::getElementType | ( | ) | const |
Gets elements type.
Definition at line 1017 of file SMESHGUI_GroupOpDlg.cxx.
References myCombo.
Referenced by onApply().
{
return (SMESH::ElementType)( myCombo->currentIndex() + 1 );
}
| 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 onApply(), SMESHGUI_CutGroupsDlg.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 onSelectionDone(), SMESHGUI_CutGroupsDlg.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 onApply(), SMESHGUI_CutGroupsDlg.onApply(), SMESHGUI_IntersectGroupsDlg.onApply(), SMESHGUI_UnionGroupsDlg.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 onApply(), SMESHGUI_CutGroupsDlg.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 onApply(), SMESHGUI_CutGroupsDlg.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_DimGroupDlg::onApply | ( | ) | [protected, virtual, slot] |
SLOT called when apply button is pressed performs operation.
Reimplemented from SMESHGUI_GroupOpDlg.
Definition at line 1036 of file SMESHGUI_GroupOpDlg.cxx.
References _PTR(), SMESH_BelongToGeom.anElemType, SMESHGUI_GroupOpDlg.convert(), SMESHGUI_GroupOpDlg.getColor(), getElementType(), 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::ElementType anElemType = getElementType();
SMESH::SMESH_Group_var aNewGrp =
aMesh->CreateDimGroup( aList, anElemType, 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_DimGroupDlg::onSelectionDone | ( | ) | [protected, virtual, slot] |
SLOT, called when selection is changed, updates corresponding GUI controls.
Reimplemented from SMESHGUI_GroupOpDlg.
Definition at line 1097 of file SMESHGUI_GroupOpDlg.cxx.
References SMESHGUI_GroupOpDlg.getSelectedGroups(), myGroups, and myListWg.
{
QStringList aNames;
getSelectedGroups( myGroups, aNames );
myListWg->clear();
myListWg->addItems( aNames );
}
| void SMESHGUI_DimGroupDlg::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 1005 of file SMESHGUI_GroupOpDlg.cxx.
References myGroups, and myListWg.
Referenced by onApply().
{
SMESHGUI_GroupOpDlg::reset();
myListWg->clear();
myGroups.clear();
}
| void SMESHGUI_DimGroupDlg::setElementType | ( | const SMESH::ElementType & | theElemType | ) |
Sets elements type.
| theElemType | elements type |
Definition at line 1027 of file SMESHGUI_GroupOpDlg.cxx.
References myCombo.
{
myCombo->setCurrentIndex( theElemType - 1 );
}
| 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_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 );
}
QComboBox* SMESHGUI_DimGroupDlg.myCombo [private] |
Definition at line 237 of file SMESHGUI_GroupOpDlg.h.
Referenced by getElementType(), setElementType(), and SMESHGUI_DimGroupDlg().
QList<SMESH::SMESH_GroupBase_var> SMESHGUI_DimGroupDlg.myGroups [private] |
Definition at line 239 of file SMESHGUI_GroupOpDlg.h.
Referenced by onApply(), onSelectionDone(), and reset().
QListWidget* SMESHGUI_DimGroupDlg.myListWg [private] |
Definition at line 238 of file SMESHGUI_GroupOpDlg.h.
Referenced by onSelectionDone(), reset(), and SMESHGUI_DimGroupDlg().