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.salome-platform.org or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_GroupDlg.cxx
25 // Author : Natalia KOPNOVA
29 #include "SMESHGUI_GroupDlg.h"
30 #include "SMESHGUI_FilterDlg.h"
33 #include "SMESHGUI_Utils.h"
34 #include "SMESHGUI_VTKUtils.h"
35 #include "SMESHGUI_MeshUtils.h"
36 #include "SMESHGUI_GroupUtils.h"
37 #include "SMESHGUI_FilterUtils.h"
38 #include "SMESHGUI_GEOMGenUtils.h"
40 #include "SMESH_TypeFilter.hxx"
41 #include "SMESH_Actor.h"
44 #include "SUIT_Desktop.h"
45 #include "SUIT_ResourceMgr.h"
47 #include "SalomeApp_Tools.h"
48 #include "SALOMEDSClient_Study.hxx"
49 #include "SALOME_ListIO.hxx"
50 #include "SALOME_ListIteratorOfListIO.hxx"
52 #include "SVTK_ViewWindow.h"
53 #include "SVTK_Selector.h"
55 #include "utilities.h"
58 #include <TColStd_MapOfInteger.hxx>
61 #include <qbuttongroup.h>
62 #include <qgroupbox.h>
65 #include <qlineedit.h>
66 #include <qpushbutton.h>
67 #include <qradiobutton.h>
68 #include <qcheckbox.h>
73 #include <qmemarray.h>
74 #include <qwidgetstack.h>
82 //=================================================================================
83 // function : SMESHGUI_GroupDlg()
85 //=================================================================================
86 SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
87 SMESH::SMESH_Mesh_ptr theMesh, bool modal, WFlags fl)
88 : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
89 WStyle_Title | WStyle_SysMenu | WDestructiveClose),
90 mySMESHGUI( theModule ),
91 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
92 mySelector(SMESH::GetViewWindow( theModule )->GetSelector()),
96 if (!name) setName("SMESHGUI_GroupDlg");
98 if (!theMesh->_is_nil())
101 mySelectSubMesh->setEnabled(false);
102 mySelectGroup->setEnabled(false);
103 myGeomGroupBtn->setEnabled(false);
104 myGeomGroupLine->setEnabled(false);
108 /* Move widget on the botton right corner of main widget */
110 mySMESHGUI->DefineDlgPosition(this, x, y);
114 //=================================================================================
115 // function : SMESHGUI_GroupDlg()
117 //=================================================================================
118 SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
119 SMESH::SMESH_Group_ptr theGroup, bool modal, WFlags fl)
120 : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
121 WStyle_Title | WStyle_SysMenu | WDestructiveClose),
122 mySMESHGUI( theModule ),
123 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
124 mySelector(SMESH::GetViewWindow( theModule )->GetSelector()),
127 if (!name) setName("SMESHGUI_GroupDlg");
130 if (!theGroup->_is_nil())
133 mySelectSubMesh->setEnabled(false);
134 mySelectGroup->setEnabled(false);
136 myCurrentLineEdit = myMeshGroupLine;
140 /* Move widget on the botton right corner of main widget */
142 mySMESHGUI->DefineDlgPosition(this, x, y);
146 //=================================================================================
147 // function : SMESHGUI_GroupDlg()
149 //=================================================================================
150 void SMESHGUI_GroupDlg::initDialog(bool create)
154 myCurrentLineEdit = 0;
156 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
159 setCaption(tr("SMESH_CREATE_GROUP_TITLE"));
161 setCaption(tr("SMESH_EDIT_GROUP_TITLE"));
163 setSizeGripEnabled(TRUE);
165 QGridLayout* aMainLayout = new QGridLayout(this, 7, 3, 11, 6);
167 /***************************************************************/
168 QLabel* meshGroupLab = new QLabel(this, "mesh/group label");
170 meshGroupLab->setText(tr("SMESH_MESH"));
172 meshGroupLab->setText(tr("SMESH_GROUP"));
173 myMeshGroupBtn = new QPushButton(this, "mesh/group button");
174 myMeshGroupBtn->setPixmap(image0);
175 myMeshGroupLine = new QLineEdit(this, "mesh/group line");
176 myMeshGroupLine->setReadOnly(true);
178 /***************************************************************/
179 myTypeGroup = new QButtonGroup(1, Qt::Vertical, this, "Group types");
180 myTypeGroup->setTitle(tr("SMESH_ELEMENTS_TYPE"));
181 myTypeGroup->setExclusive(true);
184 types.append(tr("MESH_NODE"));
185 types.append(tr("SMESH_EDGE"));
186 types.append(tr("SMESH_FACE"));
187 types.append(tr("SMESH_VOLUME"));
189 for (int i = 0; i < types.count(); i++) {
190 rb = new QRadioButton(types[i], myTypeGroup);
192 myTypeGroup->setEnabled(create);
195 /***************************************************************/
196 QLabel* aName = new QLabel(this, "name label");
197 aName->setText(tr("SMESH_NAME"));
198 aName->setMinimumSize(50,0);
199 myName = new QLineEdit(this, "name");
201 /***************************************************************/
202 myGrpTypeGroup = new QButtonGroup(1, Qt::Vertical, this, "Type of group");
203 myGrpTypeGroup->setTitle(tr("SMESH_GROUP_TYPE"));
204 myGrpTypeGroup->setExclusive(true);
205 QRadioButton* rb1 = new QRadioButton( tr("SMESH_GROUP_STANDALONE"), myGrpTypeGroup);
206 QRadioButton* rb2 = new QRadioButton( tr("SMESH_GROUP_GEOMETRY"), myGrpTypeGroup);
207 myGrpTypeGroup->setEnabled(create);
210 /***************************************************************/
211 myWGStack = new QWidgetStack( this, "widget stack");
212 QWidget* wg1 = new QFrame( myWGStack, "first widget" );
213 QWidget* wg2 = new QFrame( myWGStack, "second widget" );
215 /***************************************************************/
216 QGroupBox* aContentBox = new QGroupBox(1, Qt::Horizontal, wg1, "content box");
217 aContentBox->setTitle(tr("SMESH_CONTENT"));
218 QFrame* aContent = new QFrame(aContentBox, "content");
219 QGridLayout* aLayout = new QGridLayout(aContent, 7, 4);
220 aLayout->setSpacing(6);
221 aLayout->setAutoAdd(false);
223 QLabel* aLabel = new QLabel(aContent, "elements label");
224 aLabel->setText(tr("SMESH_ID_ELEMENTS"));
225 myElements = new QListBox(aContent, "elements list");
226 myElements->setSelectionMode(QListBox::Extended);
228 myFilter = new QPushButton(aContent, "filter");
229 myFilter->setText(tr("SMESH_BUT_FILTER"));
230 QPushButton* aAddBtn = new QPushButton(aContent, "add");
231 aAddBtn->setText(tr("SMESH_BUT_ADD"));
232 QPushButton* aRemoveBtn = new QPushButton(aContent, "remove");
233 aRemoveBtn->setText(tr("SMESH_BUT_REMOVE"));
234 QPushButton* aSortBtn = new QPushButton(aContent, "sort");
235 aSortBtn->setText(tr("SMESH_BUT_SORT"));
237 aLayout->addWidget(aLabel, 0, 0);
238 aLayout->addMultiCellWidget(myElements, 1, 6, 0, 0);
239 aLayout->addWidget(myFilter, 1, 2);
240 aLayout->addWidget(aAddBtn, 3, 2);
241 aLayout->addWidget(aRemoveBtn, 4, 2);
242 aLayout->addWidget(aSortBtn, 6, 2);
244 aLayout->setColStretch(0, 1);
245 aLayout->addColSpacing(1, 20);
246 aLayout->addColSpacing(3, 20);
247 aLayout->setRowStretch(2, 1);
248 aLayout->setRowStretch(5, 1);
250 /***************************************************************/
251 QGroupBox* aSelectBox = new QGroupBox(3, Qt::Horizontal, wg1, "select box");
252 aSelectBox->setTitle(tr("SMESH_SELECT_FROM"));
254 mySelectSubMesh = new QCheckBox(aSelectBox, "submesh checkbox");
255 mySelectSubMesh->setText(tr("SMESH_SUBMESH"));
256 mySelectSubMesh->setMinimumSize(50, 0);
257 mySubMeshBtn = new QPushButton(aSelectBox, "submesh button");
258 mySubMeshBtn->setText("");
259 mySubMeshBtn->setPixmap(image0);
260 mySubMeshLine = new QLineEdit(aSelectBox, "submesh line");
261 mySubMeshLine->setReadOnly(true);
262 onSelectSubMesh(false);
264 mySelectGroup = new QCheckBox(aSelectBox, "group checkbox");
265 mySelectGroup->setText(tr("SMESH_GROUP"));
266 mySelectGroup->setMinimumSize(50, 0);
267 myGroupBtn = new QPushButton(aSelectBox, "group button");
268 myGroupBtn->setText("");
269 myGroupBtn->setPixmap(image0);
270 myGroupLine = new QLineEdit(aSelectBox, "group line");
271 myGroupLine->setReadOnly(true);
272 onSelectGroup(false);
274 /***************************************************************/
275 QGridLayout* wg1Layout = new QGridLayout( wg1, 3, 1, 0, 6 );
276 wg1Layout->addWidget(aContentBox, 0, 0);
277 wg1Layout->addWidget(aSelectBox, 1, 0);
278 wg1Layout->setRowStretch(2, 5);
280 /***************************************************************/
281 QLabel* geomObject = new QLabel(wg2, "geometry object label");
282 geomObject->setText(tr("SMESH_OBJECT_GEOM"));
283 myGeomGroupBtn = new QPushButton(wg2, "geometry group button");
284 myGeomGroupBtn->setText("");
285 myGeomGroupBtn->setPixmap(image0);
286 myGeomGroupLine = new QLineEdit(wg2, "geometry group line");
287 myGeomGroupLine->setReadOnly(true); //VSR ???
288 onSelectGeomGroup(false);
290 /***************************************************************/
291 QGridLayout* wg2Layout = new QGridLayout( wg2, 2, 3, 0, 6 );
292 wg2Layout->addWidget(geomObject, 0, 0);
293 wg2Layout->addWidget(myGeomGroupBtn, 0, 1);
294 wg2Layout->addWidget(myGeomGroupLine,0, 2);
295 wg2Layout->setRowStretch(1, 5);
297 /***************************************************************/
298 QVBoxLayout* dumb = new QVBoxLayout(myWGStack);
299 dumb->addWidget(wg1);
300 dumb->addWidget(wg2);
301 myWGStack->addWidget( wg1, myGrpTypeGroup->id(rb1) );
302 myWGStack->addWidget( wg2, myGrpTypeGroup->id(rb2) );
304 /***************************************************************/
305 QFrame* aButtons = new QFrame(this, "button box");
306 aButtons->setFrameStyle(QFrame::Box | QFrame::Sunken);
307 QHBoxLayout* aBtnLayout = new QHBoxLayout(aButtons, 11, 6);
308 aBtnLayout->setAutoAdd(false);
310 QPushButton* aOKBtn = new QPushButton(aButtons, "ok");
311 aOKBtn->setText(tr("SMESH_BUT_OK"));
312 aOKBtn->setAutoDefault(true);
313 aOKBtn->setDefault(true);
314 QPushButton* aApplyBtn = new QPushButton(aButtons, "apply");
315 aApplyBtn->setText(tr("SMESH_BUT_APPLY"));
316 aApplyBtn->setAutoDefault(true);
317 QPushButton* aCloseBtn = new QPushButton(aButtons, "close");
318 aCloseBtn->setText(tr("SMESH_BUT_CLOSE"));
319 aCloseBtn->setAutoDefault(true);
321 aBtnLayout->addWidget(aOKBtn);
322 aBtnLayout->addWidget(aApplyBtn);
323 aBtnLayout->addStretch();
324 aBtnLayout->addWidget(aCloseBtn);
326 /***************************************************************/
327 aMainLayout->addWidget(meshGroupLab, 0, 0);
328 aMainLayout->addWidget(myMeshGroupBtn, 0, 1);
329 aMainLayout->addWidget(myMeshGroupLine, 0, 2);
330 aMainLayout->addMultiCellWidget(myTypeGroup, 1, 1, 0, 2);
331 aMainLayout->addWidget(aName, 2, 0);
332 aMainLayout->addWidget(myName, 2, 2);
333 aMainLayout->addMultiCellWidget(myGrpTypeGroup, 3, 3, 0, 2);
334 aMainLayout->addMultiCellWidget(myWGStack, 4, 4, 0, 2);
335 aMainLayout->setRowStretch( 5, 5 );
336 aMainLayout->addMultiCellWidget(aButtons, 6, 6, 0, 2);
338 /* signals and slots connections */
339 connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
341 connect(myGrpTypeGroup, SIGNAL(clicked(int)), this, SLOT(onGrpTypeChanged(int)));
343 connect(myTypeGroup, SIGNAL(clicked(int)), this, SLOT(onTypeChanged(int)));
345 connect(myName, SIGNAL(textChanged(const QString&)), this, SLOT(onNameChanged(const QString&)));
346 connect(myElements, SIGNAL(selectionChanged()), this, SLOT(onListSelectionChanged()));
348 connect(myFilter, SIGNAL(clicked()), this, SLOT(setFilters()));
349 connect(aAddBtn, SIGNAL(clicked()), this, SLOT(onAdd()));
350 connect(aRemoveBtn, SIGNAL(clicked()), this, SLOT(onRemove()));
351 connect(aSortBtn, SIGNAL(clicked()), this, SLOT(onSort()));
353 connect(mySelectSubMesh, SIGNAL(toggled(bool)), this, SLOT(onSelectSubMesh(bool)));
354 connect(mySelectGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectGroup(bool)));
355 connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
356 connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
357 connect(myGeomGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
359 connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
360 connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
361 connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(onClose()));
364 mySMESHGUI->SetActiveDialogBox(this);
365 mySMESHGUI->SetState(800);
367 mySelectionMode = -1;
368 myMeshFilter = new SMESH_TypeFilter(MESH);
369 mySubMeshFilter = new SMESH_TypeFilter(SUBMESH);
370 myGroupFilter = new SMESH_TypeFilter(GROUP);
372 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
373 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose()));
374 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
376 myGrpTypeGroup->setButton(myGrpTypeGroup->id(rb1)); // VSR !!!
377 onGrpTypeChanged(myGrpTypeGroup->id(rb1)); // VSR!!!
379 if (myMesh->_is_nil() )
380 myTypeGroup->setButton(0);
385 //=================================================================================
386 // function : ~SMESHGUI_GroupDlg()
387 // purpose : Destroys the object and frees any allocated resources
388 //=================================================================================
389 SMESHGUI_GroupDlg::~SMESHGUI_GroupDlg()
391 // no need to delete child widgets, Qt does it all for us
392 if ( myFilterDlg != 0 )
394 myFilterDlg->reparent( 0, QPoint() );
399 //=================================================================================
402 //=================================================================================
403 void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
405 mySelectionMgr->installFilter(myMeshFilter);
407 /* init data from current selection */
408 myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
409 myGroup = SMESH::SMESH_Group::_nil();
411 myActor = SMESH::FindActorByObject(myMesh);
412 SMESH::SetPickable(myActor);
415 mySelectionMgr->selectedObjects( aList );
416 if( !aList.IsEmpty() )
418 QString aName = aList.First()->getName();
419 myMeshGroupLine->setText(aName) ;
420 myMeshGroupLine->home( false );
423 myCurrentLineEdit = 0;
425 myTypeGroup->setButton(0);
429 //=================================================================================
432 //=================================================================================
433 void SMESHGUI_GroupDlg::init (SMESH::SMESH_Group_ptr theGroup)
435 myMesh = theGroup->GetMesh();
436 myGroup = SMESH::SMESH_Group::_duplicate(theGroup);
438 myActor = SMESH::FindActorByObject(myMesh);
440 myActor = SMESH::FindActorByObject(myGroup);
441 SMESH::SetPickable(myActor);
444 switch(theGroup->GetType()) {
445 case SMESH::NODE: aType= 0; break;
446 case SMESH::EDGE: aType = 1; break;
447 case SMESH::FACE: aType = 2; break;
448 case SMESH::VOLUME: aType = 3; break;
451 myName->setText(myGroup->GetName());
453 myMeshGroupLine->setText(myGroup->GetName());
455 myCurrentLineEdit = 0;
456 myTypeGroup->setButton(aType);
458 setSelectionMode(aType);
462 if (!theGroup->IsEmpty()) {
463 SMESH::long_array_var anElements = myGroup->GetListOfID();
464 int k = anElements->length();
465 for (int i = 0; i < k; i++) {
466 myIdList.append(anElements[i]);
467 myElements->insertItem(QString::number(anElements[i]));
469 myElements->selectAll(true);
473 //=================================================================================
474 // function : updateButtons()
476 //=================================================================================
477 void SMESHGUI_GroupDlg::updateButtons()
481 if (myGrpTypeId == 0)
482 enable = !myName->text().stripWhiteSpace().isEmpty() && myElements->count() > 0;
483 else if (myGrpTypeId == 1)
484 enable = !myName->text().stripWhiteSpace().isEmpty() && !CORBA::is_nil( myGeomGroup );
486 aBtn = (QPushButton*) child("ok", "QPushButton");
487 if (aBtn) aBtn->setEnabled(enable);
488 aBtn = (QPushButton*) child("apply", "QPushButton");
489 if (aBtn) aBtn->setEnabled(enable);
492 //=================================================================================
493 // function : onNameChanged()
495 //=================================================================================
496 void SMESHGUI_GroupDlg::onNameChanged (const QString& text)
501 //=================================================================================
502 // function : onTypeChanged()
503 // purpose : Group elements type radio button management
504 //=================================================================================
505 void SMESHGUI_GroupDlg::onTypeChanged (int id)
507 if (myTypeId != id) {
509 if (myCurrentLineEdit == 0)
510 setSelectionMode(id);
515 //=================================================================================
516 // function : onGrpTypeChanged()
517 // purpose : Group type radio button management
518 //=================================================================================
519 void SMESHGUI_GroupDlg::onGrpTypeChanged (int id)
521 if (myGrpTypeId != id) {
522 myWGStack->raiseWidget( id );
523 onSelectGeomGroup(id == 1);
528 //=================================================================================
529 // function : setSelectionMode()
530 // purpose : Radio button management
531 //=================================================================================
532 void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
535 if (myMesh->_is_nil())
538 if (mySelectionMode != theMode) {
539 // [PAL10408] mySelectionMgr->clearSelected();
540 mySelectionMgr->clearFilters();
541 SMESH::SetPointRepresentation(false);
546 myActor->SetPointRepresentation(true);
548 SMESH::SetPointRepresentation(true);
549 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
550 aViewWindow->SetSelectionMode(NodeSelection);
553 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
554 aViewWindow->SetSelectionMode(EdgeSelection);
557 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
558 aViewWindow->SetSelectionMode(FaceSelection);
561 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
562 aViewWindow->SetSelectionMode(VolumeSelection);
566 mySelectionMgr->installFilter(mySubMeshFilter);
567 else if (theMode == 5)
568 mySelectionMgr->installFilter(myGroupFilter);
569 else if (theMode == 6)
570 mySelectionMgr->installFilter(myMeshFilter);
571 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
572 aViewWindow->SetSelectionMode(ActorSelection);
574 mySelectionMode = theMode;
578 //=================================================================================
579 // function : onApply()
581 //=================================================================================
582 bool SMESHGUI_GroupDlg::onApply()
584 if (mySMESHGUI->isActiveStudyLocked())
587 if (myGrpTypeId == 0 &&
588 !myName->text().stripWhiteSpace().isEmpty() &&
589 myElements->count() > 0) {
590 mySelectionMgr->clearSelected();
591 if (myGroup->_is_nil()) {
592 SMESH::ElementType aType = SMESH::ALL;
594 case 0: aType = SMESH::NODE; break;
595 case 1: aType = SMESH::EDGE; break;
596 case 2: aType = SMESH::FACE; break;
597 case 3: aType = SMESH::VOLUME; break;
599 SMESH::long_array_var anIdList = new SMESH::long_array;
600 int i, k = myElements->count();
602 QListBoxItem* anItem;
603 for (i = 0, anItem = myElements->firstItem(); anItem != 0; i++, anItem = anItem->next()) {
604 anIdList[i] = anItem->text().toInt();
607 myGroup = SMESH::AddGroup(myMesh, aType, myName->text());
608 myGroup->Add(anIdList.inout());
610 /* init for next operation */
613 myGroup = SMESH::SMESH_Group::_nil();
616 myGroup->SetName(myName->text());
618 QValueList<int> aAddList;
619 QValueList<int>::iterator anIt;
620 QListBoxItem* anItem;
622 for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next()) {
623 int anId = anItem->text().toInt();
624 if ((anIt = myIdList.find(anId)) == myIdList.end())
625 aAddList.append(anId);
627 myIdList.remove(anIt);
629 if (!aAddList.empty()) {
630 SMESH::long_array_var anIdList = new SMESH::long_array;
631 anIdList->length(aAddList.count());
633 for (i = 0, anIt = aAddList.begin(); anIt != aAddList.end(); anIt++, i++)
635 myGroup->Add(anIdList.inout());
637 if (!myIdList.empty()) {
638 SMESH::long_array_var anIdList = new SMESH::long_array;
639 anIdList->length(myIdList.count());
641 for (i = 0, anIt = myIdList.begin(); anIt != myIdList.end(); anIt++, i++)
643 myGroup->Remove(anIdList.inout());
645 /* init for next operation */
647 for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next())
648 myIdList.append(anItem->text().toInt());
651 mySMESHGUI->updateObjBrowser(true);
652 SMESH::UpdateView(); // asv: fix of BUG PAL5515
653 mySelectionMgr->clearSelected();
655 } else if (myGrpTypeId == 1 &&
656 !myName->text().stripWhiteSpace().isEmpty() &&
657 !CORBA::is_nil(myGeomGroup))
659 SMESH::ElementType aType = SMESH::ALL;
661 case 0: aType = SMESH::NODE; break;
662 case 1: aType = SMESH::EDGE; break;
663 case 2: aType = SMESH::FACE; break;
664 case 3: aType = SMESH::VOLUME; break;
667 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
668 GEOM::GEOM_IGroupOperations_var aGroupOp =
669 SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
671 SMESH::SMESH_GroupOnGeom_var aGroupOnGeom =
672 myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup);
674 mySMESHGUI->updateObjBrowser(true);
675 mySelectionMgr->clearSelected();
676 /* init for next operation */
684 //=================================================================================
687 //=================================================================================
688 void SMESHGUI_GroupDlg::onOK()
694 //=================================================================================
695 // function : onListSelectionChanged()
696 // purpose : Called when selection in element list is changed
697 //=================================================================================
698 void SMESHGUI_GroupDlg::onListSelectionChanged()
700 // MESSAGE("SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor);
701 if( myIsBusy || !myActor) return;
704 if (myCurrentLineEdit == 0) {
705 mySelectionMgr->clearSelected();
706 TColStd_MapOfInteger aIndexes;
707 QListBoxItem* anItem;
708 for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next()) {
709 if (anItem->isSelected()) {
710 int anId = anItem->text().toInt();
714 mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, false);
716 aList.Append(myActor->getIO());
717 mySelectionMgr->setSelectedObjects(aList,false);
722 //=================================================================================
723 // function : onObjectSelectionChanged()
724 // purpose : Called when selection in 3D view or ObjectBrowser is changed
725 //=================================================================================
726 void SMESHGUI_GroupDlg::onObjectSelectionChanged()
728 if ( myIsBusy || !isEnabled()) return;
732 mySelectionMgr->selectedObjects( aList );
734 int aNbSel = aList.Extent();
735 myElements->clearSelection();
737 if (myCurrentLineEdit) {
738 myCurrentLineEdit->setText("");
739 QString aString = "";
741 if (myCurrentLineEdit == myMeshGroupLine) {
742 mySelectSubMesh->setEnabled(false);
743 mySelectGroup->setEnabled(false);
744 myGroupLine->setText("");
745 mySubMeshLine->setText("");
747 myGeomGroupBtn->setEnabled(false);
748 myGeomGroupLine->setEnabled(false);
749 myGeomGroupLine->setText("");
756 myGroup = SMESH::SMESH_Group::_nil();
757 myMesh = SMESH::SMESH_Mesh::_nil();
761 Handle(SALOME_InteractiveObject) IO = aList.First();
764 myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
765 if (myMesh->_is_nil())
770 myGroup = SMESH::SMESH_Group::_nil();
772 myActor = SMESH::FindActorByObject(myMesh);
773 SMESH::SetPickable(myActor);
775 aString = aList.First()->getName();
776 myMeshGroupLine->setText(aString) ;
777 myMeshGroupLine->home( false );
779 mySelectSubMesh->setEnabled(true);
780 mySelectGroup->setEnabled(true);
781 myGeomGroupBtn->setEnabled(true);
782 myGeomGroupLine->setEnabled(true);
785 SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IO);
786 if (aGroup->_is_nil())
792 myCurrentLineEdit = 0;
795 mySelectSubMesh->setEnabled(true);
796 mySelectGroup->setEnabled(true);
797 myGeomGroupBtn->setEnabled(true);
798 myGeomGroupLine->setEnabled(true);
800 myCurrentLineEdit = 0;
809 setSelectionMode(myTypeId);
815 } else if (myCurrentLineEdit == myGeomGroupLine) {
817 myGeomGroup = GEOM::GEOM_Object::_nil();
822 Standard_Boolean testResult = Standard_False;
823 myGeomGroup = GEOMBase::ConvertIOinGEOMObject(aList.First(), testResult);
825 // Check if the object is a geometry group
826 if (!testResult || CORBA::is_nil(myGeomGroup)) {
827 myGeomGroup = GEOM::GEOM_Object::_nil();
831 // Check if group constructed on the same shape as a mesh or on its child
832 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
833 GEOM::GEOM_IGroupOperations_var anOp =
834 SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
836 // The main shape of the group
837 GEOM::GEOM_Object_var aGroupMainShape;
838 if (myGeomGroup->GetType() == 37)
839 aGroupMainShape = anOp->GetMainShape(myGeomGroup);
841 aGroupMainShape = GEOM::GEOM_Object::_duplicate(myGeomGroup);
842 _PTR(SObject) aGroupMainShapeSO =
843 //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape));
844 aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
847 _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
849 myGeomGroup = GEOM::GEOM_Object::_nil();
853 _PTR(SObject) anObj, aRef;
854 bool isRefOrSubShape = false;
855 if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) {
856 //if (strcmp(aRef->GetID(), aGroupMainShapeSO->GetID()) == 0) {
857 if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
858 isRefOrSubShape = true;
860 _PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
861 _PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
862 //while (!isRefOrSubShape && strcmp(aFather->GetID(), aComponent->GetID()) != 0) {
863 while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
864 //if (strcmp(aRef->GetID(), aFather->GetID()) == 0)
865 if (aRef->GetID() == aFather->GetID())
866 isRefOrSubShape = true;
868 aFather = aFather->GetFather();
872 if (!isRefOrSubShape) {
873 myGeomGroup = GEOM::GEOM_Object::_nil();
881 if(myCurrentLineEdit == mySubMeshLine)
882 aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel);
883 else if(myCurrentLineEdit == myGroupLine || myCurrentLineEdit == myGeomGroupLine)
884 aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel);
886 aString = aList.First()->getName();
890 myCurrentLineEdit->setText(aString);
891 myCurrentLineEdit->home(false);
896 if (aNbSel == 1 && myActor ) {
897 QString aListStr = "";
900 aNbItems = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
902 aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr);
905 QStringList anElements = QStringList::split(" ", aListStr);
906 QListBoxItem* anItem = 0;
907 for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
908 anItem = myElements->findItem(*it, Qt::ExactMatch);
909 if (anItem) myElements->setSelected(anItem, true);
916 if (!myGroup->_is_nil())
917 myActor = SMESH::FindActorByObject(myGroup);
919 myActor = SMESH::FindActorByObject(myMesh);
925 //=================================================================================
926 // function : onSelectSubMesh()
927 // purpose : Called when selection in 3D view or ObjectBrowser is changed
928 //=================================================================================
929 void SMESHGUI_GroupDlg::onSelectSubMesh(bool on)
932 if (mySelectGroup->isChecked()) {
933 mySelectGroup->setChecked(false);
935 //VSR: else if (mySelectGeomGroup->isChecked()) {
936 //VSR: mySelectGeomGroup->setChecked(false);
938 myCurrentLineEdit = mySubMeshLine;
942 mySubMeshLine->setText("");
943 myCurrentLineEdit = 0;
945 setSelectionMode(myTypeId);
947 mySubMeshBtn->setEnabled(on);
948 mySubMeshLine->setEnabled(on);
952 //=================================================================================
953 // function : (onSelectGroup)
954 // purpose : Called when selection in 3D view or ObjectBrowser is changed
955 //=================================================================================
956 void SMESHGUI_GroupDlg::onSelectGroup(bool on)
959 if (mySelectSubMesh->isChecked()) {
960 mySelectSubMesh->setChecked(false);
962 myCurrentLineEdit = myGroupLine;
966 myGroupLine->setText("");
967 myCurrentLineEdit = 0;
969 setSelectionMode(myTypeId);
971 myGroupBtn->setEnabled(on);
972 myGroupLine->setEnabled(on);
976 //=================================================================================
977 // function : (onSelectGeomGroup)
978 // purpose : Called when selection in 3D view or ObjectBrowser is changed
979 //=================================================================================
980 void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on)
983 if (mySelectSubMesh->isChecked()) {
984 mySelectSubMesh->setChecked(false);
986 else if (mySelectGroup->isChecked()) {
987 mySelectGroup->setChecked(false);
989 myCurrentLineEdit = myGeomGroupLine;
993 myGeomGroupLine->setText("");
994 myCurrentLineEdit = 0;
996 setSelectionMode(myTypeId);
1001 //=================================================================================
1002 // function : setCurrentSelection()
1004 //=================================================================================
1005 void SMESHGUI_GroupDlg::setCurrentSelection()
1007 QPushButton* send = (QPushButton*)sender();
1008 myCurrentLineEdit = 0;
1009 if (send == myMeshGroupBtn) {
1010 myCurrentLineEdit = myMeshGroupLine;
1012 setSelectionMode(6);
1014 setSelectionMode(5);
1015 onObjectSelectionChanged();
1017 else if (send == mySubMeshBtn) {
1018 myCurrentLineEdit = mySubMeshLine;
1019 onObjectSelectionChanged();
1021 else if (send == myGroupBtn) {
1022 myCurrentLineEdit = myGroupLine;
1023 onObjectSelectionChanged();
1025 else if (send == myGeomGroupBtn) {
1026 myCurrentLineEdit = myGeomGroupLine;
1027 setSelectionMode(7);
1028 onObjectSelectionChanged();
1033 //=================================================================================
1034 // function : setFilters()
1035 // purpose : SLOT. Called when "Filter" button pressed.
1036 //=================================================================================
1037 void SMESHGUI_GroupDlg::setFilters()
1039 SMESH::ElementType aType = SMESH::ALL;
1042 case 0 : aType = SMESH::NODE; break;
1043 case 1 : aType = SMESH::EDGE; break;
1044 case 2 : aType = SMESH::FACE; break;
1045 case 3 : aType = SMESH::VOLUME; break;
1049 if ( myFilterDlg == 0 )
1051 myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, aType );
1052 connect( myFilterDlg, SIGNAL( Accepted() ), SLOT( onFilterAccepted() ) );
1055 myFilterDlg->Init( aType );
1057 myFilterDlg->SetSelection();
1058 myFilterDlg->SetMesh( myMesh );
1059 myFilterDlg->SetSourceWg( myElements );
1061 myFilterDlg->show();
1064 //=================================================================================
1065 // function : onFilterAccepted()
1066 // purpose : SLOT. Called when Filter dlg closed with OK button.
1067 // Uncheck "Select submesh" and "Select group" checkboxes
1068 //=================================================================================
1069 void SMESHGUI_GroupDlg::onFilterAccepted()
1071 if ( mySelectSubMesh->isChecked() || mySelectGroup->isChecked() )
1073 mySelectionMode = myTypeId;
1074 mySelectSubMesh->setChecked( false );
1075 mySelectGroup->setChecked( false );
1079 //=================================================================================
1080 // function : onAdd()
1082 //=================================================================================
1083 void SMESHGUI_GroupDlg::onAdd()
1085 SALOME_ListIO aList;
1086 mySelectionMgr->selectedObjects( aList );
1088 int aNbSel = aList.Extent();
1090 if (aNbSel == 0 || !myActor || myMesh->_is_nil()) return;
1094 SMESH::ElementType aType = SMESH::ALL;
1097 aType = SMESH::NODE;
1098 mySelector->SetSelectionMode(NodeSelection);
1101 aType = SMESH::EDGE;
1102 mySelector->SetSelectionMode(EdgeSelection);
1105 aType = SMESH::FACE;
1106 mySelector->SetSelectionMode(FaceSelection);
1109 aType = SMESH::VOLUME;
1110 mySelector->SetSelectionMode(VolumeSelection);
1113 mySelector->SetSelectionMode(ActorSelection);
1117 if (myCurrentLineEdit == 0) {
1118 //if (aNbSel != 1) { myIsBusy = false; return; }
1119 QString aListStr = "";
1121 if (myTypeId == 0) {
1122 aNbItems = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
1125 aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr);
1128 QStringList anElements = QStringList::split(" ", aListStr);
1129 QListBoxItem* anItem = 0;
1130 for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
1131 anItem = myElements->findItem(*it, Qt::ExactMatch);
1133 anItem = new QListBoxText(*it);
1134 myElements->insertItem(anItem);
1136 myElements->setSelected(anItem, true);
1139 } else if (myCurrentLineEdit == mySubMeshLine) {
1140 //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
1142 SALOME_ListIO aList;
1143 mySelectionMgr->selectedObjects( aList );
1145 SALOME_ListIteratorOfListIO anIt (aList);
1146 for (; anIt.More(); anIt.Next()) {
1147 SMESH::SMESH_subMesh_var aSubMesh =
1148 SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
1149 if (!aSubMesh->_is_nil()) {
1150 // check if mesh is the same
1151 if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
1153 SMESH::long_array_var anElements = aSubMesh->GetElementsByType(aType);
1154 int k = anElements->length();
1155 QListBoxItem* anItem = 0;
1156 for (int i = 0; i < k; i++) {
1157 QString aText = QString::number(anElements[i]);
1158 anItem = myElements->findItem(aText, Qt::ExactMatch);
1160 anItem = new QListBoxText(aText);
1161 myElements->insertItem(anItem);
1163 myElements->setSelected(anItem, true);
1166 catch (const SALOME::SALOME_Exception& ex) {
1167 SalomeApp_Tools::QtCatchCorbaException(ex);
1172 mySelectSubMesh->setChecked(false);
1174 onListSelectionChanged();
1176 } else if (myCurrentLineEdit == myGroupLine) {
1177 //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
1178 SALOME_ListIO aList;
1179 mySelectionMgr->selectedObjects( aList );
1181 SALOME_ListIteratorOfListIO anIt (aList);
1182 for (; anIt.More(); anIt.Next()) {
1183 SMESH::SMESH_Group_var aGroup =
1184 SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
1185 if (!aGroup->_is_nil()) {
1186 // check if mesh is the same
1187 if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
1188 SMESH::long_array_var anElements = aGroup->GetListOfID();
1189 int k = anElements->length();
1190 QListBoxItem* anItem = 0;
1191 for (int i = 0; i < k; i++) {
1192 QString aText = QString::number(anElements[i]);
1193 anItem = myElements->findItem(aText, Qt::ExactMatch);
1195 anItem = new QListBoxText(aText);
1196 myElements->insertItem(anItem);
1198 myElements->setSelected(anItem, true);
1203 mySelectGroup->setChecked(false);
1205 onListSelectionChanged();
1207 } else if (myCurrentLineEdit == myGeomGroupLine && !CORBA::is_nil(myGeomGroup)) {
1208 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1209 GEOM::GEOM_IGroupOperations_var aGroupOp =
1210 SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
1212 SMESH::ElementType aGroupType = SMESH::ALL;
1213 switch(aGroupOp->GetType(myGeomGroup)) {
1214 case 7: aGroupType = SMESH::NODE; break;
1215 case 6: aGroupType = SMESH::EDGE; break;
1216 case 4: aGroupType = SMESH::FACE; break;
1217 case 2: aGroupType = SMESH::VOLUME; break;
1218 default: myIsBusy = false; return;
1221 if (aGroupType == aType) {
1222 _PTR(SObject) aGroupSO =
1223 //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(myGeomGroup));
1224 aStudy->FindObjectID(myGeomGroup->GetStudyEntry());
1226 SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
1227 SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
1228 SMESH::BelongToGeom_var aBelongToGeom = aFilterMgr->CreateBelongToGeom();;
1229 aBelongToGeom->SetGeom(myGeomGroup);
1230 aBelongToGeom->SetShapeName(aGroupSO->GetName().c_str());
1231 aBelongToGeom->SetElementType(aType);
1232 aFilter->SetPredicate(aBelongToGeom);
1234 SMESH::long_array_var anElements = aFilter->GetElementsId(myMesh);
1236 int k = anElements->length();
1237 QListBoxItem* anItem = 0;
1238 for (int i = 0; i < k; i++) {
1239 QString aText = QString::number(anElements[i]);
1240 anItem = myElements->findItem(aText, Qt::ExactMatch);
1242 anItem = new QListBoxText(aText);
1243 myElements->insertItem(anItem);
1245 myElements->setSelected(anItem, true);
1249 //VSR: mySelectGeomGroup->setChecked(false);
1251 onListSelectionChanged();
1254 // mySelectionMgr->clearSelected();
1258 //=================================================================================
1259 // function : onRemove()
1261 //=================================================================================
1262 void SMESHGUI_GroupDlg::onRemove()
1265 if (myCurrentLineEdit == 0) {
1266 for (int i = myElements->count(); i > 0; i--) {
1267 if (myElements->isSelected(i-1)) {
1268 myElements->removeItem(i-1);
1272 SALOME_ListIO aList;
1273 mySelectionMgr->selectedObjects( aList );
1275 int aNbSel = aList.Extent();
1277 if (aNbSel == 0) { myIsBusy = false; return; }
1279 SMESH::ElementType aType = SMESH::ALL;
1281 case 0: aType = SMESH::NODE; break;
1282 case 1: aType = SMESH::EDGE; break;
1283 case 2: aType = SMESH::FACE; break;
1284 case 3: aType = SMESH::VOLUME; break;
1287 if (myCurrentLineEdit == mySubMeshLine) {
1288 //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
1289 SALOME_ListIO aList;
1290 mySelectionMgr->selectedObjects( aList );
1292 SALOME_ListIteratorOfListIO anIt (aList);
1293 for (; anIt.More(); anIt.Next()) {
1294 SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
1295 if (!aSubMesh->_is_nil()) {
1296 // check if mesh is the same
1297 if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
1298 if (aType == SMESH::NODE) {
1300 SMESH::long_array_var anElements = aSubMesh->GetNodesId();
1301 int k = anElements->length();
1302 QListBoxItem* anItem = 0;
1303 for (int i = 0; i < k; i++) {
1304 anItem = myElements->findItem(QString::number(anElements[i]), Qt::ExactMatch);
1305 if (anItem) delete anItem;
1308 catch (const SALOME::SALOME_Exception& ex) {
1309 SalomeApp_Tools::QtCatchCorbaException(ex);
1314 SMESH::long_array_var anElements = aSubMesh->GetElementsId();
1315 int k = anElements->length();
1316 QListBoxItem* anItem = 0;
1317 for (int i = 0; i < k; i++) {
1318 anItem = myElements->findItem(QString::number(anElements[i]), Qt::ExactMatch);
1319 if (anItem) delete anItem;
1322 catch (const SALOME::SALOME_Exception& ex) {
1323 SalomeApp_Tools::QtCatchCorbaException(ex);
1330 else if (myCurrentLineEdit == myGroupLine) {
1331 Standard_Boolean aRes;
1332 //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
1333 SALOME_ListIO aList;
1334 mySelectionMgr->selectedObjects( aList );
1336 SALOME_ListIteratorOfListIO anIt (aList);
1337 for (; anIt.More(); anIt.Next()) {
1338 SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
1339 if (aRes && !aGroup->_is_nil()) {
1340 // check if mesh is the same
1341 if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
1342 SMESH::long_array_var anElements = aGroup->GetListOfID();
1343 int k = anElements->length();
1344 QListBoxItem* anItem = 0;
1345 for (int i = 0; i < k; i++) {
1346 anItem = myElements->findItem(QString::number(anElements[i]), Qt::ExactMatch);
1347 if (anItem) delete anItem;
1358 //=================================================================================
1359 // function : onSort()
1361 //=================================================================================
1362 void SMESHGUI_GroupDlg::onSort()
1364 // PAL5412: sorts items in ascending by "string" value
1365 // myElements->sort(true);
1366 // myElements->update();
1367 int i, k = myElements->count();
1370 QStringList aSelected;
1371 std::vector<int> anArray(k);
1372 // QMemArray<int> anArray(k);
1373 QListBoxItem* anItem;
1375 for (anItem = myElements->firstItem(), i = 0; anItem != 0; anItem = anItem->next(), i++) {
1376 anArray[i] = anItem->text().toInt();
1377 if (anItem->isSelected())
1378 aSelected.append(anItem->text());
1380 // sort & update list
1381 std::sort(anArray.begin(), anArray.end());
1383 myElements->clear();
1384 for (i = 0; i < k; i++) {
1385 myElements->insertItem(QString::number(anArray[i]));
1387 for (QStringList::iterator it = aSelected.begin(); it != aSelected.end(); ++it) {
1388 anItem = myElements->findItem(*it, Qt::ExactMatch);
1389 if (anItem) myElements->setSelected(anItem, true);
1395 //=================================================================================
1396 // function : closeEvent()
1398 //=================================================================================
1399 void SMESHGUI_GroupDlg::closeEvent (QCloseEvent*)
1404 //=================================================================================
1405 // function : SMESHGUI_GroupDlg::onClose
1406 // purpose : SLOT called when "Close" button pressed. Close dialog
1407 //=================================================================================
1408 void SMESHGUI_GroupDlg::onClose()
1410 if (SMESH::GetCurrentVtkView()) {
1411 SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
1412 SMESH::SetPointRepresentation(false);
1413 SMESH::SetPickable();
1416 mySelectionMgr->clearSelected();
1417 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1418 aViewWindow->SetSelectionMode(ActorSelection);
1419 mySelectionMgr->clearFilters();
1420 mySMESHGUI->ResetState();
1425 //=================================================================================
1426 // function : SMESHGUI_GroupDlg::onDeactivate
1427 // purpose : SLOT called when dialog must be deativated
1428 //=================================================================================
1429 void SMESHGUI_GroupDlg::onDeactivate()
1431 mySMESHGUI->ResetState();
1435 //=================================================================================
1436 // function : SMESHGUI_GroupDlg::enterEvent
1437 // purpose : Event filter
1438 //=================================================================================
1439 void SMESHGUI_GroupDlg::enterEvent (QEvent*)
1442 mySMESHGUI->EmitSignalDeactivateDialog();
1444 mySelectionMode = -1;
1445 setSelectionMode(myTypeId);
1446 //mySMESHGUI->SetActiveDialogBox((QDialog*)this);
1447 mySMESHGUI->SetActiveDialogBox(this);
1448 mySMESHGUI->SetState(800);
1452 //=================================================================================
1453 // function : hideEvent
1454 // purpose : caused by ESC key
1455 //=================================================================================
1456 void SMESHGUI_GroupDlg::hideEvent (QHideEvent*)