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"
44 #include "SVTK_Selection.h"
45 #include "SVTK_Selector.h"
46 #include "SALOME_ListIO.hxx"
47 #include "SALOME_ListIteratorOfListIO.hxx"
49 #include "SalomeApp_Study.h"
50 #include "SalomeApp_Application.h"
52 #include "SVTK_ViewModel.h"
53 #include "SVTK_ViewWindow.h"
55 #include "utilities.h"
58 #include <TColStd_MapOfInteger.hxx>
59 #include <TColStd_IndexedMapOfInteger.hxx>
63 #include <vtkIdList.h>
64 #include <vtkIntArray.h>
65 #include <vtkCellArray.h>
66 #include <vtkUnsignedCharArray.h>
67 #include <vtkUnstructuredGrid.h>
68 #include <vtkDataSetMapper.h>
69 #include <vtkProperty.h>
72 #include <qbuttongroup.h>
73 #include <qgroupbox.h>
75 #include <qlineedit.h>
76 #include <qpushbutton.h>
77 #include <qradiobutton.h>
81 #include <qwhatsthis.h>
84 #include <qcheckbox.h>
94 class TElementSimulation {
95 SalomeApp_Application* myApplication;
96 SUIT_ViewWindow* myViewWindow;
97 SVTK_ViewWindow* myVTKViewWindow;
99 SALOME_Actor* myPreviewActor;
100 vtkDataSetMapper* myMapper;
101 vtkUnstructuredGrid* myGrid;
104 TElementSimulation (SalomeApp_Application* theApplication)
106 myApplication = theApplication;
107 SUIT_ViewManager* mgr = theApplication->activeViewManager();
109 myViewWindow = mgr->getActiveView();
110 myVTKViewWindow = GetVtkViewWindow(myViewWindow);
112 myGrid = vtkUnstructuredGrid::New();
114 // Create and display actor
115 myMapper = vtkDataSetMapper::New();
116 myMapper->SetInput(myGrid);
118 myPreviewActor = SALOME_Actor::New();
119 myPreviewActor->PickableOff();
120 myPreviewActor->VisibilityOff();
121 myPreviewActor->SetMapper(myMapper);
124 vtkProperty* aProp = vtkProperty::New();
125 GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
126 aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
127 myPreviewActor->SetProperty( aProp );
130 vtkProperty* aBackProp = vtkProperty::New();
131 GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
132 aBackProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
133 myPreviewActor->SetBackfaceProperty( aBackProp );
136 myVTKViewWindow->AddActor(myPreviewActor);
139 typedef std::vector<vtkIdType> TVTKIds;
140 void SetPosition (SMESH_Actor* theActor,
142 const TVTKIds& theIds)
144 vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
145 myGrid->SetPoints(aGrid->GetPoints());
147 const int* aConn = NULL;
151 static int anIds[] = {0,2,1,3};
157 static int anIds[] = {0,3,2,1,4};
163 static int anIds[] = {0,3,2,1,4,7,6,5};
170 vtkIdList *anIds = vtkIdList::New();
173 for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
174 anIds->InsertId(i,theIds[aConn[i]]);
176 for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
177 anIds->InsertId(i,theIds[i]);
179 myGrid->InsertNextCell(theType,anIds);
188 void SetVisibility (bool theVisibility)
190 myPreviewActor->SetVisibility(theVisibility);
191 RepaintCurrentView();
195 ~TElementSimulation()
197 if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
198 myVTKViewWindow->RemoveActor(myPreviewActor);
200 myPreviewActor->Delete();
202 myMapper->RemoveAllInputs();
210 //=================================================================================
211 // function : SMESHGUI_AddMeshElementDlg()
212 // purpose : constructor
213 //=================================================================================
214 SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
216 SMDSAbs_ElementType ElementType, int nbNodes,
217 bool modal, WFlags fl)
218 : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
219 WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
220 mySMESHGUI( theModule ),
221 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
223 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
224 (SUIT_Session::session()->activeApplication());
226 mySimulation = new SMESH::TElementSimulation (anApp);
227 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
229 // verify nb nodes and type
231 myElementType = ElementType;
232 switch (ElementType) {
234 // if (myNbNodes != 3 && myNbNodes != 4)
238 // if (myNbNodes != 4 && myNbNodes != 8) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
242 myElementType = SMDSAbs_Edge;
247 if (myNbNodes == 2) {
249 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_edges";
251 else if (myNbNodes == 3) {
252 elemName = "TRIANGLE";
253 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_triangles";
255 else if (myNbNodes == 4)
256 if (myElementType == SMDSAbs_Face) {
257 elemName = "QUADRANGLE";
258 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_quadrangles";
262 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_tetrahedrons";
264 else if (myNbNodes == 8) {
266 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_hexahedrons";
268 else if (myElementType == SMDSAbs_Face) {
269 elemName = "POLYGON";
271 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_polygons";
273 else if (myElementType == SMDSAbs_Volume) {
274 myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_polyhedrons";
277 QString iconName = tr(QString("ICON_DLG_%1").arg(elemName));
278 QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName));
279 QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName));
280 QString grBoxTitle = tr(QString("SMESH_ADD_%1").arg(elemName));
282 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", iconName));
283 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
286 setName("SMESHGUI_AddMeshElementDlg");
290 setSizeGripEnabled(TRUE);
291 SMESHGUI_AddMeshElementDlgLayout = new QGridLayout(this);
292 SMESHGUI_AddMeshElementDlgLayout->setSpacing(6);
293 SMESHGUI_AddMeshElementDlgLayout->setMargin(11);
295 /***************************************************************/
296 GroupConstructors = new QButtonGroup(this, "GroupConstructors");
297 GroupConstructors->setTitle(buttonGrTitle);
299 GroupConstructors->setExclusive(TRUE);
300 GroupConstructors->setColumnLayout(0, Qt::Vertical);
301 GroupConstructors->layout()->setSpacing(0);
302 GroupConstructors->layout()->setMargin(0);
303 GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
304 GroupConstructorsLayout->setAlignment(Qt::AlignTop);
305 GroupConstructorsLayout->setSpacing(6);
306 GroupConstructorsLayout->setMargin(11);
307 Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
308 Constructor1->setText(tr("" ));
309 Constructor1->setPixmap(image0);
310 Constructor1->setChecked(TRUE);
311 Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth()));
312 Constructor1->setMinimumSize(QSize(50, 0));
313 GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
314 QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
315 GroupConstructorsLayout->addItem(spacer, 0, 1);
316 SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupConstructors, 0, 0);
318 /***************************************************************/
319 GroupButtons = new QGroupBox(this, "GroupButtons");
320 GroupButtons->setGeometry(QRect(10, 10, 281, 48));
321 GroupButtons->setTitle(tr("" ));
322 GroupButtons->setColumnLayout(0, Qt::Vertical);
323 GroupButtons->layout()->setSpacing(0);
324 GroupButtons->layout()->setMargin(0);
325 GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
326 GroupButtonsLayout->setAlignment(Qt::AlignTop);
327 GroupButtonsLayout->setSpacing(6);
328 GroupButtonsLayout->setMargin(11);
329 buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
330 buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
331 buttonCancel->setAutoDefault(TRUE);
332 GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
333 buttonApply = new QPushButton(GroupButtons, "buttonApply");
334 buttonApply->setText(tr("SMESH_BUT_APPLY" ));
335 buttonApply->setAutoDefault(TRUE);
336 GroupButtonsLayout->addWidget(buttonApply, 0, 1);
337 QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
338 GroupButtonsLayout->addItem(spacer_9, 0, 2);
339 buttonOk = new QPushButton(GroupButtons, "buttonOk");
340 buttonOk->setText(tr("SMESH_BUT_OK" ));
341 buttonOk->setAutoDefault(TRUE);
342 buttonOk->setDefault(TRUE);
343 GroupButtonsLayout->addWidget(buttonOk, 0, 0);
344 buttonHelp = new QPushButton(GroupButtons, "buttonHelp");
345 buttonHelp->setText(tr("SMESH_BUT_HELP" ));
346 buttonHelp->setAutoDefault(TRUE);
347 GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
349 SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupButtons, 2, 0);
351 /***************************************************************/
352 GroupC1 = new QGroupBox(this, "GroupC1");
353 GroupC1->setTitle(grBoxTitle);
355 GroupC1->setMinimumSize(QSize(0, 0));
356 GroupC1->setFrameShape(QGroupBox::Box);
357 GroupC1->setFrameShadow(QGroupBox::Sunken);
358 GroupC1->setColumnLayout(0, Qt::Vertical);
359 GroupC1->layout()->setSpacing(0);
360 GroupC1->layout()->setMargin(0);
361 GroupC1Layout = new QGridLayout(GroupC1->layout());
362 GroupC1Layout->setAlignment(Qt::AlignTop);
363 GroupC1Layout->setSpacing(6);
364 GroupC1Layout->setMargin(11);
365 TextLabelC1A1 = new QLabel(GroupC1, "TextLabelC1A1");
366 TextLabelC1A1->setText(tr("SMESH_ID_NODES" ));
367 TextLabelC1A1->setMinimumSize(QSize(50, 0));
368 TextLabelC1A1->setFrameShape(QLabel::NoFrame);
369 TextLabelC1A1->setFrameShadow(QLabel::Plain);
370 GroupC1Layout->addWidget(TextLabelC1A1, 0, 0);
371 SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
372 SelectButtonC1A1->setText(tr("" ));
373 SelectButtonC1A1->setPixmap(image1);
374 SelectButtonC1A1->setToggleButton(FALSE);
375 GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
376 LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
377 // LineEditC1A1->setReadOnly(TRUE);
379 LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator", myNbNodes));
380 GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
382 if (myElementType == SMDSAbs_Face) {
383 Reverse = new QCheckBox(GroupC1, "Reverse");
384 Reverse->setText(tr("SMESH_REVERSE" ));
385 GroupC1Layout->addWidget(Reverse, 1, 0);
390 SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupC1, 1, 0);
392 Init(); /* Initialisations */
395 //=================================================================================
396 // function : ~SMESHGUI_AddMeshElementDlg()
397 // purpose : Destroys the object and frees any allocated resources
398 //=================================================================================
399 SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg()
401 // no need to delete child widgets, Qt does it all for us
405 //=================================================================================
408 //=================================================================================
409 void SMESHGUI_AddMeshElementDlg::Init()
412 Constructor1->setChecked(TRUE);
413 myEditCurrentArgument = LineEditC1A1;
414 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
419 /* signals and slots connections */
420 connect(buttonOk, SIGNAL(clicked()), SLOT(ClickOnOk()));
421 connect(buttonCancel, SIGNAL(clicked()), SLOT(ClickOnCancel()));
422 connect(buttonApply, SIGNAL(clicked()), SLOT(ClickOnApply()));
423 connect(buttonHelp, SIGNAL(clicked()), SLOT(ClickOnHelp()));
425 connect(SelectButtonC1A1, SIGNAL(clicked()), SLOT(SetEditCurrentArgument()));
426 connect(LineEditC1A1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
427 connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
428 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
429 /* to close dialog if study frame change */
430 connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
433 connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)));
435 this->show(); // displays Dialog
437 // set selection mode
438 SMESH::SetPointRepresentation(true);
440 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
441 aViewWindow->SetSelectionMode( NodeSelection );
445 SelectionIntoArgument();
448 //=================================================================================
449 // function : ClickOnApply()
451 //=================================================================================
452 void SMESHGUI_AddMeshElementDlg::ClickOnApply()
454 if (myNbOkNodes && !mySMESHGUI->isActiveStudyLocked()) {
456 SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
457 anArrayOfIdeces->length(myNbNodes);
458 bool reverse = (Reverse && Reverse->isChecked());
459 QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
460 for (int i = 0; i < aListId.count(); i++)
462 anArrayOfIdeces[i] = aListId[ myNbNodes - i - 1 ].toInt();
464 anArrayOfIdeces[i] = aListId[ i ].toInt();
466 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
467 switch (myElementType) {
469 aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
472 aMeshEditor->AddPolygonalFace(anArrayOfIdeces.inout());
474 aMeshEditor->AddFace(anArrayOfIdeces.inout());
479 aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
483 SALOME_ListIO aList; aList.Append( myActor->getIO() );
484 mySelector->ClearIndex();
485 mySelectionMgr->setSelectedObjects( aList, false );
488 mySimulation->SetVisibility(false);
490 buttonOk->setEnabled(false);
491 buttonApply->setEnabled(false);
493 myEditCurrentArgument->setText("");
499 //=================================================================================
500 // function : ClickOnOk()
502 //=================================================================================
503 void SMESHGUI_AddMeshElementDlg::ClickOnOk()
505 this->ClickOnApply();
506 this->ClickOnCancel();
510 //=================================================================================
511 // function : ClickOnCancel()
513 //=================================================================================
514 void SMESHGUI_AddMeshElementDlg::ClickOnCancel()
516 //mySelectionMgr->clearSelected();
517 mySimulation->SetVisibility(false);
518 SMESH::SetPointRepresentation(false);
519 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
520 aViewWindow->SetSelectionMode( ActorSelection );
521 disconnect(mySelectionMgr, 0, this, 0);
522 mySMESHGUI->ResetState();
527 //=================================================================================
528 // function : ClickOnHelp()
530 //=================================================================================
531 void SMESHGUI_AddMeshElementDlg::ClickOnHelp()
533 SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
535 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
537 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
538 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
539 arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName),
540 QObject::tr("BUT_OK"));
544 //=================================================================================
545 // function : onTextChange()
547 //=================================================================================
548 void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
555 buttonOk->setEnabled(false);
556 buttonApply->setEnabled(false);
558 mySimulation->SetVisibility(false);
560 // hilight entered nodes
561 SMDS_Mesh* aMesh = 0;
563 aMesh = myActor->GetObject()->GetMesh();
566 TColStd_MapOfInteger newIndices;
568 QStringList aListId = QStringList::split(" ", theNewText, false);
570 for (int i = 0; i < aListId.count(); i++) {
571 if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
573 newIndices.Add( n->GetID() );
580 mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
581 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
582 aViewWindow->highlight( myActor->getIO(), true, true );
584 myNbOkNodes = ( allOk && myNbNodes == aListId.count() );
588 if ( !allOk || myElementType != SMDSAbs_Face || aListId.count() < 3 )
591 myNbOkNodes = aListId.count();
596 buttonOk->setEnabled(true);
597 buttonApply->setEnabled(true);
604 //=================================================================================
605 // function : SelectionIntoArgument()
606 // purpose : Called when selection has changed
607 //=================================================================================
608 void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument()
617 myEditCurrentArgument->setText("");
620 if (!GroupButtons->isEnabled()) // inactive
623 buttonOk->setEnabled(false);
624 buttonApply->setEnabled(false);
626 mySimulation->SetVisibility(false);
627 // SMESH::SetPointRepresentation(true);
631 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
633 if (aList.Extent() != 1)
636 Handle(SALOME_InteractiveObject) anIO = aList.First();
637 myMesh = SMESH::GetMeshByIO(anIO);
638 if (myMesh->_is_nil())
641 myActor = SMESH::FindActorByEntry(anIO->getEntry());
645 // get selected nodes
646 QString aString = "";
647 int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,myActor->getIO(),aString);
649 myEditCurrentArgument->setText(aString);
651 if (myIsPoly && myElementType == SMDSAbs_Face && nbNodes >= 3 ) {
653 } else if (myNbNodes != nbNodes) {
658 myNbOkNodes = nbNodes;
660 buttonOk->setEnabled(true);
661 buttonApply->setEnabled(true);
666 //=================================================================================
667 // function : displaySimulation()
669 //=================================================================================
670 void SMESHGUI_AddMeshElementDlg::displaySimulation()
672 if (myNbOkNodes && GroupButtons->isEnabled()) {
673 SMESH::TElementSimulation::TVTKIds anIds;
674 QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
675 for (int i = 0; i < aListId.count(); i++)
676 anIds.push_back(myActor->GetObject()->GetNodeVTKId(aListId[ i ].toInt()));
678 if (Reverse && Reverse->isChecked())
679 reverse(anIds.begin(),anIds.end());
683 switch ( myElementType ) {
684 case SMDSAbs_Face : aType = VTK_POLYGON; break;
689 case 2: aType = VTK_LINE; break;
690 case 3: aType = VTK_TRIANGLE; break;
691 case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
692 case 8: aType = VTK_HEXAHEDRON; break;
697 mySimulation->SetPosition(myActor,aType,anIds);
702 //=================================================================================
703 // function : SetEditCurrentArgument()
705 //=================================================================================
706 void SMESHGUI_AddMeshElementDlg::SetEditCurrentArgument()
708 QPushButton* send = (QPushButton*)sender();
709 if (send == SelectButtonC1A1) {
710 LineEditC1A1->setFocus();
711 myEditCurrentArgument = LineEditC1A1;
713 SelectionIntoArgument();
716 //=================================================================================
717 // function : DeactivateActiveDialog()
719 //=================================================================================
720 void SMESHGUI_AddMeshElementDlg::DeactivateActiveDialog()
722 if (GroupConstructors->isEnabled()) {
723 GroupConstructors->setEnabled(false);
724 GroupC1->setEnabled(false);
725 GroupButtons->setEnabled(false);
726 mySimulation->SetVisibility(false);
727 mySMESHGUI->ResetState();
728 mySMESHGUI->SetActiveDialogBox(0);
732 //=================================================================================
733 // function : ActivateThisDialog()
735 //=================================================================================
736 void SMESHGUI_AddMeshElementDlg::ActivateThisDialog()
738 /* Emit a signal to deactivate the active dialog */
739 mySMESHGUI->EmitSignalDeactivateDialog();
741 GroupConstructors->setEnabled(true);
742 GroupC1->setEnabled(true);
743 GroupButtons->setEnabled(true);
745 SMESH::SetPointRepresentation(true);
747 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
748 aViewWindow->SetSelectionMode( NodeSelection );
749 SelectionIntoArgument();
752 //=================================================================================
753 // function : enterEvent()
755 //=================================================================================
756 void SMESHGUI_AddMeshElementDlg::enterEvent (QEvent*)
758 if (GroupConstructors->isEnabled())
760 ActivateThisDialog();
764 //=================================================================================
765 // function : closeEvent()
767 //=================================================================================
768 void SMESHGUI_AddMeshElementDlg::closeEvent (QCloseEvent*)
770 /* same than click on cancel button */
771 this->ClickOnCancel();
775 //=================================================================================
776 // function : hideEvent()
777 // purpose : caused by ESC key
778 //=================================================================================
779 void SMESHGUI_AddMeshElementDlg::hideEvent (QHideEvent*)
785 //=================================================================================
786 // function : CheckBox()
788 //=================================================================================
789 void SMESHGUI_AddMeshElementDlg::CheckBox (int state)
795 mySimulation->SetVisibility(false);