1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_AddMeshElementDlg.cxx
25 // Author : Nicolas REJNERI
29 #include "SMESHGUI_AddMeshElementDlg.h"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_VTKUtils.h"
34 #include "SMESHGUI_MeshUtils.h"
35 #include "SMESHGUI_IdValidator.h"
36 #include "SMESH_ActorUtils.h"
38 #include "SMDS_Mesh.hxx"
39 #include "SMESH_Actor.h"
41 #include "SUIT_Session.h"
42 #include "SUIT_MessageBox.h"
43 #include "LightApp_Application.h"
45 #include "SVTK_Selection.h"
46 #include "SVTK_Selector.h"
47 #include "SALOME_ListIO.hxx"
48 #include "SALOME_ListIteratorOfListIO.hxx"
50 #include "SalomeApp_Study.h"
51 #include "SalomeApp_Application.h"
53 #include "SVTK_ViewModel.h"
54 #include "SVTK_ViewWindow.h"
56 #include "utilities.h"
59 #include <TColStd_MapOfInteger.hxx>
60 #include <TColStd_IndexedMapOfInteger.hxx>
64 #include <vtkIdList.h>
65 #include <vtkIntArray.h>
66 #include <vtkCellArray.h>
67 #include <vtkUnsignedCharArray.h>
68 #include <vtkUnstructuredGrid.h>
69 #include <vtkDataSetMapper.h>
70 #include <vtkProperty.h>
73 #include <qbuttongroup.h>
74 #include <qgroupbox.h>
76 #include <qlineedit.h>
77 #include <qpushbutton.h>
78 #include <qradiobutton.h>
82 #include <qwhatsthis.h>
85 #include <qcheckbox.h>
95 class TElementSimulation {
96 SalomeApp_Application* myApplication;
97 SUIT_ViewWindow* myViewWindow;
98 SVTK_ViewWindow* myVTKViewWindow;
100 SALOME_Actor* myPreviewActor;
101 vtkDataSetMapper* myMapper;
102 vtkUnstructuredGrid* myGrid;
105 TElementSimulation (SalomeApp_Application* theApplication)
107 myApplication = theApplication;
108 SUIT_ViewManager* mgr = theApplication->activeViewManager();
110 myViewWindow = mgr->getActiveView();
111 myVTKViewWindow = GetVtkViewWindow(myViewWindow);
113 myGrid = vtkUnstructuredGrid::New();
115 // Create and display actor
116 myMapper = vtkDataSetMapper::New();
117 myMapper->SetInput(myGrid);
119 myPreviewActor = SALOME_Actor::New();
120 myPreviewActor->PickableOff();
121 myPreviewActor->VisibilityOff();
122 myPreviewActor->SetMapper(myMapper);
124 vtkFloatingPointType anRGB[3];
125 vtkProperty* aProp = vtkProperty::New();
126 GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
127 aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
128 myPreviewActor->SetProperty( aProp );
131 vtkProperty* aBackProp = vtkProperty::New();
132 GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
133 aBackProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
134 myPreviewActor->SetBackfaceProperty( aBackProp );
137 myVTKViewWindow->AddActor(myPreviewActor);
140 typedef std::vector<vtkIdType> TVTKIds;
141 void SetPosition (SMESH_Actor* theActor,
143 const TVTKIds& theIds)
145 vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
146 myGrid->SetPoints(aGrid->GetPoints());
148 const int* aConn = NULL;
152 static int anIds[] = {0,2,1,3};
158 static int anIds[] = {0,3,2,1,4};
164 static int anIds[] = {0,3,2,1,4,7,6,5};
171 vtkIdList *anIds = vtkIdList::New();
174 for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
175 anIds->InsertId(i,theIds[aConn[i]]);
177 for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
178 anIds->InsertId(i,theIds[i]);
180 myGrid->InsertNextCell(theType,anIds);
189 void SetVisibility (bool theVisibility)
191 myPreviewActor->SetVisibility(theVisibility);
192 RepaintCurrentView();
196 ~TElementSimulation()
198 if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
199 myVTKViewWindow->RemoveActor(myPreviewActor);
201 myPreviewActor->Delete();
203 myMapper->RemoveAllInputs();
211 //=================================================================================
212 // function : SMESHGUI_AddMeshElementDlg()
213 // purpose : constructor
214 //=================================================================================
215 SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
217 SMDSAbs_ElementType ElementType, int nbNodes,
218 bool modal, WFlags fl)
219 : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
220 WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
221 mySMESHGUI( theModule ),
222 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
224 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
225 (SUIT_Session::session()->activeApplication());
227 mySimulation = new SMESH::TElementSimulation (anApp);
228 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
230 // verify nb nodes and type
232 myElementType = ElementType;
233 switch (ElementType) {
235 // if (myNbNodes != 3 && myNbNodes != 4)
239 // if (myNbNodes != 4 && myNbNodes != 8) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
243 myElementType = SMDSAbs_Edge;
248 if (myNbNodes == 2) {
250 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_edges";
252 else if (myNbNodes == 3) {
253 elemName = "TRIANGLE";
254 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_triangles";
256 else if (myNbNodes == 4)
257 if (myElementType == SMDSAbs_Face) {
258 elemName = "QUADRANGLE";
259 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_quadrangles";
263 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_tetrahedrons";
265 else if (myNbNodes == 8) {
267 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_hexahedrons";
269 else if (myElementType == SMDSAbs_Face) {
270 elemName = "POLYGON";
272 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_polygons";
274 else if (myElementType == SMDSAbs_Volume) {
275 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_polyhedrons";
278 QString iconName = tr(QString("ICON_DLG_%1").arg(elemName));
279 QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName));
280 QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName));
281 QString grBoxTitle = tr(QString("SMESH_ADD_%1").arg(elemName));
283 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", iconName));
284 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
287 setName("SMESHGUI_AddMeshElementDlg");
291 setSizeGripEnabled(TRUE);
292 SMESHGUI_AddMeshElementDlgLayout = new QGridLayout(this);
293 SMESHGUI_AddMeshElementDlgLayout->setSpacing(6);
294 SMESHGUI_AddMeshElementDlgLayout->setMargin(11);
296 /***************************************************************/
297 GroupConstructors = new QButtonGroup(this, "GroupConstructors");
298 GroupConstructors->setTitle(buttonGrTitle);
300 GroupConstructors->setExclusive(TRUE);
301 GroupConstructors->setColumnLayout(0, Qt::Vertical);
302 GroupConstructors->layout()->setSpacing(0);
303 GroupConstructors->layout()->setMargin(0);
304 GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
305 GroupConstructorsLayout->setAlignment(Qt::AlignTop);
306 GroupConstructorsLayout->setSpacing(6);
307 GroupConstructorsLayout->setMargin(11);
308 Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
309 Constructor1->setText(tr("" ));
310 Constructor1->setPixmap(image0);
311 Constructor1->setChecked(TRUE);
312 Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth()));
313 Constructor1->setMinimumSize(QSize(50, 0));
314 GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
315 QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
316 GroupConstructorsLayout->addItem(spacer, 0, 1);
317 SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupConstructors, 0, 0);
319 /***************************************************************/
320 GroupButtons = new QGroupBox(this, "GroupButtons");
321 GroupButtons->setGeometry(QRect(10, 10, 281, 48));
322 GroupButtons->setTitle(tr("" ));
323 GroupButtons->setColumnLayout(0, Qt::Vertical);
324 GroupButtons->layout()->setSpacing(0);
325 GroupButtons->layout()->setMargin(0);
326 GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
327 GroupButtonsLayout->setAlignment(Qt::AlignTop);
328 GroupButtonsLayout->setSpacing(6);
329 GroupButtonsLayout->setMargin(11);
330 buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
331 buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
332 buttonCancel->setAutoDefault(TRUE);
333 GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
334 buttonApply = new QPushButton(GroupButtons, "buttonApply");
335 buttonApply->setText(tr("SMESH_BUT_APPLY" ));
336 buttonApply->setAutoDefault(TRUE);
337 GroupButtonsLayout->addWidget(buttonApply, 0, 1);
338 QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
339 GroupButtonsLayout->addItem(spacer_9, 0, 2);
340 buttonOk = new QPushButton(GroupButtons, "buttonOk");
341 buttonOk->setText(tr("SMESH_BUT_OK" ));
342 buttonOk->setAutoDefault(TRUE);
343 buttonOk->setDefault(TRUE);
344 GroupButtonsLayout->addWidget(buttonOk, 0, 0);
345 buttonHelp = new QPushButton(GroupButtons, "buttonHelp");
346 buttonHelp->setText(tr("SMESH_BUT_HELP" ));
347 buttonHelp->setAutoDefault(TRUE);
348 GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
350 SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupButtons, 2, 0);
352 /***************************************************************/
353 GroupC1 = new QGroupBox(this, "GroupC1");
354 GroupC1->setTitle(grBoxTitle);
356 GroupC1->setMinimumSize(QSize(0, 0));
357 GroupC1->setFrameShape(QGroupBox::Box);
358 GroupC1->setFrameShadow(QGroupBox::Sunken);
359 GroupC1->setColumnLayout(0, Qt::Vertical);
360 GroupC1->layout()->setSpacing(0);
361 GroupC1->layout()->setMargin(0);
362 GroupC1Layout = new QGridLayout(GroupC1->layout());
363 GroupC1Layout->setAlignment(Qt::AlignTop);
364 GroupC1Layout->setSpacing(6);
365 GroupC1Layout->setMargin(11);
366 TextLabelC1A1 = new QLabel(GroupC1, "TextLabelC1A1");
367 TextLabelC1A1->setText(tr("SMESH_ID_NODES" ));
368 TextLabelC1A1->setMinimumSize(QSize(50, 0));
369 TextLabelC1A1->setFrameShape(QLabel::NoFrame);
370 TextLabelC1A1->setFrameShadow(QLabel::Plain);
371 GroupC1Layout->addWidget(TextLabelC1A1, 0, 0);
372 SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
373 SelectButtonC1A1->setText(tr("" ));
374 SelectButtonC1A1->setPixmap(image1);
375 SelectButtonC1A1->setToggleButton(FALSE);
376 GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
377 LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
378 // LineEditC1A1->setReadOnly(TRUE);
380 LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator", myNbNodes));
381 GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
383 if (myElementType == SMDSAbs_Face) {
384 Reverse = new QCheckBox(GroupC1, "Reverse");
385 Reverse->setText(tr("SMESH_REVERSE" ));
386 GroupC1Layout->addWidget(Reverse, 1, 0);
391 SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupC1, 1, 0);
393 Init(); /* Initialisations */
396 //=================================================================================
397 // function : ~SMESHGUI_AddMeshElementDlg()
398 // purpose : Destroys the object and frees any allocated resources
399 //=================================================================================
400 SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg()
402 // no need to delete child widgets, Qt does it all for us
406 //=================================================================================
409 //=================================================================================
410 void SMESHGUI_AddMeshElementDlg::Init()
413 Constructor1->setChecked(TRUE);
414 myEditCurrentArgument = LineEditC1A1;
415 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
420 /* signals and slots connections */
421 connect(buttonOk, SIGNAL(clicked()), SLOT(ClickOnOk()));
422 connect(buttonCancel, SIGNAL(clicked()), SLOT(ClickOnCancel()));
423 connect(buttonApply, SIGNAL(clicked()), SLOT(ClickOnApply()));
424 connect(buttonHelp, SIGNAL(clicked()), SLOT(ClickOnHelp()));
426 connect(SelectButtonC1A1, SIGNAL(clicked()), SLOT(SetEditCurrentArgument()));
427 connect(LineEditC1A1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
428 connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
429 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
430 /* to close dialog if study frame change */
431 connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
434 connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)));
436 this->show(); // displays Dialog
438 // set selection mode
439 SMESH::SetPointRepresentation(true);
441 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
442 aViewWindow->SetSelectionMode( NodeSelection );
446 SelectionIntoArgument();
449 //=================================================================================
450 // function : ClickOnApply()
452 //=================================================================================
453 void SMESHGUI_AddMeshElementDlg::ClickOnApply()
455 if (myNbOkNodes && !mySMESHGUI->isActiveStudyLocked()) {
457 SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
458 anArrayOfIdeces->length(myNbNodes);
459 bool reverse = (Reverse && Reverse->isChecked());
460 QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
461 for (int i = 0; i < aListId.count(); i++)
463 anArrayOfIdeces[i] = aListId[ myNbNodes - i - 1 ].toInt();
465 anArrayOfIdeces[i] = aListId[ i ].toInt();
467 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
468 switch (myElementType) {
470 aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
473 aMeshEditor->AddPolygonalFace(anArrayOfIdeces.inout());
475 aMeshEditor->AddFace(anArrayOfIdeces.inout());
480 aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
484 SALOME_ListIO aList; aList.Append( myActor->getIO() );
485 mySelector->ClearIndex();
486 mySelectionMgr->setSelectedObjects( aList, false );
489 mySimulation->SetVisibility(false);
491 buttonOk->setEnabled(false);
492 buttonApply->setEnabled(false);
494 myEditCurrentArgument->setText("");
500 //=================================================================================
501 // function : ClickOnOk()
503 //=================================================================================
504 void SMESHGUI_AddMeshElementDlg::ClickOnOk()
506 this->ClickOnApply();
507 this->ClickOnCancel();
511 //=================================================================================
512 // function : ClickOnCancel()
514 //=================================================================================
515 void SMESHGUI_AddMeshElementDlg::ClickOnCancel()
517 //mySelectionMgr->clearSelected();
518 mySimulation->SetVisibility(false);
519 SMESH::SetPointRepresentation(false);
520 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
521 aViewWindow->SetSelectionMode( ActorSelection );
522 disconnect(mySelectionMgr, 0, this, 0);
523 mySMESHGUI->ResetState();
528 //=================================================================================
529 // function : ClickOnHelp()
531 //=================================================================================
532 void SMESHGUI_AddMeshElementDlg::ClickOnHelp()
534 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
536 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
538 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
539 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
540 arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName),
541 QObject::tr("BUT_OK"));
545 //=================================================================================
546 // function : onTextChange()
548 //=================================================================================
549 void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
556 buttonOk->setEnabled(false);
557 buttonApply->setEnabled(false);
559 mySimulation->SetVisibility(false);
561 // hilight entered nodes
562 SMDS_Mesh* aMesh = 0;
564 aMesh = myActor->GetObject()->GetMesh();
567 TColStd_MapOfInteger newIndices;
569 QStringList aListId = QStringList::split(" ", theNewText, false);
571 for (int i = 0; i < aListId.count(); i++) {
572 if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
574 newIndices.Add( n->GetID() );
581 mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
582 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
583 aViewWindow->highlight( myActor->getIO(), true, true );
585 myNbOkNodes = ( allOk && myNbNodes == aListId.count() );
589 if ( !allOk || myElementType != SMDSAbs_Face || aListId.count() < 3 )
592 myNbOkNodes = aListId.count();
597 buttonOk->setEnabled(true);
598 buttonApply->setEnabled(true);
605 //=================================================================================
606 // function : SelectionIntoArgument()
607 // purpose : Called when selection has changed
608 //=================================================================================
609 void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument()
618 myEditCurrentArgument->setText("");
621 if (!GroupButtons->isEnabled()) // inactive
624 buttonOk->setEnabled(false);
625 buttonApply->setEnabled(false);
627 mySimulation->SetVisibility(false);
628 // SMESH::SetPointRepresentation(true);
632 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
634 if (aList.Extent() != 1)
637 Handle(SALOME_InteractiveObject) anIO = aList.First();
638 myMesh = SMESH::GetMeshByIO(anIO);
639 if (myMesh->_is_nil())
642 myActor = SMESH::FindActorByEntry(anIO->getEntry());
646 // get selected nodes
647 QString aString = "";
648 int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,myActor->getIO(),aString);
650 myEditCurrentArgument->setText(aString);
652 if (myIsPoly && myElementType == SMDSAbs_Face && nbNodes >= 3 ) {
654 } else if (myNbNodes != nbNodes) {
659 myNbOkNodes = nbNodes;
661 buttonOk->setEnabled(true);
662 buttonApply->setEnabled(true);
667 //=================================================================================
668 // function : displaySimulation()
670 //=================================================================================
671 void SMESHGUI_AddMeshElementDlg::displaySimulation()
673 if (myNbOkNodes && GroupButtons->isEnabled()) {
674 SMESH::TElementSimulation::TVTKIds anIds;
675 QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
676 for (int i = 0; i < aListId.count(); i++)
677 anIds.push_back(myActor->GetObject()->GetNodeVTKId(aListId[ i ].toInt()));
679 if (Reverse && Reverse->isChecked())
680 reverse(anIds.begin(),anIds.end());
684 switch ( myElementType ) {
685 case SMDSAbs_Face : aType = VTK_POLYGON; break;
690 case 2: aType = VTK_LINE; break;
691 case 3: aType = VTK_TRIANGLE; break;
692 case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
693 case 8: aType = VTK_HEXAHEDRON; break;
698 mySimulation->SetPosition(myActor,aType,anIds);
703 //=================================================================================
704 // function : SetEditCurrentArgument()
706 //=================================================================================
707 void SMESHGUI_AddMeshElementDlg::SetEditCurrentArgument()
709 QPushButton* send = (QPushButton*)sender();
710 if (send == SelectButtonC1A1) {
711 LineEditC1A1->setFocus();
712 myEditCurrentArgument = LineEditC1A1;
714 SelectionIntoArgument();
717 //=================================================================================
718 // function : DeactivateActiveDialog()
720 //=================================================================================
721 void SMESHGUI_AddMeshElementDlg::DeactivateActiveDialog()
723 if (GroupConstructors->isEnabled()) {
724 GroupConstructors->setEnabled(false);
725 GroupC1->setEnabled(false);
726 GroupButtons->setEnabled(false);
727 mySimulation->SetVisibility(false);
728 mySMESHGUI->ResetState();
729 mySMESHGUI->SetActiveDialogBox(0);
733 //=================================================================================
734 // function : ActivateThisDialog()
736 //=================================================================================
737 void SMESHGUI_AddMeshElementDlg::ActivateThisDialog()
739 /* Emit a signal to deactivate the active dialog */
740 mySMESHGUI->EmitSignalDeactivateDialog();
742 GroupConstructors->setEnabled(true);
743 GroupC1->setEnabled(true);
744 GroupButtons->setEnabled(true);
746 SMESH::SetPointRepresentation(true);
748 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
749 aViewWindow->SetSelectionMode( NodeSelection );
750 SelectionIntoArgument();
753 //=================================================================================
754 // function : enterEvent()
756 //=================================================================================
757 void SMESHGUI_AddMeshElementDlg::enterEvent (QEvent*)
759 if (GroupConstructors->isEnabled())
761 ActivateThisDialog();
765 //=================================================================================
766 // function : closeEvent()
768 //=================================================================================
769 void SMESHGUI_AddMeshElementDlg::closeEvent (QCloseEvent*)
771 /* same than click on cancel button */
772 this->ClickOnCancel();
776 //=================================================================================
777 // function : hideEvent()
778 // purpose : caused by ESC key
779 //=================================================================================
780 void SMESHGUI_AddMeshElementDlg::hideEvent (QHideEvent*)
786 //=================================================================================
787 // function : CheckBox()
789 //=================================================================================
790 void SMESHGUI_AddMeshElementDlg::CheckBox (int state)
796 mySimulation->SetVisibility(false);