1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SMESH SMESHGUI : GUI for SMESH component
23 // File : SMESHGUI_AddMeshElementDlg.cxx
24 // Author : Nicolas REJNERI
28 #include "SMESHGUI_AddMeshElementDlg.h"
31 #include "SMESHGUI_Utils.h"
32 #include "SMESHGUI_VTKUtils.h"
33 #include "SMESHGUI_MeshUtils.h"
34 #include "SMESHGUI_IdValidator.h"
35 #include "SMESH_ActorUtils.h"
37 #include "SMDS_Mesh.hxx"
38 #include "SMESH_Actor.h"
40 #include "SUIT_Session.h"
41 #include "SUIT_MessageBox.h"
42 #include "LightApp_Application.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"
57 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
60 #include <TColStd_MapOfInteger.hxx>
61 #include <TColStd_IndexedMapOfInteger.hxx>
65 #include <vtkIdList.h>
66 #include <vtkIntArray.h>
67 #include <vtkCellArray.h>
68 #include <vtkUnsignedCharArray.h>
69 #include <vtkUnstructuredGrid.h>
70 #include <vtkDataSetMapper.h>
71 #include <vtkProperty.h>
74 #include <qbuttongroup.h>
75 #include <qgroupbox.h>
77 #include <qlineedit.h>
78 #include <qpushbutton.h>
79 #include <qradiobutton.h>
83 #include <qwhatsthis.h>
86 #include <qcheckbox.h>
96 class TElementSimulation {
97 SalomeApp_Application* myApplication;
98 SUIT_ViewWindow* myViewWindow;
99 SVTK_ViewWindow* myVTKViewWindow;
101 SALOME_Actor* myPreviewActor;
102 vtkDataSetMapper* myMapper;
103 vtkUnstructuredGrid* myGrid;
106 TElementSimulation (SalomeApp_Application* theApplication)
108 myApplication = theApplication;
109 SUIT_ViewManager* mgr = theApplication->activeViewManager();
111 myViewWindow = mgr->getActiveView();
112 myVTKViewWindow = GetVtkViewWindow(myViewWindow);
114 myGrid = vtkUnstructuredGrid::New();
116 // Create and display actor
117 myMapper = vtkDataSetMapper::New();
118 myMapper->SetInput(myGrid);
120 myPreviewActor = SALOME_Actor::New();
121 myPreviewActor->PickableOff();
122 myPreviewActor->VisibilityOff();
123 myPreviewActor->SetMapper(myMapper);
125 vtkFloatingPointType anRGB[3];
126 vtkProperty* aProp = vtkProperty::New();
127 GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
128 aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
129 myPreviewActor->SetProperty( aProp );
132 vtkProperty* aBackProp = vtkProperty::New();
133 GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
134 aBackProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
135 myPreviewActor->SetBackfaceProperty( aBackProp );
138 myVTKViewWindow->AddActor(myPreviewActor);
141 typedef std::vector<vtkIdType> TVTKIds;
142 void SetPosition (SMESH_Actor* theActor,
144 const TVTKIds& theIds)
146 vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
147 myGrid->SetPoints(aGrid->GetPoints());
149 const int* aConn = NULL;
153 static int anIds[] = {0,2,1,3};
159 static int anIds[] = {0,3,2,1,4};
165 static int anIds[] = {0,3,2,1,4,7,6,5};
172 vtkIdList *anIds = vtkIdList::New();
175 for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
176 anIds->InsertId(i,theIds[aConn[i]]);
178 for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
179 anIds->InsertId(i,theIds[i]);
181 myGrid->InsertNextCell(theType,anIds);
190 void SetVisibility (bool theVisibility)
192 myPreviewActor->SetVisibility(theVisibility);
193 RepaintCurrentView();
197 ~TElementSimulation()
199 if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
200 myVTKViewWindow->RemoveActor(myPreviewActor);
202 myPreviewActor->Delete();
204 myMapper->RemoveAllInputs();
212 //=================================================================================
213 // function : SMESHGUI_AddMeshElementDlg()
214 // purpose : constructor
215 //=================================================================================
216 SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
218 SMDSAbs_ElementType ElementType, int nbNodes,
219 bool modal, WFlags fl)
220 : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
221 WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
222 mySMESHGUI( theModule ),
223 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
225 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
226 (SUIT_Session::session()->activeApplication());
228 mySimulation = new SMESH::TElementSimulation (anApp);
229 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
231 // verify nb nodes and type
233 myElementType = ElementType;
234 switch (ElementType) {
236 // if (myNbNodes != 3 && myNbNodes != 4)
240 // if (myNbNodes != 4 && myNbNodes != 8) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
244 myElementType = SMDSAbs_Edge;
249 if (myNbNodes == 2) {
251 myHelpFileName = "adding_nodes_and_elements_page.html#adding_edges_anchor";
253 else if (myNbNodes == 3) {
254 elemName = "TRIANGLE";
255 myHelpFileName = "adding_nodes_and_elements_page.html#adding_triangles_anchor";
257 else if (myNbNodes == 4)
258 if (myElementType == SMDSAbs_Face) {
259 elemName = "QUADRANGLE";
260 myHelpFileName = "adding_nodes_and_elements_page.html#adding_quadrangles_anchor";
264 myHelpFileName = "adding_nodes_and_elements_page.html#adding_tetrahedrons_anchor";
266 else if (myNbNodes == 8) {
268 myHelpFileName = "adding_nodes_and_elements_page.html#adding_hexahedrons_anchor";
270 else if (myElementType == SMDSAbs_Face) {
271 elemName = "POLYGON";
273 myHelpFileName = "adding_nodes_and_elements_page.html#adding_polygons_anchor";
275 else if (myElementType == SMDSAbs_Volume) {
276 myHelpFileName = "adding_nodes_and_elements_page.html#adding_polyhedrons_anchor";
279 QString iconName = tr(QString("ICON_DLG_%1").arg(elemName));
280 QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName));
281 QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName));
282 QString grBoxTitle = tr(QString("SMESH_ADD_%1").arg(elemName));
284 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", iconName));
285 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
288 setName("SMESHGUI_AddMeshElementDlg");
292 setSizeGripEnabled(TRUE);
293 SMESHGUI_AddMeshElementDlgLayout = new QGridLayout(this);
294 SMESHGUI_AddMeshElementDlgLayout->setSpacing(6);
295 SMESHGUI_AddMeshElementDlgLayout->setMargin(11);
297 /***************************************************************/
298 GroupConstructors = new QButtonGroup(this, "GroupConstructors");
299 GroupConstructors->setTitle(buttonGrTitle);
301 GroupConstructors->setExclusive(TRUE);
302 GroupConstructors->setColumnLayout(0, Qt::Vertical);
303 GroupConstructors->layout()->setSpacing(0);
304 GroupConstructors->layout()->setMargin(0);
305 GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
306 GroupConstructorsLayout->setAlignment(Qt::AlignTop);
307 GroupConstructorsLayout->setSpacing(6);
308 GroupConstructorsLayout->setMargin(11);
309 Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
310 Constructor1->setText(tr("" ));
311 Constructor1->setPixmap(image0);
312 Constructor1->setChecked(TRUE);
313 Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth()));
314 Constructor1->setMinimumSize(QSize(50, 0));
315 GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
316 QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
317 GroupConstructorsLayout->addItem(spacer, 0, 1);
318 SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupConstructors, 0, 0);
320 /***************************************************************/
321 GroupButtons = new QGroupBox(this, "GroupButtons");
322 GroupButtons->setGeometry(QRect(10, 10, 281, 48));
323 GroupButtons->setTitle(tr("" ));
324 GroupButtons->setColumnLayout(0, Qt::Vertical);
325 GroupButtons->layout()->setSpacing(0);
326 GroupButtons->layout()->setMargin(0);
327 GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
328 GroupButtonsLayout->setAlignment(Qt::AlignTop);
329 GroupButtonsLayout->setSpacing(6);
330 GroupButtonsLayout->setMargin(11);
331 buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
332 buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
333 buttonCancel->setAutoDefault(TRUE);
334 GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
335 buttonApply = new QPushButton(GroupButtons, "buttonApply");
336 buttonApply->setText(tr("SMESH_BUT_APPLY" ));
337 buttonApply->setAutoDefault(TRUE);
338 GroupButtonsLayout->addWidget(buttonApply, 0, 1);
339 QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
340 GroupButtonsLayout->addItem(spacer_9, 0, 2);
341 buttonOk = new QPushButton(GroupButtons, "buttonOk");
342 buttonOk->setText(tr("SMESH_BUT_APPLY_AND_CLOSE" ));
343 buttonOk->setAutoDefault(TRUE);
344 buttonOk->setDefault(TRUE);
345 GroupButtonsLayout->addWidget(buttonOk, 0, 0);
346 buttonHelp = new QPushButton(GroupButtons, "buttonHelp");
347 buttonHelp->setText(tr("SMESH_BUT_HELP" ));
348 buttonHelp->setAutoDefault(TRUE);
349 GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
351 SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupButtons, 2, 0);
353 /***************************************************************/
354 GroupC1 = new QGroupBox(this, "GroupC1");
355 GroupC1->setTitle(grBoxTitle);
357 GroupC1->setMinimumSize(QSize(0, 0));
358 GroupC1->setFrameShape(QGroupBox::Box);
359 GroupC1->setFrameShadow(QGroupBox::Sunken);
360 GroupC1->setColumnLayout(0, Qt::Vertical);
361 GroupC1->layout()->setSpacing(0);
362 GroupC1->layout()->setMargin(0);
363 GroupC1Layout = new QGridLayout(GroupC1->layout());
364 GroupC1Layout->setAlignment(Qt::AlignTop);
365 GroupC1Layout->setSpacing(6);
366 GroupC1Layout->setMargin(11);
367 TextLabelC1A1 = new QLabel(GroupC1, "TextLabelC1A1");
368 TextLabelC1A1->setText(tr("SMESH_ID_NODES" ));
369 TextLabelC1A1->setMinimumSize(QSize(50, 0));
370 TextLabelC1A1->setFrameShape(QLabel::NoFrame);
371 TextLabelC1A1->setFrameShadow(QLabel::Plain);
372 GroupC1Layout->addWidget(TextLabelC1A1, 0, 0);
373 SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
374 SelectButtonC1A1->setText(tr("" ));
375 SelectButtonC1A1->setPixmap(image1);
376 SelectButtonC1A1->setToggleButton(FALSE);
377 GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
378 LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
379 // LineEditC1A1->setReadOnly(TRUE);
381 LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator", myNbNodes));
382 GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
384 if (myElementType == SMDSAbs_Face) {
385 Reverse = new QCheckBox(GroupC1, "Reverse");
386 Reverse->setText(tr("SMESH_REVERSE" ));
387 GroupC1Layout->addWidget(Reverse, 1, 0);
392 SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupC1, 1, 0);
394 Init(); /* Initialisations */
397 //=================================================================================
398 // function : ~SMESHGUI_AddMeshElementDlg()
399 // purpose : Destroys the object and frees any allocated resources
400 //=================================================================================
401 SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg()
403 // no need to delete child widgets, Qt does it all for us
407 //=================================================================================
410 //=================================================================================
411 void SMESHGUI_AddMeshElementDlg::Init()
414 Constructor1->setChecked(TRUE);
415 myEditCurrentArgument = LineEditC1A1;
416 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
421 /* signals and slots connections */
422 connect(buttonOk, SIGNAL(clicked()), SLOT(ClickOnOk()));
423 connect(buttonCancel, SIGNAL(clicked()), SLOT(ClickOnCancel()));
424 connect(buttonApply, SIGNAL(clicked()), SLOT(ClickOnApply()));
425 connect(buttonHelp, SIGNAL(clicked()), SLOT(ClickOnHelp()));
427 connect(SelectButtonC1A1, SIGNAL(clicked()), SLOT(SetEditCurrentArgument()));
428 connect(LineEditC1A1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
429 connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
430 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
431 /* to close dialog if study frame change */
432 connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
435 connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)));
437 this->show(); // displays Dialog
439 // set selection mode
440 SMESH::SetPointRepresentation(true);
442 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
443 aViewWindow->SetSelectionMode( NodeSelection );
447 SelectionIntoArgument();
450 //=================================================================================
451 // function : ClickOnApply()
453 //=================================================================================
454 void SMESHGUI_AddMeshElementDlg::ClickOnApply()
456 if (myNbOkNodes && !mySMESHGUI->isActiveStudyLocked()) {
458 SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
459 anArrayOfIdeces->length(myNbNodes);
460 bool reverse = (Reverse && Reverse->isChecked());
461 QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
462 for (int i = 0; i < aListId.count(); i++)
464 anArrayOfIdeces[i] = aListId[ myNbNodes - i - 1 ].toInt();
466 anArrayOfIdeces[i] = aListId[ i ].toInt();
468 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
469 switch (myElementType) {
471 aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
474 aMeshEditor->AddPolygonalFace(anArrayOfIdeces.inout());
476 aMeshEditor->AddFace(anArrayOfIdeces.inout());
481 aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
485 SALOME_ListIO aList; aList.Append( myActor->getIO() );
486 mySelector->ClearIndex();
487 mySelectionMgr->setSelectedObjects( aList, false );
490 mySimulation->SetVisibility(false);
492 buttonOk->setEnabled(false);
493 buttonApply->setEnabled(false);
495 myEditCurrentArgument->setText("");
501 //=================================================================================
502 // function : ClickOnOk()
504 //=================================================================================
505 void SMESHGUI_AddMeshElementDlg::ClickOnOk()
507 this->ClickOnApply();
508 this->ClickOnCancel();
512 //=================================================================================
513 // function : ClickOnCancel()
515 //=================================================================================
516 void SMESHGUI_AddMeshElementDlg::ClickOnCancel()
518 //mySelectionMgr->clearSelected();
519 mySimulation->SetVisibility(false);
520 SMESH::SetPointRepresentation(false);
521 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
522 aViewWindow->SetSelectionMode( ActorSelection );
523 disconnect(mySelectionMgr, 0, this, 0);
524 mySMESHGUI->ResetState();
529 //=================================================================================
530 // function : ClickOnHelp()
532 //=================================================================================
533 void SMESHGUI_AddMeshElementDlg::ClickOnHelp()
535 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
537 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
541 platform = "winapplication";
543 platform = "application";
545 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
546 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
547 arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
548 QObject::tr("BUT_OK"));
552 //=================================================================================
553 // function : onTextChange()
555 //=================================================================================
556 void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
563 buttonOk->setEnabled(false);
564 buttonApply->setEnabled(false);
566 mySimulation->SetVisibility(false);
568 // hilight entered nodes
569 SMDS_Mesh* aMesh = 0;
571 aMesh = myActor->GetObject()->GetMesh();
574 TColStd_MapOfInteger newIndices;
576 QStringList aListId = QStringList::split(" ", theNewText, false);
578 for (int i = 0; i < aListId.count(); i++) {
579 if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
581 newIndices.Add( n->GetID() );
588 mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
589 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
590 aViewWindow->highlight( myActor->getIO(), true, true );
592 myNbOkNodes = ( allOk && myNbNodes == aListId.count() );
596 if ( !allOk || myElementType != SMDSAbs_Face || aListId.count() < 3 )
599 myNbOkNodes = aListId.count();
604 buttonOk->setEnabled(true);
605 buttonApply->setEnabled(true);
612 //=================================================================================
613 // function : SelectionIntoArgument()
614 // purpose : Called when selection has changed
615 //=================================================================================
616 void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument()
625 myEditCurrentArgument->setText("");
628 if (!GroupButtons->isEnabled()) // inactive
631 buttonOk->setEnabled(false);
632 buttonApply->setEnabled(false);
634 mySimulation->SetVisibility(false);
635 // SMESH::SetPointRepresentation(true);
639 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
641 if (aList.Extent() != 1)
644 Handle(SALOME_InteractiveObject) anIO = aList.First();
645 myMesh = SMESH::GetMeshByIO(anIO);
646 if (myMesh->_is_nil())
649 myActor = SMESH::FindActorByEntry(anIO->getEntry());
653 // get selected nodes
654 QString aString = "";
655 int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,myActor->getIO(),aString);
657 myEditCurrentArgument->setText(aString);
659 if (myIsPoly && myElementType == SMDSAbs_Face && nbNodes >= 3 ) {
661 } else if (myNbNodes != nbNodes) {
666 myNbOkNodes = nbNodes;
668 buttonOk->setEnabled(true);
669 buttonApply->setEnabled(true);
674 //=================================================================================
675 // function : displaySimulation()
677 //=================================================================================
678 void SMESHGUI_AddMeshElementDlg::displaySimulation()
680 if (myNbOkNodes && GroupButtons->isEnabled()) {
681 SMESH::TElementSimulation::TVTKIds anIds;
682 QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
683 for (int i = 0; i < aListId.count(); i++)
684 anIds.push_back(myActor->GetObject()->GetNodeVTKId(aListId[ i ].toInt()));
686 if (Reverse && Reverse->isChecked())
687 reverse(anIds.begin(),anIds.end());
691 switch ( myElementType ) {
692 case SMDSAbs_Face : aType = VTK_POLYGON; break;
697 case 2: aType = VTK_LINE; break;
698 case 3: aType = VTK_TRIANGLE; break;
699 case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
700 case 8: aType = VTK_HEXAHEDRON; break;
705 mySimulation->SetPosition(myActor,aType,anIds);
710 //=================================================================================
711 // function : SetEditCurrentArgument()
713 //=================================================================================
714 void SMESHGUI_AddMeshElementDlg::SetEditCurrentArgument()
716 QPushButton* send = (QPushButton*)sender();
717 if (send == SelectButtonC1A1) {
718 LineEditC1A1->setFocus();
719 myEditCurrentArgument = LineEditC1A1;
721 SelectionIntoArgument();
724 //=================================================================================
725 // function : DeactivateActiveDialog()
727 //=================================================================================
728 void SMESHGUI_AddMeshElementDlg::DeactivateActiveDialog()
730 if (GroupConstructors->isEnabled()) {
731 GroupConstructors->setEnabled(false);
732 GroupC1->setEnabled(false);
733 GroupButtons->setEnabled(false);
734 mySimulation->SetVisibility(false);
735 mySMESHGUI->ResetState();
736 mySMESHGUI->SetActiveDialogBox(0);
740 //=================================================================================
741 // function : ActivateThisDialog()
743 //=================================================================================
744 void SMESHGUI_AddMeshElementDlg::ActivateThisDialog()
746 /* Emit a signal to deactivate the active dialog */
747 mySMESHGUI->EmitSignalDeactivateDialog();
749 GroupConstructors->setEnabled(true);
750 GroupC1->setEnabled(true);
751 GroupButtons->setEnabled(true);
753 SMESH::SetPointRepresentation(true);
755 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
756 aViewWindow->SetSelectionMode( NodeSelection );
757 SelectionIntoArgument();
760 //=================================================================================
761 // function : enterEvent()
763 //=================================================================================
764 void SMESHGUI_AddMeshElementDlg::enterEvent (QEvent*)
766 if (GroupConstructors->isEnabled())
768 ActivateThisDialog();
772 //=================================================================================
773 // function : closeEvent()
775 //=================================================================================
776 void SMESHGUI_AddMeshElementDlg::closeEvent (QCloseEvent*)
778 /* same than click on cancel button */
779 this->ClickOnCancel();
783 //=================================================================================
784 // function : hideEvent()
785 // purpose : caused by ESC key
786 //=================================================================================
787 void SMESHGUI_AddMeshElementDlg::hideEvent (QHideEvent*)
793 //=================================================================================
794 // function : CheckBox()
796 //=================================================================================
797 void SMESHGUI_AddMeshElementDlg::CheckBox (int state)
803 mySimulation->SetVisibility(false);
808 //=================================================================================
809 // function : keyPressEvent()
811 //=================================================================================
812 void SMESHGUI_AddMeshElementDlg::keyPressEvent( QKeyEvent* e )
814 QDialog::keyPressEvent( e );
815 if ( e->isAccepted() )
818 if ( e->key() == Key_F1 )