1 // Copyright (C) 2007-2020 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, or (at your option) any later version.
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
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_GroupDlg.cxx
25 // Author : Natalia KOPNOVA, Open CASCADE S.A.S.
28 #include "SMESHGUI_GroupDlg.h"
31 #include "SMESHGUI_Utils.h"
32 #include "SMESHGUI_VTKUtils.h"
33 #include "SMESHGUI_GroupUtils.h"
34 #include "SMESHGUI_FilterUtils.h"
35 #include "SMESHGUI_GEOMGenUtils.h"
36 #include "SMESHGUI_FilterDlg.h"
37 #include "SMESHGUI_ShapeByMeshDlg.h"
39 #include <SMESH_TypeFilter.hxx>
40 #include <SMESH_Actor.h>
41 //#include <SMESH_ActorUtils.h>
42 #include <SMESH_LogicalFilter.hxx>
44 // SALOME GEOM includes
46 #include <GEOM_SelectionFilter.h>
47 #include <GEOM_wrap.hxx>
49 // SALOME GUI includes
50 #include <QtxColorButton.h>
52 #include <SUIT_Desktop.h>
53 #include <SUIT_ResourceMgr.h>
54 #include <SUIT_Session.h>
55 #include <SUIT_MessageBox.h>
56 #include <SUIT_OverrideCursor.h>
58 #include <SalomeApp_Tools.h>
59 #include <SalomeApp_Application.h>
60 #include <SalomeApp_Study.h>
61 #include <LightApp_SelectionMgr.h>
63 #include <SALOME_ListIO.hxx>
65 #include <SVTK_ViewWindow.h>
67 #include <VTKViewer_Algorithm.h>
69 // SALOME KERNEL includes
70 #include <SALOMEDSClient_Study.hxx>
73 #include <vtkRenderer.h>
74 #include <vtkActorCollection.h>
77 #include <TColStd_MapOfInteger.hxx>
80 #include <QButtonGroup>
84 #include <QPushButton>
85 #include <QToolButton>
86 #include <QRadioButton>
88 #include <QGridLayout>
89 #include <QHBoxLayout>
90 #include <QVBoxLayout>
91 #include <QListWidget>
92 #include <QStackedWidget>
104 enum grpSelectionMode {
106 grpNodeSelection = 0,
108 grpBallSelection = 2,
109 grpEdgeSelection = 3,
110 grpFaceSelection = 4,
111 grpVolumeSelection = 5,
112 grpSubMeshSelection = 6,
113 grpGroupSelection = 7,
114 grpMeshSelection = 8,
115 grpGeomSelection = 9,
116 grpAllSelection = 10,
119 //=================================================================================
120 // function : SMESHGUI_GroupDlg()
122 //=================================================================================
123 SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
124 SMESH::SMESH_Mesh_ptr theMesh )
125 : QDialog( SMESH::GetDesktop( theModule ) ),
126 mySMESHGUI( theModule ),
127 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myStoredShownEntity(0),
128 mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
130 myNameChanged( false ),
131 myNbChangesOfContents(0),
132 myIsApplyAndClose( false )
135 if ( !theMesh->_is_nil() )
139 mySelectSubMesh->setEnabled( false );
140 mySelectGroup->setEnabled( false );
141 myGeomGroupBtn->setEnabled( false );
142 myGeomGroupLine->setEnabled( false );
146 //=================================================================================
147 // function : SMESHGUI_GroupDlg()
149 //=================================================================================
150 SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
151 SMESH::SMESH_GroupBase_ptr theGroup,
152 const bool theIsConvert )
153 : QDialog( SMESH::GetDesktop( theModule ) ),
154 mySMESHGUI( theModule ),
155 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myStoredShownEntity(0),
156 mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
158 myNameChanged( false ),
159 myNbChangesOfContents(0) // just not to use uninitialized variable
162 if ( !theGroup->_is_nil() )
163 init( theGroup, theIsConvert );
166 mySelectSubMesh->setEnabled( false );
167 mySelectGroup->setEnabled( false );
169 myCurrentLineEdit = myMeshGroupLine;
170 setSelectionMode( grpGroupSelection );
174 //=================================================================================
175 // function : SMESHGUI_GroupDlg()
177 //=================================================================================
178 void SMESHGUI_GroupDlg::initDialog( bool create)
181 setAttribute( Qt::WA_DeleteOnClose, true );
185 myCurrentLineEdit = 0;
189 myGeomObjects = new GEOM::ListOfGO();
190 myGeomObjects->length( 0 );
192 QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
194 setWindowTitle( create ? tr( "SMESH_CREATE_GROUP_TITLE" ) : tr( "SMESH_EDIT_GROUP_TITLE" ) );
195 myHelpFileName = create ? "creating_groups.html" : "editing_groups.html";
197 setSizeGripEnabled( true);
199 QGridLayout* aMainLayout = new QGridLayout( this );
200 aMainLayout->setMargin( MARGIN );
201 aMainLayout->setSpacing( SPACING );
203 /***************************************************************/
204 QLabel* meshGroupLab = new QLabel( create ? tr( "SMESH_MESH" ) : tr( "SMESH_GROUP" ), this );
205 myMeshGroupBtn = new QPushButton( this );
206 myMeshGroupBtn->setIcon( image0 );
207 myMeshGroupLine = new QLineEdit( this );
208 myMeshGroupLine->setReadOnly( true );
210 /***************************************************************/
211 QGroupBox* aTypeBox = new QGroupBox( tr( "SMESH_ELEMENTS_TYPE" ), this );
212 myTypeGroup = new QButtonGroup( this );
213 QHBoxLayout* aTypeBoxLayout = new QHBoxLayout( aTypeBox );
214 aTypeBoxLayout->setMargin( MARGIN );
215 aTypeBoxLayout->setSpacing( SPACING );
218 types.append( tr( "MESH_NODE" ) );
219 types.append( tr( "SMESH_ELEM0D" ) );
220 types.append( tr( "SMESH_BALL_ELEM" ) );
221 types.append( tr( "SMESH_EDGE" ) );
222 types.append( tr( "SMESH_FACE" ) );
223 types.append( tr( "SMESH_VOLUME" ) );
225 for ( int i = 0; i < types.count(); i++ )
227 rb = new QRadioButton( types[i], aTypeBox );
228 myTypeGroup->addButton( rb, i );
229 aTypeBoxLayout->addWidget( rb );
231 aTypeBox->setEnabled( create );
234 /***************************************************************/
235 QLabel* aName = new QLabel( tr( "SMESH_NAME" ), this );
236 aName->setMinimumWidth( 50 );
237 myName = new QLineEdit( this );
239 /***************************************************************/
240 QGroupBox* aGrpTypeBox = new QGroupBox( tr( "SMESH_GROUP_TYPE" ), this );
241 myGrpTypeGroup = new QButtonGroup( this );
242 QHBoxLayout* aGrpTypeBoxLayout = new QHBoxLayout( aGrpTypeBox );
243 aGrpTypeBoxLayout->setMargin( MARGIN );
244 aGrpTypeBoxLayout->setSpacing( SPACING );
246 QRadioButton* rb1 = new QRadioButton( tr( "SMESH_GROUP_STANDALONE" ), aGrpTypeBox );
247 QRadioButton* rb2 = new QRadioButton( tr( "SMESH_GROUP_GEOMETRY" ), aGrpTypeBox );
248 QRadioButton* rb3 = new QRadioButton( tr( "SMESH_GROUP_FILTER" ), aGrpTypeBox );
249 myGrpTypeGroup->addButton( rb1, 0 );
250 myGrpTypeGroup->addButton( rb2, 1 );
251 myGrpTypeGroup->addButton( rb3, 2 );
252 aGrpTypeBoxLayout->addWidget( rb1 );
253 aGrpTypeBoxLayout->addWidget( rb2 );
254 aGrpTypeBoxLayout->addWidget( rb3 );
255 aGrpTypeBox->setEnabled( create );
258 /***************************************************************/
259 myWGStack = new QStackedWidget( this );
260 QWidget* wg1 = new QWidget( myWGStack );
261 QWidget* wg2 = new QWidget( myWGStack );
262 QWidget* wg3 = new QWidget( myWGStack );
264 /***************************************************************/
265 QGroupBox* aContentBox = new QGroupBox( tr( "SMESH_CONTENT" ), wg1 );
266 QGridLayout* aContentBoxLayout = new QGridLayout( aContentBox );
267 aContentBoxLayout->setMargin( MARGIN );
268 aContentBoxLayout->setSpacing( SPACING );
270 mySelectAll = new QCheckBox( tr( "SELECT_ALL" ), aContentBox );
271 myAllowElemsModif = new QCheckBox( tr( "ALLOW_ELEM_LIST_MODIF" ), aContentBox );
273 myElementsLab = new QLabel( tr( "SMESH_ID_ELEMENTS" ), aContentBox );
274 myElements = new QListWidget( aContentBox );
275 myElements->setSelectionMode( QListWidget::ExtendedSelection );
277 myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), aContentBox );
278 myAddBtn = new QPushButton( tr( "SMESH_BUT_ADD" ), aContentBox );
279 myRemoveBtn = new QPushButton( tr( "SMESH_BUT_REMOVE" ), aContentBox );
280 mySortBtn = new QPushButton( tr( "SMESH_BUT_SORT" ), aContentBox );
282 aContentBoxLayout->addWidget( mySelectAll, 0, 0 );
283 aContentBoxLayout->addWidget( myAllowElemsModif, 1, 0 );
284 aContentBoxLayout->addWidget( myFilterBtn, 1, 1 );
285 aContentBoxLayout->addWidget( myElementsLab, 2, 0 );
286 aContentBoxLayout->addWidget( myElements, 3, 0, 6, 1 );
287 aContentBoxLayout->addWidget( myAddBtn, 3, 1 );
288 aContentBoxLayout->addWidget( myRemoveBtn, 4, 1 );
289 aContentBoxLayout->addWidget( mySortBtn, 8, 1 );
291 aContentBoxLayout->setColumnStretch( 0, 1 );
292 aContentBoxLayout->setRowStretch( 3, 1 );
293 aContentBoxLayout->setRowStretch( 6, 1 );
295 /***************************************************************/
296 mySelectBox = new QGroupBox( tr( "SMESH_SELECT_FROM" ), wg1 );
297 QGridLayout* mySelectBoxLayout = new QGridLayout( mySelectBox );
298 mySelectBoxLayout->setMargin( MARGIN );
299 mySelectBoxLayout->setSpacing( SPACING );
301 mySelectSubMesh = new QCheckBox( tr( "SMESH_SUBMESH" ), mySelectBox );
302 mySubMeshBtn = new QPushButton( mySelectBox );
303 mySubMeshBtn->setIcon( image0 );
304 mySubMeshLine = new QLineEdit( mySelectBox );
305 mySubMeshLine->setReadOnly( true );
306 onSelectSubMesh( false );
308 mySelectGroup = new QCheckBox( tr( "SMESH_GROUP" ), mySelectBox );
309 myGroupBtn = new QPushButton( mySelectBox );
310 myGroupBtn->setIcon( image0 );
311 myGroupLine = new QLineEdit( mySelectBox );
312 myGroupLine->setReadOnly( true );
313 onSelectGroup( false );
315 mySelectBoxLayout->addWidget( mySelectSubMesh, 0, 0 );
316 mySelectBoxLayout->addWidget( mySubMeshBtn, 0, 1 );
317 mySelectBoxLayout->addWidget( mySubMeshLine, 0, 2 );
318 mySelectBoxLayout->addWidget( mySelectGroup, 1, 0 );
319 mySelectBoxLayout->addWidget( myGroupBtn, 1, 1 );
320 mySelectBoxLayout->addWidget( myGroupLine, 1, 2 );
322 /***************************************************************/
323 QVBoxLayout* wg1Layout = new QVBoxLayout( wg1 );
324 wg1Layout->setMargin( 0 );
325 wg1Layout->setSpacing( SPACING );
326 wg1Layout->addWidget( aContentBox );
327 wg1Layout->addWidget( mySelectBox );
328 wg1Layout->setStretchFactor( aContentBox, 10 );
330 /***************************************************************/
331 QLabel* geomObject = new QLabel( tr( "SMESH_OBJECT_GEOM" ), wg2 );
332 myGeomGroupBtn = new QToolButton( wg2 );
333 myGeomGroupBtn->setIcon( image0 );
334 myGeomGroupBtn->setCheckable( true );
335 myGeomGroupLine = new QLineEdit( wg2 );
336 myGeomGroupLine->setReadOnly( true ); //VSR ???
337 onSelectGeomGroup( false );
339 myGeomGroupBtn->setEnabled( create );
340 myGeomGroupLine->setEnabled( create );
342 /***************************************************************/
343 QGridLayout* wg2Layout = new QGridLayout( wg2 );
344 wg2Layout->setMargin( 0 );
345 wg2Layout->setSpacing( SPACING );
346 wg2Layout->addWidget( geomObject, 0, 0 );
347 wg2Layout->addWidget( myGeomGroupBtn, 0, 1 );
348 wg2Layout->addWidget( myGeomGroupLine,0, 2 );
349 wg2Layout->setRowStretch( 1, 5 );
351 /***************************************************************/
352 QPushButton * aFilter2 = new QPushButton( tr( "SMESH_BUT_FILTER" ), wg3 );
353 QGridLayout* wg3Layout = new QGridLayout( wg3 );
354 wg3Layout->setMargin( 0 );
355 wg3Layout->setSpacing( SPACING );
356 wg3Layout->addWidget( aFilter2, 0, 0 );
357 wg3Layout->setRowStretch( 1, 5 );
359 /***************************************************************/
360 myWGStack->insertWidget( 0, wg1 );
361 myWGStack->insertWidget( 1, wg2 );
362 myWGStack->insertWidget( 2, wg3 );
364 /***************************************************************/
365 QGroupBox* aColorBox = new QGroupBox(tr( "SMESH_SET_COLOR" ), this);
366 QHBoxLayout* aColorBoxLayout = new QHBoxLayout(aColorBox);
367 aColorBoxLayout->setMargin(MARGIN);
368 aColorBoxLayout->setSpacing(SPACING);
370 QLabel* aColorLab = new QLabel(tr( "SMESH_CHECK_COLOR" ), aColorBox );
371 myColorBtn = new QtxColorButton(aColorBox);
372 myColorBtn->setSizePolicy( QSizePolicy::MinimumExpanding,
373 myColorBtn->sizePolicy().verticalPolicy() );
375 aColorBoxLayout->addWidget(aColorLab);
376 aColorBoxLayout->addWidget(myColorBtn);
378 /***************************************************************/
380 QFrame* aButtons = new QFrame(this);
381 aButtons->setFrameStyle( QFrame::Box | QFrame::Sunken );
382 QHBoxLayout* aBtnLayout = new QHBoxLayout(aButtons);
383 aBtnLayout->setMargin(MARGIN);
384 aBtnLayout->setSpacing(SPACING);
386 myOKBtn = new QPushButton(tr( "SMESH_BUT_APPLY_AND_CLOSE" ), aButtons);
387 myOKBtn->setAutoDefault(true);
388 myOKBtn->setDefault(true);
389 myApplyBtn = new QPushButton(tr( "SMESH_BUT_APPLY" ), aButtons);
390 myApplyBtn->setAutoDefault(true);
391 myCloseBtn = new QPushButton(tr( "SMESH_BUT_CLOSE" ), aButtons);
392 myCloseBtn->setAutoDefault(true);
393 myHelpBtn = new QPushButton(tr( "SMESH_BUT_HELP" ), aButtons);
394 myHelpBtn->setAutoDefault(true);
396 aBtnLayout->addWidget(myOKBtn);
397 aBtnLayout->addSpacing(10);
398 aBtnLayout->addWidget(myApplyBtn);
399 aBtnLayout->addSpacing(10);
400 aBtnLayout->addStretch();
401 aBtnLayout->addWidget(myCloseBtn);
402 aBtnLayout->addWidget(myHelpBtn);
404 /***************************************************************/
405 aMainLayout->addWidget(meshGroupLab, 0, 0);
406 aMainLayout->addWidget(myMeshGroupBtn, 0, 1);
407 aMainLayout->addWidget(myMeshGroupLine, 0, 2);
408 aMainLayout->addWidget(aTypeBox, 1, 0, 1, 3);
409 aMainLayout->addWidget(aName, 2, 0);
410 aMainLayout->addWidget(myName, 2, 2);
411 aMainLayout->addWidget(aGrpTypeBox, 3, 0, 1, 3);
412 aMainLayout->addWidget(myWGStack, 4, 0, 1, 3);
413 aMainLayout->addWidget(aColorBox, 5, 0, 1, 3);
414 aMainLayout->addWidget(aButtons, 6, 0, 1, 3);
416 /* signals and slots connections */
417 connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
418 connect(myGrpTypeGroup, SIGNAL(buttonClicked(int)), this, SLOT(onGrpTypeChanged(int)));
419 connect(myTypeGroup, SIGNAL(buttonClicked(int)), this, SLOT(onTypeChanged(int)));
421 connect(myName, SIGNAL(textChanged(const QString&)), this, SLOT(onNameChanged(const QString&)));
422 connect(myElements, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged()));
424 connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
425 connect(aFilter2, SIGNAL(clicked()), this, SLOT(setFilters()));
426 connect(mySelectAll, SIGNAL(toggled(bool)), this, SLOT(onSelectAll()));
427 connect(myAllowElemsModif,SIGNAL(toggled(bool)), this, SLOT(onSelectAll()));
428 connect(myAddBtn, SIGNAL(clicked()), this, SLOT(onAdd()));
429 connect(myRemoveBtn, SIGNAL(clicked()), this, SLOT(onRemove()));
430 connect(mySortBtn, SIGNAL(clicked()), this, SLOT(onSort()));
432 connect(mySelectSubMesh, SIGNAL(toggled(bool)), this, SLOT(onSelectSubMesh(bool)));
433 connect(mySelectGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectGroup(bool)));
434 connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
435 connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
436 connect(myGeomGroupBtn, SIGNAL(toggled(bool)), this, SLOT(onGeomSelectionButton(bool)));
438 connect(myColorBtn, SIGNAL(changed( QColor )), this, SLOT(onColorChanged( QColor )));
440 connect(myOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
441 connect(myApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
442 connect(myCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
443 connect(myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
446 mySMESHGUI->SetActiveDialogBox(this);
448 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( mySMESHGUI->application()->activeStudy() );
449 mySelectionMode = grpNoSelection;
451 myMeshFilter = new SMESH_TypeFilter(SMESH::MESH);
452 mySubMeshFilter = new SMESH_LogicalFilter(QList<SUIT_SelectionFilter*>(),
453 SMESH_LogicalFilter::LO_OR,
454 /*takeOwnership=*/true);
455 myGroupFilter = new SMESH_LogicalFilter(QList<SUIT_SelectionFilter*>(),
456 SMESH_LogicalFilter::LO_OR,
457 /*takeOwnership=*/true);
458 myGeomFilter = new GEOM_SelectionFilter( aStudy, true );
460 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
461 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
462 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
463 connect(mySMESHGUI, SIGNAL(SignalVisibilityChanged()), this, SLOT(onVisibilityChanged()));
464 connect(mySMESHGUI, SIGNAL(SignalActivatedViewManager()), this, SLOT(onOpenView()));
465 connect(mySMESHGUI, SIGNAL(SignalCloseView()), this, SLOT(onCloseView()));
466 rb1->setChecked(true); // VSR !!!
467 onGrpTypeChanged(0); // VSR!!!
469 if (myMesh->_is_nil() )
470 myTypeGroup->button(0)->setChecked(true);
472 onSelectAll(); //updateButtons();
475 //=================================================================================
476 // function : ~SMESHGUI_GroupDlg()
477 // purpose : Destroys the object and frees any allocated resources
478 //=================================================================================
479 SMESHGUI_GroupDlg::~SMESHGUI_GroupDlg()
481 // no need to delete child widgets, Qt does it all for us
482 if ( myFilterDlg != 0 ) {
483 myFilterDlg->setParent( 0 );
486 if ( myMeshFilter ) delete myMeshFilter;
487 if ( mySubMeshFilter ) delete mySubMeshFilter;
488 if ( myGroupFilter ) delete myGroupFilter;
489 if ( myGeomFilter ) delete myGeomFilter;
492 //=================================================================================
493 // function : GetDefaultName()
494 // purpose : Get the Group Name if Create new Group
495 //=================================================================================
496 QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation)
500 // collect all object names of SMESH component
501 _PTR(Study) aStudy = SMESH::getStudy();
503 std::set<std::string> aSet;
504 _PTR(SComponent) aMeshCompo (aStudy->FindComponent( "SMESH" ));
506 _PTR(ChildIterator) it (aStudy->NewChildIterator(aMeshCompo));
508 for (it->InitEx(true); it->More(); it->Next()) {
510 aSet.insert(obj->GetName());
514 // build a unique name
516 bool isUnique = false;
518 aName = theOperation + "_" + QString::number(++aNumber);
519 isUnique = (aSet.count(std::string(aName.toUtf8().constData())) == 0);
525 void SMESHGUI_GroupDlg::setDefaultName() const
529 QString aPrefix ="Group_";
533 aResName = aPrefix + QString::number( i++ );
534 anObj = SMESH::getStudy()->FindObject( aResName.toUtf8().constData() );
537 myName->setText(aResName);
540 //=================================================================================
543 //=================================================================================
544 void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
546 mySelectionMgr->installFilter(myMeshFilter);
548 /* init data from current selection */
549 restoreShowEntityMode();
550 myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
552 myGroup = SMESH::SMESH_Group::_nil();
553 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
554 myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
556 // NPAL19389: create a group with a selection in another group
557 // set actor of myMesh, if it is visible, else try
558 // any visible actor of group or submesh of myMesh
559 SetAppropriateActor();
561 setDefaultGroupColor();
566 mySelectionMgr->selectedObjects( aList );
567 if( !aList.IsEmpty() )
569 QString aName = aList.First()->getName();
570 myMeshGroupLine->setText(aName);//??????
571 myMeshGroupLine->home( false );
574 myCurrentLineEdit = 0;
576 myTypeGroup->button(0)->setChecked(true);
580 //=================================================================================
583 //=================================================================================
584 void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
585 const bool theIsConvert)
587 restoreShowEntityMode();
588 myMesh = theGroup->GetMesh();
591 myNameChanged = true;
592 myName->blockSignals(true);
593 myName->setText(SMESH::fromUtf8(theGroup->GetName()));
594 myName->blockSignals(false);
597 SALOMEDS::Color aColor = theGroup->GetColor();
598 setGroupColor( aColor );
600 myMeshGroupLine->setText(theGroup->GetName());
603 switch(theGroup->GetType()) {
604 case SMESH::NODE: aType = grpNodeSelection; break;
605 case SMESH::ELEM0D: aType = grp0DSelection; break;
606 case SMESH::BALL: aType = grpBallSelection; break;
607 case SMESH::EDGE: aType = grpEdgeSelection; break;
608 case SMESH::FACE: aType = grpFaceSelection; break;
609 case SMESH::VOLUME: aType = grpVolumeSelection; break;
611 case SMESH::NB_ELEMENT_TYPES: break;
613 myTypeGroup->button(aType)->setChecked(true);
615 myGroup = SMESH::SMESH_Group::_narrow( theGroup );
616 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup );
617 myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_narrow( theGroup );
618 myFilter = SMESH::Filter::_nil();
620 if (myGroup->_is_nil() && myGroupOnGeom->_is_nil() && myGroupOnFilter->_is_nil() )
623 // NPAL19389: create a group with a selection in another group
624 // set actor of myMesh, if it is visible, else set
625 // actor of theGroup, if it is visible, else try
626 // any visible actor of group or submesh of myMesh
627 // commented, because an attempt to set selection on not displayed cells leads to error
628 SetAppropriateActor();
630 /* SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
632 anActor = SMESH::FindActorByObject(theGroup);
633 SMESH::SetPickable(anActor);*/
635 int grpType = (!myGroup->_is_nil() ? 0 : (theIsConvert ? 0 : myGroupOnGeom->_is_nil() ? 2 : 1));
636 myGrpTypeGroup->button(grpType)->setChecked(true);
637 onGrpTypeChanged(grpType);
640 if ( grpType == 0 ) { // standalone group
641 myCurrentLineEdit = 0;
643 myAllowElemsModif->setChecked( true );
645 setSelectionMode(aType);
647 setShowEntityMode(); // depends on myTypeId
650 if (!theGroup->IsEmpty()) {
651 SMESH::long_array_var anElements = theGroup->GetListOfID();
652 int k = anElements->length();
653 for (int i = 0; i < k; i++) {
654 myIdList.append(anElements[i]);
655 myElements->addItem(QString::number(anElements[i]));
657 myElements->selectAll();
660 else if ( grpType == 1 ) // group on geom
662 QString aShapeName( "" );
663 _PTR(Study) aStudy = SMESH::getStudy();
664 GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape();
665 if (!aGroupShape->_is_nil())
667 _PTR(SObject) aGroupShapeSO = aStudy->FindObjectID(aGroupShape->GetStudyEntry());
669 aShapeName = aGroupShapeSO->GetName().c_str();
671 myGeomGroupLine->setText( aShapeName );
673 else // group on filter
675 myFilter = myGroupOnFilter->GetFilter();
676 if ( !myFilter->_is_nil() ) {
677 SMESH::Predicate_var perdicate = myFilter->GetPredicate();
678 if ( perdicate->_is_nil() )
679 myFilter = SMESH::Filter::_nil();
685 myNameChanged = true;
686 myName->blockSignals(true);
687 myName->setText(theGroup->GetName());
688 myName->blockSignals(false);
691 onSelectAll(); //updateButtons();
694 //=================================================================================
695 // function : updateButtons()
697 //=================================================================================
698 void SMESHGUI_GroupDlg::updateButtons()
700 bool enable = !myName->text().trimmed().isEmpty();
703 if (myGrpTypeId == 0) { // standalone
704 if ( !mySelectAll->isChecked() )
706 if ( myAllowElemsModif->isChecked() )
708 enable = ( myElements->count() > 0 );
710 else if ((enable = !myFilter->_is_nil() ))
712 SMESH::array_of_ElementType_var types = myFilter->GetTypes();
713 enable = types->length();
716 enable = enable && (!myGroup->_is_nil() || !myMesh->_is_nil());
718 else if (myGrpTypeId == 1) // on geom
720 if (CORBA::is_nil(myGroupOnGeom)) // creation mode
721 enable = ( myGeomObjects->length() > 0 && !myMesh->_is_nil() );
723 else if (myGrpTypeId == 2) // on filter
725 if (( enable = !myFilter->_is_nil() ))
726 if (CORBA::is_nil(myGroupOnFilter) ) // creation mode
727 enable = !myMesh->_is_nil();
731 bool meshHasGeom = ( myMesh->_is_nil() || myMesh->HasShapeToMesh() );
732 if ( myGrpTypeId != 1 )
734 myGrpTypeGroup->button(1)->setEnabled( meshHasGeom );
738 myGeomGroupBtn->setEnabled( meshHasGeom );
739 myGeomGroupLine->setEnabled( meshHasGeom );
742 myOKBtn->setEnabled(enable);
743 myApplyBtn->setEnabled(enable);
746 //=================================================================================
747 // function : onNameChanged()
749 //=================================================================================
750 void SMESHGUI_GroupDlg::onNameChanged (const QString& text)
752 myOldName = myName->text();
754 myNameChanged = !myName->text().trimmed().isEmpty();
757 //=================================================================================
758 // function : onTypeChanged()
759 // purpose : Group elements type radio button management
760 //=================================================================================
761 void SMESHGUI_GroupDlg::onTypeChanged (int id)
763 if (myTypeId != id) {
766 if ( myGrpTypeId == 0 && myCurrentLineEdit == 0)
767 setSelectionMode(id);
769 setSelectionMode( mySelectionMode++ ); // update according to mySelectionMode
771 onObjectSelectionChanged();
776 //=================================================================================
777 // function : onGrpTypeChanged()
778 // purpose : Group type radio button management
779 //=================================================================================
780 void SMESHGUI_GroupDlg::onGrpTypeChanged (int id)
782 if (myGrpTypeId != id) {
784 myWGStack->setCurrentIndex( id );
785 myName->blockSignals(true);
786 myName->setText(myOldName);
787 myName->blockSignals(false);
788 onSelectGeomGroup(id != 0);
793 //=================================================================================
794 // function : onColorChanged()
795 // purpose : Color button management
796 //=================================================================================
797 void SMESHGUI_GroupDlg::onColorChanged(QColor theColor)
802 //=================================================================================
803 // function : setSelectionMode()
804 // purpose : Radio button management
805 //=================================================================================
806 void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
809 if (myMesh->_is_nil())
811 SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
812 bool isSelectAll = mySelectAll->isChecked() || !myAllowElemsModif->isChecked() || myGrpTypeId != 0;
813 if (mySelectionMode != theMode) {
814 // [PAL10408] mySelectionMgr->clearSelected();
815 mySelectionMgr->clearFilters();
816 SMESH::RemoveFilters();
818 if (myActorsList.count() > 0)
819 for (QListIterator<SMESH_Actor*> it( myActorsList ); it.hasNext(); )
820 it.next()->SetPointRepresentation(false);
822 SMESH::SetPointRepresentation(false);
825 case grpNodeSelection:
826 if ( myGrpTypeId == 0 ) // standalone
828 if (myActorsList.count() > 0)
829 for (QListIterator<SMESH_Actor*> it( myActorsList ); it.hasNext(); )
830 it.next()->SetPointRepresentation(true);
832 SMESH::SetPointRepresentation(true);
834 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : NodeSelection);
836 case grpEdgeSelection:
837 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : EdgeSelection);
839 case grpBallSelection:
840 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : BallSelection);
843 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : Elem0DSelection);
845 case grpFaceSelection:
846 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : FaceSelection);
848 case grpVolumeSelection:
849 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : VolumeSelection);
851 case grpSubMeshSelection: {
853 SMESH_TypeFilter* f = 0;
855 case grpNodeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH); break;
856 case grpEdgeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_EDGE); break;
857 case grpFaceSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_FACE); break;
858 case grpVolumeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_SOLID); break;
859 default: f = new SMESH_TypeFilter(SMESH::SUBMESH);
861 QList<SUIT_SelectionFilter*> filtList;
862 filtList.append( f );
863 filtList.append( new SMESH_TypeFilter(SMESH::SUBMESH_COMPOUND));
864 mySubMeshFilter->setFilters( filtList );
866 mySelectionMgr->installFilter( mySubMeshFilter );
868 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
871 case grpGroupSelection: {
873 SMESH_TypeFilter* f = 0;
875 case grpNodeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_NODE); break;
876 case grp0DSelection: f = new SMESH_TypeFilter(SMESH::GROUP_0D); break;
877 case grpBallSelection: f = new SMESH_TypeFilter(SMESH::GROUP_BALL); break;
878 case grpEdgeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_EDGE); break;
879 case grpFaceSelection: f = new SMESH_TypeFilter(SMESH::GROUP_FACE); break;
880 case grpVolumeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_VOLUME); break;
881 default: f = new SMESH_TypeFilter(SMESH::GROUP);
883 QList<SUIT_SelectionFilter*> filtList;
884 filtList.append( f );
885 myGroupFilter->setFilters( filtList );
887 mySelectionMgr->installFilter(myGroupFilter);
888 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
891 case grpMeshSelection:
892 mySelectionMgr->installFilter(myMeshFilter);
893 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
895 case grpGeomSelection:
896 mySelectionMgr->installFilter(myGeomFilter);
897 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
900 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
903 if ( aViewWindow ) aViewWindow->Repaint();
904 mySelectionMode = theMode;
908 //=================================================================================
909 // function : onApply()
911 //=================================================================================
912 bool SMESHGUI_GroupDlg::onApply()
914 if (SMESHGUI::isStudyLocked())
917 if (myName->text().trimmed().isEmpty())
920 SMESH::ElementType aType = SMESH::ALL;
922 case grpNodeSelection: aType = SMESH::NODE; break;
923 case grp0DSelection: aType = SMESH::ELEM0D; break;
924 case grpBallSelection: aType = SMESH::BALL; break;
925 case grpEdgeSelection: aType = SMESH::EDGE; break;
926 case grpFaceSelection: aType = SMESH::FACE; break;
927 case grpVolumeSelection: aType = SMESH::VOLUME; break;
931 QStringList anEntryList;
933 SMESH::SMESH_GroupBase_var resultGroup;
934 bool isCreation = false, isConversion = false;
936 SUIT_OverrideCursor wc;
938 if (myGrpTypeId == 0) // standalone
940 if (!mySelectAll->isChecked() && !myElements->count() && myAllowElemsModif->isChecked())
943 mySelectionMgr->clearSelected();
945 if (myGroup->_is_nil()) { // creation or conversion
946 // check if group on geometry is not null
947 if (!myGroupOnGeom->_is_nil() || !myGroupOnFilter->_is_nil()) {
948 if (myMesh->_is_nil())
950 if ( myGroupOnGeom->_is_nil() )
951 myGroup = myMesh->ConvertToStandalone( myGroupOnFilter );
953 myGroup = myMesh->ConvertToStandalone( myGroupOnGeom );
955 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
956 myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
961 if (myGroup->_is_nil()) { // creation
962 if (myMesh->_is_nil())
965 myGroup = SMESH::AddGroup(myMesh, aType, myName->text());
967 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroup );
970 if ( mySelectAll->isChecked() ) {
972 myGroup->AddFrom(myMesh.in());
977 if ( !myFilter->_is_nil() &&
978 ( myNbChangesOfContents == 1 || !myAllowElemsModif->isChecked()))
980 myGroup->AddFrom( myFilter );
984 SMESH::long_array_var anIdList = new SMESH::long_array;
985 int i, k = myElements->count();
987 for (i = 0; i < k; i++) {
988 anIdList[i] = myElements->item(i)->text().toInt();
990 myGroup->Add(anIdList.inout());
997 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroup );
1000 if ( mySelectAll->isChecked() ) {
1003 myGroup->AddFrom(myMesh.in());
1006 QList<int> aAddList;
1008 int i, total = myElements->count();
1009 for (i = 0; i < total; i++) {
1010 int anId = myElements->item(i)->text().toInt();
1011 int idx = myIdList.indexOf(anId);
1013 aAddList.append(anId);
1015 myIdList.removeAt(idx);
1017 if (!aAddList.empty()) {
1018 SMESH::long_array_var anIdList = new SMESH::long_array;
1019 int added = aAddList.count();
1020 anIdList->length(added);
1021 for (i = 0; i < added; i++)
1022 anIdList[i] = aAddList[i];
1023 myGroup->Add(anIdList.inout());
1025 if (!myIdList.empty()) {
1026 SMESH::long_array_var anIdList = new SMESH::long_array;
1027 int removed = myIdList.count();
1028 anIdList->length(removed);
1029 for (i = 0; i < removed; i++)
1030 anIdList[i] = myIdList[i];
1031 myGroup->Remove(anIdList.inout());
1033 /* init for next operation */
1035 for (i = 0; i < total; i++) {
1036 myIdList.append(myElements->item(i)->text().toInt());
1043 else if (myGrpTypeId == 1) // on geom object
1045 if (CORBA::is_nil(myGroupOnGeom)) { // creation
1046 if (myMesh->_is_nil() || !myGeomObjects->length())
1049 _PTR(Study) aStudy = SMESH::getStudy();
1051 if (myGeomObjects->length() == 1) {
1052 myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
1053 myName->text().toUtf8(),
1057 SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
1058 if ( aSMESHGen->_is_nil() || myGeomObjects->length() == 0 )
1061 // create a geometry group
1062 GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( myGeomObjects[0] );
1063 if (geomGen->_is_nil())
1066 GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations();
1070 // check and add all selected GEOM objects: they must be
1071 // a sub-shapes of the main GEOM and must be of one type
1072 TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
1073 for ( CORBA::ULong i =0; i < myGeomObjects->length(); i++)
1075 TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
1077 aGroupType = aSubShapeType;
1078 else if ( aSubShapeType != aGroupType ) {
1079 aGroupType = TopAbs_SHAPE;
1084 GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
1085 GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
1086 if ( aGroupVar->_is_nil() )
1088 op->UnionList(aGroupVar, myGeomObjects);
1091 // publish the GEOM group in study
1092 QString aNewGeomGroupName ( "Auto_group_for_" );
1093 aNewGeomGroupName += myName->text();
1094 SALOMEDS::SObject_var aNewGroupSO =
1095 geomGen->AddInStudy(aGroupVar,
1096 aNewGeomGroupName.toUtf8(), aMeshShape);
1099 myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
1100 myName->text().toUtf8(),
1103 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
1109 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
1114 if (myGrpTypeId == 2) // group on filter
1116 if ( myFilter->_is_nil() ) return false;
1118 if (CORBA::is_nil(myGroupOnFilter)) // creation
1120 if (myMesh->_is_nil())
1123 myGroupOnFilter = myMesh->CreateGroupFromFilter(aType,
1124 myName->text().toUtf8(),
1126 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
1131 myGroupOnFilter->SetFilter( myFilter );
1133 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
1141 SALOMEDS::Color aColor = getGroupColor();
1142 resultGroup->SetColor(aColor);
1144 _PTR(SObject) aMeshGroupSO = SMESH::FindSObject( resultGroup );
1146 anEntryList.append( aMeshGroupSO->GetID().c_str() );
1148 resultGroup->SetName(myName->text().trimmed().toUtf8());
1152 SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" );
1154 /* init for the next operation */
1156 myElements->clear();
1157 myGroup = SMESH::SMESH_Group::_nil();
1158 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
1159 myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
1160 myFilter = SMESH::Filter::_nil();
1162 setDefaultGroupColor(); // reset color for case if 'auto-color' feature is enabled.
1168 if ( SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str()))
1170 Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
1171 if ( isConversion ) { // need to reset TVisualObj and actor
1172 SMESH::RemoveVisualObjectWithActors( anIO->getEntry(), true );
1173 SMESH::Update( anIO,true);
1174 myActorsList.clear();
1175 anActor = SMESH::FindActorByEntry( anIO->getEntry() );
1176 if ( !anActor ) return false;
1177 myActorsList.append( anActor );
1179 anActor->setName(myName->text().toUtf8());
1182 switch ( myTypeId ) {
1183 case grpNodeSelection: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
1184 case grp0DSelection: anActor->Set0DColor ( aColor.R, aColor.G, aColor.B ); break;
1185 case grpBallSelection: anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
1186 case grpEdgeSelection: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
1187 case grpVolumeSelection:
1188 SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100");
1189 anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break;
1191 case grpFaceSelection:
1193 SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100");
1194 anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
1197 // update a visible group according to a changed contents
1198 if ( !isConversion && anActor->GetVisibility() )
1200 SMESH::Update( anIO, true );
1201 SMESH::RepaintCurrentView();
1206 SMESHGUI::Modified();
1207 mySMESHGUI->updateObjBrowser(true);
1208 mySelectionMgr->clearSelected();
1210 if( LightApp_Application* anApp =
1211 dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
1212 myObjectToSelect = anApp->browseObjects( anEntryList, isApplyAndClose() );
1217 //=================================================================================
1218 // function : onOK()
1220 //=================================================================================
1221 void SMESHGUI_GroupDlg::onOK()
1223 setIsApplyAndClose( true );
1226 setIsApplyAndClose( false );
1228 if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
1231 //=================================================================================
1232 // function : onListSelectionChanged()
1233 // purpose : Called when selection in element list is changed
1234 //=================================================================================
1235 void SMESHGUI_GroupDlg::onListSelectionChanged()
1237 //MESSAGE( "SMESHGUI_GroupDlg::onListSelectionChanged(); myActorsList.count() = " << myActorsList.count());
1238 if( myIsBusy || myActorsList.count() == 0 ) return;
1241 if (myCurrentLineEdit == 0) {
1242 mySelectionMgr->clearSelected();
1243 TColStd_MapOfInteger aIndexes;
1244 QList<QListWidgetItem*> selItems = myElements->selectedItems();
1245 QListWidgetItem* anItem;
1246 foreach(anItem, selItems) aIndexes.Add(anItem->text().toInt());
1247 mySelector->AddOrRemoveIndex(myActorsList.first()->getIO(), aIndexes, false);
1248 SALOME_ListIO aList;
1249 aList.Append(myActorsList.first()->getIO());
1250 mySelectionMgr->setSelectedObjects(aList,false);
1255 //=================================================================================
1256 // function : onObjectSelectionChanged()
1257 // purpose : Called when selection in 3D view or ObjectBrowser is changed
1258 //=================================================================================
1259 void SMESHGUI_GroupDlg::onObjectSelectionChanged()
1261 if ( myIsBusy || !isEnabled()) return;
1262 if (myCurrentLineEdit == myGeomGroupLine && !myGeomGroupBtn->isChecked()) return;
1266 SALOME_ListIO aList;
1267 mySelectionMgr->selectedObjects( aList );
1269 int aNbSel = aList.Extent();
1270 myElements->clearSelection();
1272 if (myCurrentLineEdit)
1274 myCurrentLineEdit->setText( "" );
1275 QString aString = "";
1277 if (myCurrentLineEdit == myMeshGroupLine)
1279 mySelectSubMesh->setEnabled(false);
1280 mySelectGroup->setEnabled(false);
1281 myGroupLine->setText( "" );
1282 mySubMeshLine->setText( "" );
1284 myGeomGroupBtn->setEnabled(false);
1285 myGeomGroupLine->setEnabled(false);
1286 myGeomGroupLine->setText( "" );
1287 myGeomObjects = new GEOM::ListOfGO();
1288 myGeomObjects->length(0);
1290 if (myGeomGroupBtn->isChecked())
1291 myGeomGroupBtn->setChecked(false);
1293 myName->setText( "" );
1295 myElements->clear();
1298 myGroup = SMESH::SMESH_Group::_nil();
1299 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
1300 restoreShowEntityMode();
1301 myMesh = SMESH::SMESH_Mesh::_nil();
1307 Handle(SALOME_InteractiveObject) IO = aList.First();
1310 restoreShowEntityMode();
1311 myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
1312 setShowEntityMode();
1314 if (myMesh->_is_nil())
1321 if ( myFilterDlg && !myMesh->_is_nil()){
1322 myFilterDlg->SetMesh( myMesh );
1324 myGroup = SMESH::SMESH_Group::_nil();
1326 // NPAL19389: create a group with a selection in another group
1327 // set actor of myMesh, if it is visible, else try
1328 // any visible actor of group or submesh of myMesh
1329 SetAppropriateActor();
1331 setDefaultGroupColor();
1332 if (myName->text().isEmpty())
1335 aString = aList.First()->getName();
1336 myMeshGroupLine->setText(aString);
1337 myMeshGroupLine->home( false );
1339 mySelectSubMesh->setEnabled(true);
1340 mySelectGroup->setEnabled(true);
1341 myGeomGroupBtn->setEnabled(true);
1342 myGeomGroupLine->setEnabled(true);
1346 SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
1347 if (aGroup->_is_nil())
1354 myGroup = SMESH::SMESH_Group::_nil();
1355 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
1359 mySelectSubMesh->setEnabled(true);
1360 mySelectGroup->setEnabled(true);
1362 myCurrentLineEdit = 0;
1367 if (myGrpTypeId == 0)
1373 myElements->clear();
1374 setSelectionMode(myTypeId);
1382 else if (myCurrentLineEdit == myGeomGroupLine)
1384 myGeomObjects = new GEOM::ListOfGO();
1387 _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
1389 if (aNbSel == 0 || !aMeshSO)
1391 myGeomObjects->length(0);
1397 myGeomObjects->length(aNbSel);
1399 GEOM::GEOM_Object_var aGeomGroup;
1402 SALOME_ListIteratorOfListIO anIt (aList);
1403 for (; anIt.More(); anIt.Next())
1405 CORBA::Object_var aGroupObj = SMESH::IObjectToObject(anIt.Value());
1406 if (CORBA::is_nil(aGroupObj))
1408 // Check if the object is a geometry group
1409 aGeomGroup = GEOM::GEOM_Object::_narrow(aGroupObj);
1410 if (CORBA::is_nil(aGeomGroup))
1413 // Check if group constructed on the same shape as a mesh or on its child
1415 // The main shape of the group
1416 GEOM::GEOM_Object_var aGroupMainShape;
1417 if (aGeomGroup->GetType() == 37)
1419 GEOM::GEOM_IGroupOperations_wrap anOp =
1420 SMESH::GetGEOMGen( aGeomGroup )->GetIGroupOperations();
1421 aGroupMainShape = anOp->GetMainShape( aGeomGroup );
1422 // aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
1426 aGroupMainShape = aGeomGroup;
1427 aGroupMainShape->Register();
1429 CORBA::String_var entry = aGroupMainShape->GetStudyEntry();
1430 _PTR(SObject) aGroupMainShapeSO =
1431 SMESH::getStudy()->FindObjectID( entry.in() );
1433 _PTR(SObject) anObj, aRef;
1434 bool isRefOrSubShape = false;
1435 if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) {
1436 if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
1437 isRefOrSubShape = true;
1439 _PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
1440 _PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
1441 while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
1442 if (aRef->GetID() == aFather->GetID())
1443 isRefOrSubShape = true;
1445 aFather = aFather->GetFather();
1449 if (isRefOrSubShape)
1450 myGeomObjects[i++] = aGeomGroup;
1453 myGeomObjects->length(i);
1465 if (myCurrentLineEdit == mySubMeshLine)
1466 aString = tr( "SMESH_SUBMESH_SELECTED" ).arg(aNbSel);
1467 else if (myCurrentLineEdit == myGroupLine)
1468 aString = tr( "SMESH_GROUP_SELECTED" ).arg(aNbSel);
1469 else if (myCurrentLineEdit == myGeomGroupLine)
1470 aString = tr( "%1 Objects" ).arg(aNbSel);
1473 aString = aList.First()->getName();
1477 myCurrentLineEdit->setText(aString);
1478 myCurrentLineEdit->home(false);
1479 // 07.06.2008 skl for IPAL19574:
1480 // change name of group only if it is empty
1481 if( myName->text().trimmed().isEmpty() || !myNameChanged ) {
1482 myOldName = myName->text();
1483 myName->blockSignals(true);
1484 myName->setText(aString);
1485 myName->blockSignals(false);
1490 else // !myCurrentLineEdit: local selection of nodes or elements
1492 if (aNbSel == 1 && myActorsList.count() > 0 )
1494 // NPAL19389: create a group with a selection in another group
1495 // Switch myActor to the newly selected one, if the last
1496 // is visible and belongs to group or submesh of myMesh
1497 /* Handle(SALOME_InteractiveObject) curIO = myActor->getIO();
1498 Handle(SALOME_InteractiveObject) selIO = aList.First();
1499 if (curIO->hasEntry() && selIO->hasEntry()) {
1500 const char* selEntry = selIO->getEntry();
1501 if (strcmp(curIO->getEntry(), selEntry) != 0) {
1502 // different objects: selected and myActor
1503 SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
1504 if (aViewWindow && aViewWindow->isVisible(selIO)) {
1505 // newly selected actor is visible
1508 _PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
1510 CORBA::String_var meshEntry = aSObject->GetID().c_str();
1511 int len = strlen(meshEntry);
1513 if (strncmp(selEntry, meshEntry, len) == 0) {
1514 // selected object is myMesh or a part of it
1515 SMESH_Actor* anActor = SMESH::FindActorByEntry(selEntry);
1518 SMESH::SetPickable(myActor);
1527 QString aListStr = "";
1529 if (myTypeId == 0) {
1530 QListIterator<SMESH_Actor*> it( myActorsList );
1531 while ( it.hasNext() ) {
1533 aNbItems += SMESH::GetNameOfSelectedNodes(mySelector, it.next()->getIO(), tmpStr);
1537 QListIterator<SMESH_Actor*> it( myActorsList );
1538 while ( it.hasNext() ) {
1540 aNbItems += SMESH::GetNameOfSelectedElements(mySelector, it.next()->getIO(), tmpStr);
1545 QListWidgetItem* anItem;
1546 QList<QListWidgetItem*> listItemsToSel;
1547 QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts);
1548 for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
1549 QList<QListWidgetItem*> found = myElements->findItems(*it, Qt::MatchExactly);
1550 foreach(anItem, found)
1551 if (!anItem->isSelected())
1552 listItemsToSel.push_back(anItem);
1554 bool blocked = myElements->signalsBlocked();
1555 myElements->blockSignals(true);
1556 foreach(anItem, listItemsToSel) anItem->setSelected(true);
1557 myElements->blockSignals(blocked);
1558 onListSelectionChanged();
1559 listItemsToSel.clear();
1564 if (myActorsList.count() == 0) {
1565 if (!myGroup->_is_nil()) {
1566 SMESH_Actor* anActor = SMESH::FindActorByObject(myGroup);
1568 myActorsList.append( anActor );
1570 else if(!myGroupOnGeom->_is_nil()) {
1571 SMESH_Actor* anActor = SMESH::FindActorByObject(myGroupOnGeom);
1573 myActorsList.append( anActor );
1576 SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
1578 myActorsList.append( anActor );
1582 // somehow, if we display the mesh, while selecting from another actor,
1583 // the mesh becomes pickable, and there is no way to select any element
1584 if (myActorsList.count() > 0) {
1585 QListIterator<SMESH_Actor*> it( myActorsList );
1586 while ( it.hasNext() ) {
1587 SMESH_Actor* anActor = it.next();
1588 if ( IsActorVisible(anActor) )
1589 anActor->SetPickable(true);
1596 //=================================================================================
1597 // function : onSelectAll()
1598 // purpose : Called when "Select all" is checked
1599 //=================================================================================
1600 void SMESHGUI_GroupDlg::onSelectAll()
1602 bool noElemsModif = ( mySelectAll->isChecked() || !myAllowElemsModif->isChecked() );
1604 myElementsLab->setEnabled( !noElemsModif );
1605 myElements->setEnabled ( !noElemsModif );
1606 myFilterBtn->setEnabled ( !noElemsModif );
1607 myAddBtn->setEnabled ( !noElemsModif );
1608 myRemoveBtn->setEnabled ( !noElemsModif );
1609 mySortBtn->setEnabled ( !noElemsModif );
1610 mySelectBox->setEnabled ( !noElemsModif );
1611 myAllowElemsModif->setEnabled( !mySelectAll->isChecked() );
1612 if ( noElemsModif ) mySMESHGUI->ResetState();
1613 else mySMESHGUI->SetState(800);
1615 int selMode = mySelectionMode;
1616 mySelectionMode = grpNoSelection;
1617 setSelectionMode( selMode );
1621 //=================================================================================
1622 // function : onSelectSubMesh()
1623 // purpose : Called when selection in 3D view or ObjectBrowser is changed
1624 //=================================================================================
1625 void SMESHGUI_GroupDlg::onSelectSubMesh(bool on)
1628 if (mySelectGroup->isChecked()) {
1629 mySelectGroup->setChecked(false);
1631 //VSR: else if (mySelectGeomGroup->isChecked()) {
1632 //VSR: mySelectGeomGroup->setChecked(false);
1634 myCurrentLineEdit = mySubMeshLine;
1635 setSelectionMode(grpSubMeshSelection);
1638 mySubMeshLine->setText( "" );
1639 myCurrentLineEdit = 0;
1641 setSelectionMode(myTypeId);
1643 mySubMeshBtn->setEnabled(on);
1644 mySubMeshLine->setEnabled(on);
1648 //=================================================================================
1649 // function : (onSelectGroup)
1650 // purpose : Called when selection in 3D view or ObjectBrowser is changed
1651 //=================================================================================
1652 void SMESHGUI_GroupDlg::onSelectGroup(bool on)
1655 if (mySelectSubMesh->isChecked()) {
1656 mySelectSubMesh->setChecked(false);
1658 myCurrentLineEdit = myGroupLine;
1659 setSelectionMode(grpGroupSelection);
1662 myGroupLine->setText( "" );
1663 myCurrentLineEdit = 0;
1665 setSelectionMode(myTypeId);
1667 myGroupBtn->setEnabled(on);
1668 myGroupLine->setEnabled(on);
1672 //=================================================================================
1673 // function : (onSelectGeomGroup)
1674 // purpose : Called when group type changed. on == "on geometry" or "on filter"
1675 //=================================================================================
1676 void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on)
1679 if (mySelectSubMesh->isChecked()) {
1680 mySelectSubMesh->setChecked(false);
1682 else if (mySelectGroup->isChecked()) {
1683 mySelectGroup->setChecked(false);
1685 if ( myGrpTypeId == 1 ) { // on geometry
1686 myCurrentLineEdit = myGeomGroupLine;
1690 myCurrentLineEdit = 0;
1692 setSelectionMode(grpAllSelection);
1695 myGeomGroupBtn->setChecked(false);
1696 myGeomObjects->length(0);
1697 myGeomGroupLine->setText( "" );
1698 myCurrentLineEdit = 0;
1700 setSelectionMode( myTypeId );
1704 //=================================================================================
1705 // function : setCurrentSelection()
1707 //=================================================================================
1708 void SMESHGUI_GroupDlg::setCurrentSelection()
1710 QPushButton* send = (QPushButton*)sender();
1711 myCurrentLineEdit = 0;
1712 if (send == myMeshGroupBtn) {
1713 disconnect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
1714 mySelectionMgr->clearSelected();
1716 setSelectionMode(grpMeshSelection);
1718 setSelectionMode(grpGroupSelection);
1719 connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
1720 myCurrentLineEdit = myMeshGroupLine;
1721 onObjectSelectionChanged();
1723 else if (send == mySubMeshBtn) {
1724 myCurrentLineEdit = mySubMeshLine;
1725 onObjectSelectionChanged();
1727 else if (send == myGroupBtn) {
1728 myCurrentLineEdit = myGroupLine;
1729 onObjectSelectionChanged();
1734 //=================================================================================
1735 // function : setFilters()
1736 // purpose : SLOT. Called when "Filter" button pressed.
1737 //=================================================================================
1738 void SMESHGUI_GroupDlg::setFilters()
1740 if(myMesh->_is_nil()) {
1741 SUIT_MessageBox::critical(this,
1743 tr("NO_MESH_SELECTED"));
1747 SMESH::ElementType aType = SMESH::ALL;
1750 case grpNodeSelection: aType = SMESH::NODE; break;
1751 case grp0DSelection: aType = SMESH::ELEM0D; break;
1752 case grpBallSelection: aType = SMESH::BALL; break;
1753 case grpEdgeSelection: aType = SMESH::EDGE; break;
1754 case grpFaceSelection: aType = SMESH::FACE; break;
1755 case grpVolumeSelection: aType = SMESH::VOLUME; break;
1759 if ( myFilterDlg == 0 )
1761 myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, aType );
1762 connect( myFilterDlg, SIGNAL( Accepted() ), SLOT( onFilterAccepted() ) );
1765 myFilterDlg->Init( aType );
1767 if ( !myGroupOnFilter->_is_nil() )
1769 myFilterDlg->SetFilter( myFilter, aType );
1770 myFilterDlg->Init( aType );
1773 bool isStandalone = ( sender() == myFilterBtn );
1774 myFilterDlg->SetEnabled( /*setInViewer=*/isStandalone,
1775 /*diffSources=*/isStandalone );
1776 myFilterDlg->SetMesh( myMesh );
1777 myFilterDlg->SetGroup( myGroupOnFilter );
1778 myFilterDlg->SetSelection();
1779 myFilterDlg->SetSourceWg( myElements, false );
1781 myFilterDlg->show();
1784 //=================================================================================
1785 // function : onFilterAccepted()
1786 // purpose : SLOT. Called when Filter dlg closed with OK button.
1787 // Uncheck "Select submesh" and "Select group" checkboxes
1788 //=================================================================================
1789 void SMESHGUI_GroupDlg::onFilterAccepted()
1791 if ( mySelectSubMesh->isChecked() || mySelectGroup->isChecked() )
1793 mySelectionMode = myTypeId;
1794 mySelectSubMesh->setChecked( false );
1795 mySelectGroup->setChecked( false );
1797 // get a filter from myFilterDlg
1798 myFilter = myFilterDlg->GetFilter();
1799 if ( !myFilter->_is_nil() ) {
1800 SMESH::Predicate_var perdicate = myFilter->GetPredicate();
1801 if ( perdicate->_is_nil() )
1802 myFilter = SMESH::Filter::_nil();
1804 // set mesh to myFilter
1805 if ( !myFilter->_is_nil() ) {
1806 SMESH::SMESH_Mesh_var mesh = myMesh;
1807 if ( mesh->_is_nil() ) {
1808 if ( !myGroup->_is_nil() )
1809 mesh = myGroup->GetMesh();
1810 else if ( !myGroupOnGeom->_is_nil() )
1811 mesh = myGroupOnGeom->GetMesh();
1812 else if ( !myGroupOnFilter->_is_nil() )
1813 mesh = myGroupOnFilter->GetMesh();
1815 myFilter->SetMesh( mesh );
1817 // highlight ids if selection changed in the Viewer (IPAL52924)
1818 myCurrentLineEdit = 0;
1819 onObjectSelectionChanged();
1825 //=================================================================================
1826 // function : onAdd()
1828 //=================================================================================
1829 void SMESHGUI_GroupDlg::onAdd()
1831 SALOME_ListIO aList;
1832 mySelectionMgr->selectedObjects( aList );
1834 int aNbSel = aList.Extent();
1836 if (aNbSel == 0 || myActorsList.count() == 0 || myMesh->_is_nil()) return;
1838 SUIT_OverrideCursor wc;
1841 int sizeBefore = myElements->count();
1843 SMESH::ElementType aType = SMESH::ALL;
1845 case grpNodeSelection:
1846 aType = SMESH::NODE;
1847 mySelector->SetSelectionMode(NodeSelection);
1849 case grpBallSelection:
1850 aType = SMESH::BALL;
1851 mySelector->SetSelectionMode(BallSelection);
1853 case grp0DSelection:
1854 aType = SMESH::ELEM0D;
1855 mySelector->SetSelectionMode(Elem0DSelection);
1857 case grpEdgeSelection:
1858 aType = SMESH::EDGE;
1859 mySelector->SetSelectionMode(EdgeSelection);
1861 case grpFaceSelection:
1862 aType = SMESH::FACE;
1863 mySelector->SetSelectionMode(FaceSelection);
1865 case grpVolumeSelection:
1866 aType = SMESH::VOLUME;
1867 mySelector->SetSelectionMode(VolumeSelection);
1870 mySelector->SetSelectionMode(ActorSelection);
1873 QListWidgetItem* anItem = 0;
1874 QList<QListWidgetItem*> listItemsToSel;
1876 if ( myCurrentLineEdit == 0 )
1878 //if (aNbSel != 1) { myIsBusy = false; return; }
1879 QString aListStr = "";
1881 if (myTypeId == 0) {
1882 QListIterator<SMESH_Actor*> it( myActorsList );
1883 while ( it.hasNext() ) {
1885 aNbItems += SMESH::GetNameOfSelectedNodes(mySelector, it.next()->getIO(), tmpStr);
1890 QListIterator<SMESH_Actor*> it( myActorsList );
1891 while ( it.hasNext() ) {
1893 aNbItems += SMESH::GetNameOfSelectedElements(mySelector, it.next()->getIO(), tmpStr);
1898 QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts);
1899 for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
1900 QList<QListWidgetItem*> found = myElements->findItems(*it, Qt::MatchExactly);
1901 if (found.count() == 0) {
1902 anItem = new QListWidgetItem(*it);
1903 myElements->addItem(anItem);
1904 if (!anItem->isSelected())
1905 listItemsToSel.push_back(anItem);
1908 foreach(anItem, found)
1909 if (!anItem->isSelected())
1910 listItemsToSel.push_back(anItem);
1913 bool blocked = myElements->signalsBlocked();
1914 myElements->blockSignals(true);
1915 foreach(anItem, listItemsToSel) anItem->setSelected(true);
1916 myElements->blockSignals(blocked);
1917 onListSelectionChanged();
1918 listItemsToSel.clear();
1921 else if ( myCurrentLineEdit == mySubMeshLine )
1923 //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
1925 SALOME_ListIO aList;
1926 mySelectionMgr->selectedObjects( aList );
1928 SALOME_ListIteratorOfListIO anIt (aList);
1929 for ( ; anIt.More(); anIt.Next()) {
1930 SMESH::SMESH_subMesh_var aSubMesh =
1931 SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
1932 if (!aSubMesh->_is_nil()) {
1933 // check if mesh is the same
1934 if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
1936 SMESH::long_array_var anElements = aSubMesh->GetElementsByType(aType);
1937 int k = anElements->length();
1938 for (int i = 0; i < k; i++) {
1939 QString aText = QString::number(anElements[i]);
1940 QList<QListWidgetItem*> found = myElements->findItems(aText, Qt::MatchExactly);
1941 if (found.count() == 0) {
1942 anItem = new QListWidgetItem(aText);
1943 myElements->addItem(anItem);
1944 if (!anItem->isSelected())
1945 listItemsToSel.push_back(anItem);
1948 foreach(anItem, found)
1949 if (!anItem->isSelected())
1950 listItemsToSel.push_back(anItem);
1953 bool blocked = myElements->signalsBlocked();
1954 myElements->blockSignals(true);
1955 foreach(anItem, listItemsToSel) anItem->setSelected(true);
1956 myElements->blockSignals(blocked);
1957 onListSelectionChanged();
1958 listItemsToSel.clear();
1960 catch (const SALOME::SALOME_Exception& ex) {
1961 SalomeApp_Tools::QtCatchCorbaException(ex);
1966 mySelectSubMesh->setChecked(false);
1968 onListSelectionChanged();
1971 else if ( myCurrentLineEdit == myGroupLine )
1973 //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
1974 SALOME_ListIO aList;
1975 mySelectionMgr->selectedObjects( aList );
1977 SALOME_ListIteratorOfListIO anIt (aList);
1978 for ( ; anIt.More(); anIt.Next()) {
1979 SMESH::SMESH_GroupBase_var aGroup =
1980 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIt.Value());
1981 if (!aGroup->_is_nil()) {
1982 // check if mesh is the same
1983 if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
1984 SMESH::long_array_var anElements = aGroup->GetListOfID();
1985 int k = anElements->length();
1986 for (int i = 0; i < k; i++) {
1987 QString aText = QString::number(anElements[i]);
1988 QList<QListWidgetItem*> found = myElements->findItems(aText, Qt::MatchExactly);
1989 if (found.count() == 0) {
1990 anItem = new QListWidgetItem(aText);
1991 myElements->addItem(anItem);
1992 if (!anItem->isSelected())
1993 listItemsToSel.push_back(anItem);
1996 foreach(anItem, found)
1997 if (!anItem->isSelected())
1998 listItemsToSel.push_back(anItem);
2001 bool blocked = myElements->signalsBlocked();
2002 myElements->blockSignals(true);
2003 foreach(anItem, listItemsToSel) anItem->setSelected(true);
2004 myElements->blockSignals(blocked);
2005 onListSelectionChanged();
2006 listItemsToSel.clear();
2010 mySelectGroup->setChecked(false);
2012 onListSelectionChanged();
2015 else if ( myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1 )
2017 GEOM::GEOM_IGroupOperations_wrap aGroupOp =
2018 SMESH::GetGEOMGen( myGeomObjects[0] )->GetIGroupOperations();
2020 SMESH::ElementType aGroupType = SMESH::ALL;
2021 switch(aGroupOp->GetType(myGeomObjects[0])) {
2022 case TopAbs_VERTEX: aGroupType = SMESH::NODE; break;
2023 case TopAbs_EDGE: aGroupType = SMESH::EDGE; break;
2024 case TopAbs_FACE: aGroupType = SMESH::FACE; break;
2025 case TopAbs_SOLID: aGroupType = SMESH::VOLUME; break;
2026 default: myIsBusy = false; return;
2029 if (aGroupType == aType) {
2030 _PTR(SObject) aGroupSO =
2031 //SMESH::getStudy()->FindObjectIOR(SMESH::getStudy()->ConvertObjectToIOR(myGeomGroup));
2032 SMESH::getStudy()->FindObjectID(myGeomObjects[0]->GetStudyEntry());
2034 SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
2035 SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
2036 SMESH::BelongToGeom_var aBelongToGeom = aFilterMgr->CreateBelongToGeom();
2037 aBelongToGeom->SetGeom(myGeomObjects[0]);
2038 aBelongToGeom->SetShapeName(aGroupSO->GetName().c_str());
2039 aBelongToGeom->SetElementType(aType);
2040 aFilter->SetPredicate(aBelongToGeom);
2042 SMESH::long_array_var anElements = aFilter->GetElementsId(myMesh);
2044 int k = anElements->length();
2045 for (int i = 0; i < k; i++) {
2046 QString aText = QString::number(anElements[i]);
2047 QList<QListWidgetItem*> found = myElements->findItems(aText, Qt::MatchExactly);
2048 if (found.count() == 0) {
2049 anItem = new QListWidgetItem(aText);
2050 myElements->addItem(anItem);
2051 if (!anItem->isSelected())
2052 listItemsToSel.push_back(anItem);
2055 foreach(anItem, found)
2056 if (!anItem->isSelected())
2057 listItemsToSel.push_back(anItem);
2060 bool blocked = myElements->signalsBlocked();
2061 myElements->blockSignals(true);
2062 foreach(anItem, listItemsToSel) anItem->setSelected(true);
2063 myElements->blockSignals(blocked);
2064 onListSelectionChanged();
2065 listItemsToSel.clear();
2068 //VSR: mySelectGeomGroup->setChecked(false);
2070 onListSelectionChanged();
2073 if ( sizeBefore < myElements->count() )
2074 ++myNbChangesOfContents;
2075 // mySelectionMgr->clearSelected();
2079 //=================================================================================
2080 // function : onRemove()
2082 //=================================================================================
2083 void SMESHGUI_GroupDlg::onRemove()
2086 int sizeBefore = myElements->count();
2088 if (myCurrentLineEdit == 0) {
2089 QList<QListWidgetItem*> selItems = myElements->selectedItems();
2090 QListWidgetItem* item;
2091 foreach(item, selItems) delete item;
2093 SALOME_ListIO aList;
2094 mySelectionMgr->selectedObjects( aList );
2096 int aNbSel = aList.Extent();
2098 if (aNbSel == 0) { myIsBusy = false; return; }
2100 SMESH::ElementType aType = SMESH::ALL;
2102 case grpNodeSelection: aType = SMESH::NODE; break;
2103 case grp0DSelection: aType = SMESH::ELEM0D; break;
2104 case grpBallSelection: aType = SMESH::BALL; break;
2105 case grpEdgeSelection: aType = SMESH::EDGE; break;
2106 case grpFaceSelection: aType = SMESH::FACE; break;
2107 case grpVolumeSelection: aType = SMESH::VOLUME; break;
2110 if (myCurrentLineEdit == mySubMeshLine) {
2111 //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
2112 SALOME_ListIO aList;
2113 mySelectionMgr->selectedObjects( aList );
2115 SALOME_ListIteratorOfListIO anIt (aList);
2116 for ( ; anIt.More(); anIt.Next()) {
2117 SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
2118 if (!aSubMesh->_is_nil()) {
2119 // check if mesh is the same
2120 if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
2121 if (aType == SMESH::NODE) {
2123 SMESH::long_array_var anElements = aSubMesh->GetNodesId();
2124 int k = anElements->length();
2125 for (int i = 0; i < k; i++) {
2126 QList<QListWidgetItem*> found =
2127 myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
2128 QListWidgetItem* anItem;
2129 foreach(anItem, found) delete anItem;
2132 catch (const SALOME::SALOME_Exception& ex) {
2133 SalomeApp_Tools::QtCatchCorbaException(ex);
2138 SMESH::long_array_var anElements = aSubMesh->GetElementsId();
2139 int k = anElements->length();
2140 for (int i = 0; i < k; i++) {
2141 QList<QListWidgetItem*> found =
2142 myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
2143 QListWidgetItem* anItem;
2144 foreach(anItem, found) delete anItem;
2147 catch (const SALOME::SALOME_Exception& ex) {
2148 SalomeApp_Tools::QtCatchCorbaException(ex);
2155 else if (myCurrentLineEdit == myGroupLine) {
2156 SALOME_ListIO aList;
2157 mySelectionMgr->selectedObjects( aList );
2159 SALOME_ListIteratorOfListIO anIt (aList);
2160 for ( ; anIt.More(); anIt.Next()) {
2161 SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
2162 if (!aGroup->_is_nil()) {
2163 // check if mesh is the same
2164 if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
2165 SMESH::long_array_var anElements = aGroup->GetListOfID();
2166 int k = anElements->length();
2167 for (int i = 0; i < k; i++) {
2168 QList<QListWidgetItem*> found =
2169 myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
2170 QListWidgetItem* anItem;
2171 foreach(anItem, found) delete anItem;
2179 if ( sizeBefore > myElements->count() )
2180 myNbChangesOfContents += 2; // it's used to detect that "Add" was only once
2184 //=================================================================================
2185 // function : onSort()
2187 //=================================================================================
2188 void SMESHGUI_GroupDlg::onSort()
2190 // PAL5412: sorts items in ascending by "string" value
2191 // myElements->sort(true);
2192 // myElements->update();
2193 int i, k = myElements->count();
2196 QList<int> aSelected;
2197 std::vector<int> anArray(k);
2198 // QMemArray<int> anArray(k);
2200 for (i = 0; i < k; i++) {
2201 int id = myElements->item(i)->text().toInt();
2203 if (myElements->item(i)->isSelected())
2204 aSelected.append(id);
2206 // sort & update list
2207 std::sort(anArray.begin(), anArray.end());
2209 myElements->clear();
2210 QListWidgetItem* anItem;
2211 QList<QListWidgetItem*> listItemsToSel;
2212 for (i = 0; i < k; i++) {
2213 anItem = new QListWidgetItem(QString::number(anArray[i]));
2214 myElements->addItem(anItem);
2215 if (aSelected.contains(anArray[i]))
2216 listItemsToSel.push_back(anItem);
2218 bool blocked = myElements->signalsBlocked();
2219 myElements->blockSignals(true);
2220 foreach(anItem, listItemsToSel) anItem->setSelected(true);
2221 myElements->blockSignals(blocked);
2222 listItemsToSel.clear();
2227 //=================================================================================
2228 // function : onVisibilityChanged()
2230 //=================================================================================
2231 void SMESHGUI_GroupDlg::onVisibilityChanged()
2233 SetAppropriateActor();
2236 //=================================================================================
2237 // function : SMESHGUI_GroupDlg::reject
2238 // purpose : SLOT called when "Close" button pressed. Close dialog
2239 //=================================================================================
2240 void SMESHGUI_GroupDlg::reject()
2242 if (SMESH::GetCurrentVtkView()) {
2243 SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
2244 SMESH::SetPointRepresentation(false);
2245 SMESH::SetPickable();
2246 restoreShowEntityMode();
2249 if( isApplyAndClose() && !myObjectToSelect.isEmpty() ) {
2250 SUIT_DataOwnerPtrList aList;
2251 aList.append( new LightApp_DataOwner( myObjectToSelect ) );
2252 mySelectionMgr->setSelected( aList );
2255 mySelectionMgr->clearSelected();
2256 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
2257 aViewWindow->SetSelectionMode(ActorSelection);
2258 mySelectionMgr->clearFilters();
2259 mySMESHGUI->ResetState();
2263 if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
2266 //=================================================================================
2267 // function : onOpenView()
2269 //=================================================================================
2270 void SMESHGUI_GroupDlg::onOpenView()
2273 SMESH::SetPointRepresentation(false);
2276 mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
2277 mySMESHGUI->EmitSignalDeactivateDialog();
2282 //=================================================================================
2283 // function : onCloseView()
2285 //=================================================================================
2286 void SMESHGUI_GroupDlg::onCloseView()
2292 //=================================================================================
2293 // function : onHelp()
2295 //=================================================================================
2296 void SMESHGUI_GroupDlg::onHelp()
2298 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
2301 app->onHelpContextModule
2302 ( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) : QString(""), myHelpFileName );
2307 QString platform = "winapplication";
2309 QString platform = "application";
2311 SUIT_MessageBox::warning(this, tr( "WRN_WARNING" ),
2312 tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
2313 arg(app->resourceMgr()->stringValue( "ExternalBrowser", platform)).
2314 arg(myHelpFileName));
2318 //=================================================================================
2319 // function : SMESHGUI_GroupDlg::onDeactivate
2320 // purpose : SLOT called when dialog must be deactivated
2321 //=================================================================================
2322 void SMESHGUI_GroupDlg::onDeactivate()
2324 mySMESHGUI->ResetState();
2328 //=================================================================================
2329 // function : SMESHGUI_GroupDlg::enterEvent
2330 // purpose : Event filter
2331 //=================================================================================
2332 void SMESHGUI_GroupDlg::enterEvent (QEvent*)
2335 SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
2336 if ( aViewWindow && !mySelector) {
2337 mySelector = aViewWindow->GetSelector();
2339 mySMESHGUI->EmitSignalDeactivateDialog();
2341 mySelectionMode = grpNoSelection;
2342 setSelectionMode(myTypeId);
2343 mySMESHGUI->SetActiveDialogBox(this);
2344 if ( mySelectBox->isEnabled() ) mySMESHGUI->SetState(800);
2345 else mySMESHGUI->ResetState();
2349 //=================================================================================
2350 // function : keyPressEvent()
2352 //=================================================================================
2353 void SMESHGUI_GroupDlg::keyPressEvent( QKeyEvent* e )
2355 QDialog::keyPressEvent( e );
2356 if ( e->isAccepted() )
2359 if ( e->key() == Qt::Key_F1 )
2366 //================================================================================
2368 * \brief Enable showing of the popup when Geometry selection btn is clicked
2369 * \param enable - true to enable
2371 //================================================================================
2373 enum { DIRECT_GEOM_INDEX = 0, GEOM_BY_MESH_INDEX };
2375 void SMESHGUI_GroupDlg::updateGeomPopup()
2377 bool enable = false;
2379 if ( !myMesh->_is_nil() )
2380 enable = myMesh->NbEdges() > 0;
2382 if ( myGeomGroupBtn )
2384 disconnect( myGeomGroupBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
2386 if ( !myGeomPopup ) {
2387 myGeomPopup = new QMenu(this);
2388 myActions[myGeomPopup->addAction( tr( "DIRECT_GEOM_SELECTION" ) )] = DIRECT_GEOM_INDEX;
2389 myActions[myGeomPopup->addAction( tr( "GEOM_BY_MESH_ELEM_SELECTION" ) )] = GEOM_BY_MESH_INDEX;
2390 connect( myGeomPopup, SIGNAL( triggered( QAction* ) ), SLOT( onGeomPopup( QAction* ) ) );
2392 connect( myGeomGroupBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
2398 //=================================================================================
2399 // function : onGeomSelectionButton()
2401 //=================================================================================
2402 void SMESHGUI_GroupDlg::onGeomSelectionButton(bool isBtnOn)
2404 if ( myGeomPopup && isBtnOn )
2406 myCurrentLineEdit = myGeomGroupLine;
2407 QAction* a = myGeomPopup->exec( QCursor::pos() );
2408 if (!a || myActions[a] == DIRECT_GEOM_INDEX)
2409 setSelectionMode(grpGeomSelection);
2413 myCurrentLineEdit = 0;
2414 setSelectionMode(grpAllSelection);
2418 //=================================================================================
2419 // function : onGeomPopup()
2421 //=================================================================================
2422 void SMESHGUI_GroupDlg::onGeomPopup( QAction* a )
2424 int index = myActions[a];
2425 if ( index == GEOM_BY_MESH_INDEX )
2427 mySelectionMode = grpNoSelection;
2428 if ( !myShapeByMeshOp ) {
2429 myShapeByMeshOp = new SMESHGUI_ShapeByMeshOp(true);
2430 connect(myShapeByMeshOp, SIGNAL(committed(SUIT_Operation*)),
2431 SLOT(onPublishShapeByMeshDlg(SUIT_Operation*)));
2432 connect(myShapeByMeshOp, SIGNAL(aborted(SUIT_Operation*)),
2433 SLOT(onCloseShapeByMeshDlg(SUIT_Operation*)));
2435 // set mesh object to SMESHGUI_ShapeByMeshOp and start it
2436 if ( !myMesh->_is_nil() ) {
2438 hide(); // stop processing selection
2440 myShapeByMeshOp->setModule( mySMESHGUI );
2441 myShapeByMeshOp->setStudy( 0 ); // it's really necessary
2442 myShapeByMeshOp->SetMesh( myMesh );
2443 myShapeByMeshOp->start();
2448 //================================================================================
2450 * \brief SLOT. Is called when Ok is pressed in SMESHGUI_ShapeByMeshDlg
2452 //================================================================================
2454 void SMESHGUI_GroupDlg::onPublishShapeByMeshDlg(SUIT_Operation* op)
2456 if ( myShapeByMeshOp == op ) {
2457 mySMESHGUI->getApp()->updateObjectBrowser();
2459 // Select a found geometry object
2460 GEOM::GEOM_Object_var aGeomVar = myShapeByMeshOp->GetShape();
2461 if ( !aGeomVar->_is_nil() )
2463 QString ID = aGeomVar->GetStudyEntry();
2464 if ( _PTR(SObject) aGeomSO = SMESH::getStudy()->FindObjectID( ID.toLatin1().data() )) {
2465 SALOME_ListIO anIOList;
2466 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
2467 ( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );
2468 anIOList.Append( anIO );
2469 mySelectionMgr->setSelectedObjects( anIOList, false );
2470 onObjectSelectionChanged();
2476 //================================================================================
2478 * \brief SLOT. Is called when Close is pressed in SMESHGUI_ShapeByMeshDlg
2480 //================================================================================
2482 void SMESHGUI_GroupDlg::onCloseShapeByMeshDlg(SUIT_Operation* op)
2484 if ( myShapeByMeshOp == op )
2487 setSelectionMode(grpGeomSelection);
2491 //=================================================================================
2492 // function : setGroupColor()
2494 //=================================================================================
2495 void SMESHGUI_GroupDlg::setGroupColor( const SALOMEDS::Color& theColor )
2497 QColor aQColor( (int)( theColor.R * 255.0 ),
2498 (int)( theColor.G * 255.0 ),
2499 (int)( theColor.B * 255.0 ) );
2500 setGroupQColor( aQColor );
2503 //=================================================================================
2504 // function : getGroupColor()
2506 //=================================================================================
2507 SALOMEDS::Color SMESHGUI_GroupDlg::getGroupColor() const
2509 QColor aQColor = getGroupQColor();
2511 SALOMEDS::Color aColor;
2512 aColor.R = (float)aQColor.red() / 255.0;
2513 aColor.G = (float)aQColor.green() / 255.0;
2514 aColor.B = (float)aQColor.blue() / 255.0;
2519 //=================================================================================
2520 // function : setGroupQColor()
2522 //=================================================================================
2523 void SMESHGUI_GroupDlg::setGroupQColor( const QColor& theColor )
2525 if( theColor.isValid() )
2526 myColorBtn->setColor( theColor );
2529 //=================================================================================
2530 // function : getGroupQColor()
2532 //=================================================================================
2533 QColor SMESHGUI_GroupDlg::getGroupQColor() const
2535 return myColorBtn->color();
2538 //=================================================================================
2539 // function : setDefaultGroupColor()
2541 //=================================================================================
2542 void SMESHGUI_GroupDlg::setDefaultGroupColor()
2544 if( myMesh->_is_nil() )
2547 bool isAutoColor = myMesh->GetAutoColor();
2549 QColor aQColor = myColorBtn->color();
2552 if ( !aQColor.isValid() ) {
2553 int r = 0, g = 0, b = 0;
2554 SMESH::GetColor( "SMESH", "default_grp_color", r, g, b, QColor( 255, 170, 0 ) );
2555 aQColor.setRgb( r, g, b );
2560 #ifdef SIMPLE_AUTOCOLOR // simplified algorithm for auto-colors
2561 SALOMEDS::Color aColor = SMESHGUI::getPredefinedUniqueColor();
2562 #else // old algorithm for auto-colors
2563 SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
2565 QList<SALOMEDS::Color> aReservedColors;
2566 for( int i = 0, n = aListOfGroups.length(); i < n; i++ )
2568 SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
2569 SALOMEDS::Color aReservedColor = aGroupObject->GetColor();
2570 aReservedColors.append( aReservedColor );
2573 SALOMEDS::Color aColor = SMESHGUI::getUniqueColor( aReservedColors );
2574 #endif // SIMPLE_AUTOCOLOR
2576 aQColor.setRgb( (int)( aColor.R * 255.0 ),
2577 (int)( aColor.G * 255.0 ),
2578 (int)( aColor.B * 255.0 ) );
2582 setGroupQColor( aQColor );
2585 //=================================================================================
2586 // function : SetAppropriateActor()
2587 // purpose : Find more appropriate of visible actors, set it to myActor, allow picking
2588 // NPAL19389: create a group with a selection in another group.
2589 // if mesh actor is not visible - find any first visible group or sub-mesh
2590 //=================================================================================
2591 bool SMESHGUI_GroupDlg::SetAppropriateActor()
2593 bool isActor = false;
2594 myActorsList.clear();
2596 if (myMesh->_is_nil()) return false;
2598 SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
2600 if (myGrpTypeGroup->checkedId() > 0) { // try current group on geometry actor
2601 SMESH_Actor* anActor = 0;
2602 if (!myGroupOnGeom->_is_nil())
2603 anActor = SMESH::FindActorByObject(myGroupOnGeom);
2604 if (!myGroupOnFilter->_is_nil())
2605 anActor = SMESH::FindActorByObject(myGroupOnFilter);
2606 if (anActor && anActor->hasIO())
2609 if (aViewWindow && !aViewWindow->isVisible(anActor->getIO()))
2612 myActorsList.append(anActor);
2618 SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
2619 if (anActor && anActor->hasIO()) {
2621 if (aViewWindow && !aViewWindow->isVisible(anActor->getIO()))
2624 myActorsList.append(anActor);
2628 SMESH_Actor* aGroupActor = 0;
2629 if (!isActor && !myGroup->_is_nil()) {
2630 aGroupActor = SMESH::FindActorByObject(myGroup);
2631 if (aGroupActor && aGroupActor->hasIO())
2632 myActorsList.append(aGroupActor);
2635 // try any visible actor of group or sub-mesh of current mesh
2638 _PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
2640 CORBA::String_var meshEntry = aSObject->GetID().c_str();
2641 int len = strlen(meshEntry);
2643 // iterate on all actors in current view window, search for
2644 // any visible actor, that belongs to group or submesh of current mesh
2645 VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors());
2646 vtkActorCollection *aCollection = aCopy.GetActors();
2647 int nbItems = aCollection->GetNumberOfItems();
2648 for (int i=0; i<nbItems && !isActor; i++)
2650 SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(aCollection->GetItemAsObject(i));
2651 if (anActor && anActor->hasIO()) {
2652 Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
2653 if (aViewWindow->isVisible(anIO)) {
2654 if (anIO->hasEntry() && strncmp(anIO->getEntry(), meshEntry, len) == 0 && !myActorsList.contains(anActor) )
2655 myActorsList.append(anActor);
2662 // Show a standalone group if nothing else is visible (IPAL52227)
2663 if ( myActorsList.count() == 1 &&
2664 myActorsList[0] == aGroupActor &&
2665 aViewWindow && !aViewWindow->isVisible(aGroupActor->getIO()))
2666 SMESH::UpdateView( aViewWindow, SMESH::eDisplay, aGroupActor->getIO()->getEntry() );
2670 if (myActorsList.count() > 0) {
2671 QListIterator<SMESH_Actor*> it( myActorsList );
2672 while ( it.hasNext() ) {
2673 SMESH_Actor* anActor = it.next();
2674 if ( IsActorVisible(anActor) )
2675 anActor->SetPickable(true);
2679 return ( isActor || (myActorsList.count() > 0) );
2682 //=======================================================================
2683 //function : setShowEntityMode
2684 //purpose : make shown only entity corresponding to my type
2685 //=======================================================================
2686 void SMESHGUI_GroupDlg::setShowEntityMode()
2688 if ( !myMesh->_is_nil() ) {
2689 if ( SMESH_Actor* actor = SMESH::FindActorByObject(myMesh) ) {
2690 if (!myStoredShownEntity)
2691 myStoredShownEntity = actor->GetEntityMode();
2692 switch ( myTypeId ) {
2693 case grpNodeSelection: restoreShowEntityMode(); break;
2694 case grp0DSelection: actor->SetEntityMode( SMESH_Actor::e0DElements ); break;
2695 case grpBallSelection: actor->SetEntityMode( SMESH_Actor::eBallElem ); break;
2696 case grpEdgeSelection: actor->SetEntityMode( SMESH_Actor::eEdges ); break;
2697 case grpFaceSelection: actor->SetEntityMode( SMESH_Actor::eFaces ); break;
2698 case grpVolumeSelection: actor->SetEntityMode( SMESH_Actor::eVolumes ); break;
2704 //=======================================================================
2705 //function : restoreShowEntityMode
2706 //purpose : restore ShowEntity mode of myActor
2707 //=======================================================================
2708 void SMESHGUI_GroupDlg::restoreShowEntityMode()
2710 if ( myStoredShownEntity && !myMesh->_is_nil() ) {
2711 if ( SMESH_Actor* actor = SMESH::FindActorByObject(myMesh) ) {
2712 actor->SetEntityMode(myStoredShownEntity);
2715 myStoredShownEntity = 0;
2718 //=======================================================================
2719 //function : IsActorVisible
2720 //purpose : return visibility of the actor
2721 //=======================================================================
2722 bool SMESHGUI_GroupDlg::IsActorVisible( SMESH_Actor* theActor )
2724 SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
2725 if (theActor && aViewWindow)
2726 return aViewWindow->isVisible(theActor->getIO());
2730 //================================================================
2731 //function : setIsApplyAndClose
2732 //purpose : Set value of the flag indicating that the dialog is
2733 // accepted by Apply & Close button
2734 //================================================================
2735 void SMESHGUI_GroupDlg::setIsApplyAndClose( const bool theFlag )
2737 myIsApplyAndClose = theFlag;
2740 //================================================================
2741 //function : isApplyAndClose
2742 //purpose : Get value of the flag indicating that the dialog is
2743 // accepted by Apply & Close button
2744 //================================================================
2745 bool SMESHGUI_GroupDlg::isApplyAndClose() const
2747 return myIsApplyAndClose;