#include <SMESHGUI_AddMeshElementDlg.h>

Definition at line 63 of file SMESHGUI_AddMeshElementDlg.h.
typedef QList<SMESH::SMESH_GroupBase_var> SMESHGUI_AddMeshElementDlg.GrpList [private] |
Definition at line 81 of file SMESHGUI_AddMeshElementDlg.h.
| SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg | ( | SMESHGUI * | theModule, |
| SMDSAbs_ElementType | ElementType = SMDSAbs_Edge, |
||
| int | nbNodes = 2 |
||
| ) |
Definition at line 241 of file SMESHGUI_AddMeshElementDlg.cxx.
References buttonApply, buttonCancel, buttonHelp, buttonOk, ComboBox_GroupName, Constructor1, SMESH.GetResourceMgr(), SMESH.GetSelector(), SMESH.GetViewWindow(), GroupButtons, GroupC1, GroupConstructors, GroupGroups, Init(), LineEditC1A1, MARGIN, myElementType, myHelpFileName, myIsPoly, myNbNodes, mySelector, mySimulation, mySMESHGUI, Reverse, SelectButtonC1A1, SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume, SPACING, TextLabel_GroupName, and TextLabelC1A1.
: QDialog( SMESH::GetDesktop( theModule ) ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { setModal( false ); setAttribute( Qt::WA_DeleteOnClose, true ); SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*> (SUIT_Session::session()->activeApplication()); myIsPoly = false; mySimulation = new SMESH::TElementSimulation (anApp); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); // verify nb nodes and type myNbNodes = nbNodes; myElementType = ElementType; switch (ElementType) { case SMDSAbs_0DElement: if (myNbNodes != 1) myNbNodes = 1; break; case SMDSAbs_Face: // if (myNbNodes != 3 && myNbNodes != 4) // myNbNodes = 3; // break; case SMDSAbs_Volume: // if (myNbNodes != 4 && myNbNodes != 8) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7) // myNbNodes = 4; break; default: myElementType = SMDSAbs_Edge; myNbNodes = 2; } QString elemName; if (myNbNodes == 1) { elemName = "ELEM0D"; myHelpFileName = "adding_nodes_and_elements_page.html#adding_0delems_anchor"; } else if (myNbNodes == 2) { elemName = "EDGE"; myHelpFileName = "adding_nodes_and_elements_page.html#adding_edges_anchor"; } else if (myNbNodes == 3) { elemName = "TRIANGLE"; myHelpFileName = "adding_nodes_and_elements_page.html#adding_triangles_anchor"; } else if (myNbNodes == 4) { if (myElementType == SMDSAbs_Face) { elemName = "QUADRANGLE"; myHelpFileName = "adding_nodes_and_elements_page.html#adding_quadrangles_anchor"; } else { elemName = "TETRAS"; myHelpFileName = "adding_nodes_and_elements_page.html#adding_tetrahedrons_anchor"; } } else if (myNbNodes == 8) { elemName = "HEXAS"; myHelpFileName = "adding_nodes_and_elements_page.html#adding_hexahedrons_anchor"; } else if (myElementType == SMDSAbs_Face) { elemName = "POLYGON"; myIsPoly = true; myHelpFileName = "adding_nodes_and_elements_page.html#adding_polygons_anchor"; } else if (myElementType == SMDSAbs_Volume) { myHelpFileName = "adding_nodes_and_elements_page.html#adding_polyhedrons_anchor"; } QString iconName = tr(QString("ICON_DLG_%1").arg(elemName).toLatin1().data()); QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName).toLatin1().data()); QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName).toLatin1().data()); QString grBoxTitle = tr(QString("SMESH_ADD_%1").arg(elemName).toLatin1().data()); QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", iconName)); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); setWindowTitle(caption); setSizeGripEnabled(true); QVBoxLayout* aTopLayout = new QVBoxLayout(this); aTopLayout->setSpacing(SPACING); aTopLayout->setMargin(MARGIN); /***************************************************************/ GroupConstructors = new QGroupBox(buttonGrTitle, this); QButtonGroup* ButtonGroup = new QButtonGroup(this); QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors); GroupConstructorsLayout->setSpacing(SPACING); GroupConstructorsLayout->setMargin(MARGIN); Constructor1 = new QRadioButton(GroupConstructors); Constructor1->setIcon(image0); Constructor1->setChecked(true); GroupConstructorsLayout->addWidget(Constructor1); ButtonGroup->addButton( Constructor1, 0 ); /***************************************************************/ GroupC1 = new QGroupBox(grBoxTitle, this); QGridLayout* GroupC1Layout = new QGridLayout(GroupC1); GroupC1Layout->setSpacing(SPACING); GroupC1Layout->setMargin(MARGIN); TextLabelC1A1 = new QLabel(tr("SMESH_ID_NODES"), GroupC1); SelectButtonC1A1 = new QPushButton(GroupC1); SelectButtonC1A1->setIcon(image1); LineEditC1A1 = new QLineEdit(GroupC1); // LineEditC1A1->setReadOnly(true); if (!myIsPoly) LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, myNbNodes)); Reverse = myElementType == SMDSAbs_Face ? new QCheckBox(tr("SMESH_REVERSE"), GroupC1) : 0; GroupC1Layout->addWidget(TextLabelC1A1, 0, 0); GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1); GroupC1Layout->addWidget(LineEditC1A1, 0, 2); if ( Reverse ) GroupC1Layout->addWidget(Reverse, 1, 0, 1, 3); /***************************************************************/ GroupGroups = new QGroupBox( tr( "SMESH_ADD_TO_GROUP" ), this ); GroupGroups->setCheckable( true ); QHBoxLayout* GroupGroupsLayout = new QHBoxLayout(GroupGroups); GroupGroupsLayout->setSpacing(SPACING); GroupGroupsLayout->setMargin(MARGIN); TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups ); ComboBox_GroupName = new QComboBox( GroupGroups ); ComboBox_GroupName->setEditable( true ); GroupGroupsLayout->addWidget( TextLabel_GroupName ); GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 ); /***************************************************************/ GroupButtons = new QGroupBox(this); QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); buttonApply->setAutoDefault(true); buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); buttonCancel->setAutoDefault(true); buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); buttonHelp->setAutoDefault(true); GroupButtonsLayout->addWidget(buttonOk); GroupButtonsLayout->addSpacing(10); GroupButtonsLayout->addWidget(buttonApply); GroupButtonsLayout->addSpacing(10); GroupButtonsLayout->addStretch(); GroupButtonsLayout->addWidget(buttonCancel); GroupButtonsLayout->addWidget(buttonHelp); /***************************************************************/ aTopLayout->addWidget(GroupConstructors); aTopLayout->addWidget(GroupC1); aTopLayout->addWidget(GroupGroups); aTopLayout->addWidget(GroupButtons); Init(); /* Initialisations */ }
| SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg | ( | ) |
Definition at line 415 of file SMESHGUI_AddMeshElementDlg.cxx.
References mySimulation.
{
delete mySimulation;
}
| void SMESHGUI_AddMeshElementDlg::ActivateThisDialog | ( | ) | [private, slot] |
Definition at line 843 of file SMESHGUI_AddMeshElementDlg.cxx.
References SMESHGUI.EmitSignalDeactivateDialog(), SMESH.GetViewWindow(), GroupButtons, GroupC1, GroupConstructors, mySMESHGUI, SelectionIntoArgument(), and SMESH.SetPointRepresentation().
Referenced by enterEvent().
{
/* Emit a signal to deactivate the active dialog */
mySMESHGUI->EmitSignalDeactivateDialog();
GroupConstructors->setEnabled(true);
GroupC1->setEnabled(true);
GroupButtons->setEnabled(true);
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode( NodeSelection );
SelectionIntoArgument();
}
| void SMESHGUI_AddMeshElementDlg::CheckBox | ( | int | state | ) | [private, slot] |
Definition at line 894 of file SMESHGUI_AddMeshElementDlg.cxx.
References displaySimulation(), myNbOkNodes, mySimulation, and SMESH.TElementSimulation.SetVisibility().
Referenced by Init().
{
if (!myNbOkNodes)
return;
if (state >= 0) {
mySimulation->SetVisibility(false);
displaySimulation();
}
}
| void SMESHGUI_AddMeshElementDlg::ClickOnApply | ( | ) | [private, slot] |
Definition at line 470 of file SMESHGUI_AddMeshElementDlg.cxx.
References SMESH.AddGroup(), SMESH_controls.aGroup, buttonApply, buttonOk, ComboBox_GroupName, SMESHGUI.GetSMESHGUI(), GroupGroups, SMESHGUI.isActiveStudyLocked(), isValid(), SMESHGUI.Modified(), myActor, myBusy, myEditCurrentArgument, myElementType, myGroups, myIsPoly, myMesh, myNbNodes, myNbOkNodes, mySelectionMgr, mySelector, mySimulation, mySMESHGUI, SMESH_AdvancedEditor.res, Reverse, reverse(), SMESH.TElementSimulation.SetVisibility(), SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume, and SMESH.UpdateView().
Referenced by ClickOnOk(), and Init().
{
if( !isValid() )
return;
if (myNbOkNodes && !mySMESHGUI->isActiveStudyLocked()) {
myBusy = true;
SMESH::long_array_var anArrayOfIndices = new SMESH::long_array;
anArrayOfIndices->length(myNbNodes);
bool reverse = (Reverse && Reverse->isChecked());
QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++)
if (reverse)
anArrayOfIndices[i] = aListId[ myNbNodes - i - 1 ].toInt();
else
anArrayOfIndices[i] = aListId[ i ].toInt();
bool addToGroup = GroupGroups->isChecked();
QString aGroupName;
SMESH::SMESH_GroupBase_var aGroup;
int idx = 0;
if( addToGroup ) {
aGroupName = ComboBox_GroupName->currentText();
for ( int i = 1; i < ComboBox_GroupName->count(); i++ ) {
QString aName = ComboBox_GroupName->itemText( i );
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
idx = i;
}
if ( idx > 0 ) {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
if ( !aGeomGroup->_is_nil() ) {
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),
tr( "MESH_STANDALONE_GRP_CHOSEN" ).arg( aGroupName ),
tr( "SMESH_BUT_YES" ), tr( "SMESH_BUT_NO" ), 0, 1 );
if ( res == 1 ) return;
}
aGroup = myGroups[idx-1];
}
}
long anElemId = -1;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
switch (myElementType) {
case SMDSAbs_0DElement:
anElemId = aMeshEditor->Add0DElement(anArrayOfIndices[0]); break;
case SMDSAbs_Edge:
anElemId = aMeshEditor->AddEdge(anArrayOfIndices.inout()); break;
case SMDSAbs_Face: {
if(myIsPoly)
anElemId = aMeshEditor->AddPolygonalFace(anArrayOfIndices.inout());
else
anElemId = aMeshEditor->AddFace(anArrayOfIndices.inout());
break;
}
case SMDSAbs_Volume:
anElemId = aMeshEditor->AddVolume(anArrayOfIndices.inout()); break;
default: break;
}
if ( anElemId != -1 && addToGroup && !aGroupName.isEmpty() ) {
SMESH::SMESH_Group_var aGroupUsed;
if ( aGroup->_is_nil() ) {
// create new group
aGroupUsed = SMESH::AddGroup( myMesh, (SMESH::ElementType)myElementType, aGroupName );
if ( !aGroupUsed->_is_nil() ) {
myGroups.append(SMESH::SMESH_GroupBase::_duplicate(aGroupUsed));
ComboBox_GroupName->addItem( aGroupName );
}
}
else {
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGroup );
if ( !aGeomGroup->_is_nil() ) {
aGroupUsed = myMesh->ConvertToStandalone( aGeomGroup );
if ( !aGroupUsed->_is_nil() && idx > 0 ) {
myGroups[idx-1] = SMESH::SMESH_GroupBase::_duplicate(aGroupUsed);
SMESHGUI::GetSMESHGUI()->getApp()->updateObjectBrowser();
}
}
else
aGroupUsed = SMESH::SMESH_Group::_narrow( aGroup );
}
if ( !aGroupUsed->_is_nil() ) {
SMESH::long_array_var anIdList = new SMESH::long_array;
anIdList->length( 1 );
anIdList[0] = anElemId;
aGroupUsed->Add( anIdList.inout() );
}
}
SALOME_ListIO aList; aList.Append( myActor->getIO() );
mySelector->ClearIndex();
mySelectionMgr->setSelectedObjects( aList, false );
SMESH::UpdateView();
mySimulation->SetVisibility(false);
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
myEditCurrentArgument->setText("");
myBusy = false;
SMESHGUI::Modified();
}
}
| void SMESHGUI_AddMeshElementDlg::ClickOnCancel | ( | ) | [private, slot] |
Definition at line 593 of file SMESHGUI_AddMeshElementDlg.cxx.
References SMESH.GetViewWindow(), mySelectionMgr, mySimulation, mySMESHGUI, SMESHGUI.ResetState(), SMESH.SetPointRepresentation(), and SMESH.TElementSimulation.SetVisibility().
Referenced by ClickOnOk(), closeEvent(), hideEvent(), and Init().
{
//mySelectionMgr->clearSelected();
mySimulation->SetVisibility(false);
SMESH::SetPointRepresentation(false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode( ActorSelection );
disconnect(mySelectionMgr, 0, this, 0);
mySMESHGUI->ResetState();
reject();
}
| void SMESHGUI_AddMeshElementDlg::ClickOnHelp | ( | ) | [private, slot] |
Definition at line 609 of file SMESHGUI_AddMeshElementDlg.cxx.
References myHelpFileName, and mySMESHGUI.
Referenced by Init(), and keyPressEvent().
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""),
myHelpFileName);
else {
QString platform;
#ifdef WIN32
platform = "winapplication";
#else
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser",
platform)).
arg(myHelpFileName));
}
}
| void SMESHGUI_AddMeshElementDlg::ClickOnOk | ( | ) | [private, slot] |
Definition at line 583 of file SMESHGUI_AddMeshElementDlg.cxx.
References ClickOnApply(), and ClickOnCancel().
Referenced by Init().
{
ClickOnApply();
ClickOnCancel();
}
| void SMESHGUI_AddMeshElementDlg::closeEvent | ( | QCloseEvent * | ) | [private] |
Definition at line 874 of file SMESHGUI_AddMeshElementDlg.cxx.
References ClickOnCancel().
{
/* same than click on cancel button */
ClickOnCancel();
}
| void SMESHGUI_AddMeshElementDlg::DeactivateActiveDialog | ( | ) | [private, slot] |
Definition at line 827 of file SMESHGUI_AddMeshElementDlg.cxx.
References GroupButtons, GroupC1, GroupConstructors, mySimulation, mySMESHGUI, SMESHGUI.ResetState(), SMESHGUI.SetActiveDialogBox(), and SMESH.TElementSimulation.SetVisibility().
Referenced by Init().
{
if (GroupConstructors->isEnabled()) {
GroupConstructors->setEnabled(false);
GroupC1->setEnabled(false);
GroupButtons->setEnabled(false);
mySimulation->SetVisibility(false);
mySMESHGUI->ResetState();
mySMESHGUI->SetActiveDialogBox(0);
}
}
| void SMESHGUI_AddMeshElementDlg::displaySimulation | ( | ) | [private] |
Definition at line 777 of file SMESHGUI_AddMeshElementDlg.cxx.
References SMESH_BelongToGeom.anIds, SMESH_Actor.GetObject(), GroupButtons, myActor, myEditCurrentArgument, myElementType, myIsPoly, myNbNodes, myNbOkNodes, mySimulation, reverse(), Reverse, SMESH.TElementSimulation.SetPosition(), SMDSAbs_Face, and SMESH.UpdateView().
Referenced by CheckBox(), onTextChange(), and SelectionIntoArgument().
{
if (myNbOkNodes && GroupButtons->isEnabled()) {
SMESH::TElementSimulation::TVTKIds anIds;
QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++)
anIds.push_back(myActor->GetObject()->GetNodeVTKId(aListId[ i ].toInt()));
if (Reverse && Reverse->isChecked())
reverse(anIds.begin(),anIds.end());
vtkIdType aType = 0;
if (myIsPoly)
switch ( myElementType ) {
case SMDSAbs_Face : aType = VTK_POLYGON; break;
default: return;
}
else {
switch (myNbNodes) {
case 2: aType = VTK_LINE; break;
case 3: aType = VTK_TRIANGLE; break;
case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
case 8: aType = VTK_HEXAHEDRON; break;
default: return;
}
}
mySimulation->SetPosition(myActor,aType,anIds);
SMESH::UpdateView();
}
}
| void SMESHGUI_AddMeshElementDlg::enterEvent | ( | QEvent * | ) | [private] |
Definition at line 863 of file SMESHGUI_AddMeshElementDlg.cxx.
References ActivateThisDialog(), and GroupConstructors.
{
if (GroupConstructors->isEnabled())
return;
ActivateThisDialog();
}
| void SMESHGUI_AddMeshElementDlg::hideEvent | ( | QHideEvent * | ) | [private] |
Definition at line 884 of file SMESHGUI_AddMeshElementDlg.cxx.
References ClickOnCancel().
{
if (!isMinimized())
ClickOnCancel();
}
| void SMESHGUI_AddMeshElementDlg::Init | ( | ) | [private] |
Definition at line 424 of file SMESHGUI_AddMeshElementDlg.cxx.
References buttonApply, buttonCancel, buttonHelp, buttonOk, CheckBox(), ClickOnApply(), ClickOnCancel(), ClickOnHelp(), ClickOnOk(), Constructor1, DeactivateActiveDialog(), SMESH.GetViewWindow(), GroupC1, GroupGroups, LineEditC1A1, myActor, myBusy, myEditCurrentArgument, myElementType, myNbOkNodes, mySelectionMgr, mySMESHGUI, onTextChange(), Reverse, SelectButtonC1A1, SelectionIntoArgument(), SMESHGUI.SetActiveDialogBox(), SetEditCurrentArgument(), SMESH.SetPointRepresentation(), and SMDSAbs_0DElement.
Referenced by SMESHGUI_AddMeshElementDlg().
{
GroupC1->show();
Constructor1->setChecked(true);
myEditCurrentArgument = LineEditC1A1;
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
/* reset "Add to group" control */
GroupGroups->setChecked( false );
GroupGroups->setVisible( myElementType != SMDSAbs_0DElement );
myNbOkNodes = 0;
myActor = 0;
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), SLOT(ClickOnOk()));
connect(buttonCancel, SIGNAL(clicked()), SLOT(ClickOnCancel()));
connect(buttonApply, SIGNAL(clicked()), SLOT(ClickOnApply()));
connect(buttonHelp, SIGNAL(clicked()), SLOT(ClickOnHelp()));
connect(SelectButtonC1A1, SIGNAL(clicked()), SLOT(SetEditCurrentArgument()));
connect(LineEditC1A1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
/* to close dialog if study frame change */
connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), SLOT(ClickOnCancel()));
if (Reverse)
connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)));
// set selection mode
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode( NodeSelection );
myBusy = false;
SelectionIntoArgument();
}
| bool SMESHGUI_AddMeshElementDlg::isValid | ( | ) | [private] |
Definition at line 925 of file SMESHGUI_AddMeshElementDlg.cxx.
References ComboBox_GroupName, and GroupGroups.
Referenced by ClickOnApply().
{
if( GroupGroups->isChecked() && ComboBox_GroupName->currentText().isEmpty() ) {
SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ), tr( "GROUP_NAME_IS_EMPTY" ) );
return false;
}
return true;
}
| void SMESHGUI_AddMeshElementDlg::keyPressEvent | ( | QKeyEvent * | e | ) | [private] |
Definition at line 909 of file SMESHGUI_AddMeshElementDlg.cxx.
References ClickOnHelp().
{
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
if ( e->key() == Qt::Key_F1 ) {
e->accept();
ClickOnHelp();
}
}
| void SMESHGUI_AddMeshElementDlg::onTextChange | ( | const QString & | theNewText | ) | [private, slot] |
Definition at line 634 of file SMESHGUI_AddMeshElementDlg.cxx.
References buttonApply, buttonOk, displaySimulation(), SMDS_Mesh.FindNode(), SMESH_Actor.GetObject(), SMESH.GetViewWindow(), myActor, myBusy, myElementType, myIsPoly, myNbNodes, myNbOkNodes, mySelector, mySimulation, mySMESHGUI, SMESH.TElementSimulation.SetVisibility(), and SMDSAbs_Face.
Referenced by Init().
{
if (myBusy) return;
myBusy = true;
myNbOkNodes = 0;
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
mySimulation->SetVisibility(false);
// hilight entered nodes
SMDS_Mesh* aMesh = 0;
if (myActor)
aMesh = myActor->GetObject()->GetMesh();
if (aMesh) {
TColStd_MapOfInteger newIndices;
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
bool allOk = true;
for (int i = 0; i < aListId.count(); i++) {
if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
{
newIndices.Add( n->GetID() );
myNbOkNodes++;
}
else
allOk = false;
}
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight( myActor->getIO(), true, true );
myNbOkNodes = ( allOk && myNbNodes == aListId.count() );
if (myIsPoly)
{
if ( !allOk || myElementType != SMDSAbs_Face || aListId.count() < 3 )
myNbOkNodes = 0;
else
myNbOkNodes = aListId.count();
}
}
if(myNbOkNodes) {
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
displaySimulation();
}
myBusy = false;
}
| void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument | ( | ) | [private, slot] |
Definition at line 694 of file SMESHGUI_AddMeshElementDlg.cxx.
References SMESH_controls.aGroup, buttonApply, buttonOk, ComboBox_GroupName, displaySimulation(), SMESH.FindActorByEntry(), SMESH.GetMeshByIO(), SMESH.GetNameOfSelectedNodes(), GroupButtons, Handle(), myActor, myBusy, myEditCurrentArgument, myElementType, myEntry, myGroups, myIsPoly, myMesh, myNbNodes, myNbOkNodes, mySelectionMgr, mySelector, mySimulation, SMESH.TElementSimulation.SetVisibility(), and SMDSAbs_Face.
Referenced by ActivateThisDialog(), Init(), and SetEditCurrentArgument().
{
if (myBusy) return;
// clear
myNbOkNodes = 0;
myActor = 0;
myBusy = true;
myEditCurrentArgument->setText("");
myBusy = false;
if (!GroupButtons->isEnabled()) // inactive
return;
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
mySimulation->SetVisibility(false);
// SMESH::SetPointRepresentation(true);
QString aCurrentEntry = myEntry;
// get selected mesh
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
if (aList.Extent() != 1)
return;
Handle(SALOME_InteractiveObject) anIO = aList.First();
myEntry = anIO->getEntry();
myMesh = SMESH::GetMeshByIO(anIO);
if (myMesh->_is_nil())
return;
// process groups
if ( !myMesh->_is_nil() && myEntry != aCurrentEntry ) {
myGroups.clear();
ComboBox_GroupName->clear();
ComboBox_GroupName->addItem( QString() );
SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
for ( int i = 0, n = aListOfGroups.length(); i < n; i++ ) {
SMESH::SMESH_GroupBase_var aGroup = aListOfGroups[i];
if ( !aGroup->_is_nil() && aGroup->GetType() == (SMESH::ElementType)myElementType ) {
QString aGroupName( aGroup->GetName() );
if ( !aGroupName.isEmpty() ) {
myGroups.append(SMESH::SMESH_GroupBase::_duplicate(aGroup));
ComboBox_GroupName->addItem( aGroupName );
}
}
}
}
myActor = SMESH::FindActorByEntry(anIO->getEntry());
if (!myActor)
return;
// get selected nodes
QString aString = "";
int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,myActor->getIO(),aString);
myBusy = true;
myEditCurrentArgument->setText(aString);
myBusy = false;
if (myIsPoly && myElementType == SMDSAbs_Face && nbNodes >= 3 ) {
myNbNodes = nbNodes;
} else if (myNbNodes != nbNodes) {
return;
}
// OK
myNbOkNodes = nbNodes;
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
displaySimulation();
}
| void SMESHGUI_AddMeshElementDlg::SetEditCurrentArgument | ( | ) | [private, slot] |
Definition at line 813 of file SMESHGUI_AddMeshElementDlg.cxx.
References LineEditC1A1, myEditCurrentArgument, SelectButtonC1A1, and SelectionIntoArgument().
Referenced by Init().
{
QPushButton* send = (QPushButton*)sender();
if (send == SelectButtonC1A1) {
LineEditC1A1->setFocus();
myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument();
}
QPushButton* SMESHGUI_AddMeshElementDlg.buttonApply [private] |
Definition at line 109 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), Init(), onTextChange(), SelectionIntoArgument(), and SMESHGUI_AddMeshElementDlg().
QPushButton* SMESHGUI_AddMeshElementDlg.buttonCancel [private] |
Definition at line 108 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by Init(), and SMESHGUI_AddMeshElementDlg().
QPushButton* SMESHGUI_AddMeshElementDlg.buttonHelp [private] |
Definition at line 110 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by Init(), and SMESHGUI_AddMeshElementDlg().
QPushButton* SMESHGUI_AddMeshElementDlg.buttonOk [private] |
Definition at line 107 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), Init(), onTextChange(), SelectionIntoArgument(), and SMESHGUI_AddMeshElementDlg().
QComboBox* SMESHGUI_AddMeshElementDlg.ComboBox_GroupName [private] |
Definition at line 105 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), isValid(), SelectionIntoArgument(), and SMESHGUI_AddMeshElementDlg().
QRadioButton* SMESHGUI_AddMeshElementDlg.Constructor1 [private] |
Definition at line 102 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by Init(), and SMESHGUI_AddMeshElementDlg().
QGroupBox* SMESHGUI_AddMeshElementDlg.GroupButtons [private] |
Definition at line 106 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ActivateThisDialog(), DeactivateActiveDialog(), displaySimulation(), SelectionIntoArgument(), and SMESHGUI_AddMeshElementDlg().
QGroupBox* SMESHGUI_AddMeshElementDlg.GroupC1 [private] |
Definition at line 111 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ActivateThisDialog(), DeactivateActiveDialog(), Init(), and SMESHGUI_AddMeshElementDlg().
Definition at line 101 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ActivateThisDialog(), DeactivateActiveDialog(), enterEvent(), and SMESHGUI_AddMeshElementDlg().
QGroupBox* SMESHGUI_AddMeshElementDlg.GroupGroups [private] |
Definition at line 103 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), Init(), isValid(), and SMESHGUI_AddMeshElementDlg().
QLineEdit* SMESHGUI_AddMeshElementDlg.LineEditC1A1 [private] |
Definition at line 114 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by Init(), SetEditCurrentArgument(), and SMESHGUI_AddMeshElementDlg().
SMESH_Actor* SMESHGUI_AddMeshElementDlg.myActor [private] |
Definition at line 96 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), displaySimulation(), Init(), onTextChange(), and SelectionIntoArgument().
bool SMESHGUI_AddMeshElementDlg.myBusy [private] |
Definition at line 86 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), Init(), onTextChange(), and SelectionIntoArgument().
QLineEdit* SMESHGUI_AddMeshElementDlg.myEditCurrentArgument [private] |
Definition at line 89 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), displaySimulation(), Init(), SelectionIntoArgument(), and SetEditCurrentArgument().
int SMESHGUI_AddMeshElementDlg.myElementType [private] |
Definition at line 91 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), displaySimulation(), Init(), onTextChange(), SelectionIntoArgument(), and SMESHGUI_AddMeshElementDlg().
QString SMESHGUI_AddMeshElementDlg.myEntry [private] |
Definition at line 98 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by SelectionIntoArgument().
GrpList SMESHGUI_AddMeshElementDlg.myGroups [private] |
Definition at line 99 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), and SelectionIntoArgument().
QString SMESHGUI_AddMeshElementDlg.myHelpFileName [private] |
Definition at line 117 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnHelp(), and SMESHGUI_AddMeshElementDlg().
bool SMESHGUI_AddMeshElementDlg.myIsPoly [private] |
Definition at line 93 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), displaySimulation(), onTextChange(), SelectionIntoArgument(), and SMESHGUI_AddMeshElementDlg().
SMESH::SMESH_Mesh_var SMESHGUI_AddMeshElementDlg.myMesh [private] |
Definition at line 95 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), and SelectionIntoArgument().
int SMESHGUI_AddMeshElementDlg.myNbNodes [private] |
Definition at line 92 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), displaySimulation(), onTextChange(), SelectionIntoArgument(), and SMESHGUI_AddMeshElementDlg().
int SMESHGUI_AddMeshElementDlg.myNbOkNodes [private] |
Definition at line 85 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by CheckBox(), ClickOnApply(), displaySimulation(), Init(), onTextChange(), and SelectionIntoArgument().
LightApp_SelectionMgr* SMESHGUI_AddMeshElementDlg.mySelectionMgr [private] |
Definition at line 84 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), ClickOnCancel(), Init(), and SelectionIntoArgument().
SVTK_Selector* SMESHGUI_AddMeshElementDlg.mySelector [private] |
Definition at line 87 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), onTextChange(), SelectionIntoArgument(), and SMESHGUI_AddMeshElementDlg().
Definition at line 97 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by CheckBox(), ClickOnApply(), ClickOnCancel(), DeactivateActiveDialog(), displaySimulation(), onTextChange(), SelectionIntoArgument(), SMESHGUI_AddMeshElementDlg(), and ~SMESHGUI_AddMeshElementDlg().
SMESHGUI* SMESHGUI_AddMeshElementDlg.mySMESHGUI [private] |
Definition at line 83 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ActivateThisDialog(), ClickOnApply(), ClickOnCancel(), ClickOnHelp(), DeactivateActiveDialog(), Init(), onTextChange(), and SMESHGUI_AddMeshElementDlg().
QCheckBox* SMESHGUI_AddMeshElementDlg.Reverse [private] |
Definition at line 115 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by ClickOnApply(), displaySimulation(), Init(), and SMESHGUI_AddMeshElementDlg().
QPushButton* SMESHGUI_AddMeshElementDlg.SelectButtonC1A1 [private] |
Definition at line 113 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by Init(), SetEditCurrentArgument(), and SMESHGUI_AddMeshElementDlg().
QLabel* SMESHGUI_AddMeshElementDlg.TextLabel_GroupName [private] |
Definition at line 104 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by SMESHGUI_AddMeshElementDlg().
QLabel* SMESHGUI_AddMeshElementDlg.TextLabelC1A1 [private] |
Definition at line 112 of file SMESHGUI_AddMeshElementDlg.h.
Referenced by SMESHGUI_AddMeshElementDlg().