1 // Copyright (C) 2007-2016 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_page.html" : "editing_groups_page.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 SalomeApp_Study* appStudy =
502 dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
503 if ( !appStudy ) return aName;
504 _PTR(Study) aStudy = appStudy->studyDS();
506 std::set<std::string> aSet;
507 _PTR(SComponent) aMeshCompo (aStudy->FindComponent( "SMESH" ));
509 _PTR(ChildIterator) it (aStudy->NewChildIterator(aMeshCompo));
511 for (it->InitEx(true); it->More(); it->Next()) {
513 aSet.insert(obj->GetName());
517 // build a unique name
519 bool isUnique = false;
521 aName = theOperation + "_" + QString::number(++aNumber);
522 isUnique = (aSet.count(std::string(SMESH::toUtf8(aName))) == 0);
528 void SMESHGUI_GroupDlg::setDefaultName() const
531 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
533 QString aPrefix ="Group_";
537 aResName = aPrefix + QString::number( i++ );
538 anObj = aStudy->FindObject( SMESH::toUtf8(aResName) );
541 myName->setText(aResName);
544 //=================================================================================
547 //=================================================================================
548 void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
550 mySelectionMgr->installFilter(myMeshFilter);
552 /* init data from current selection */
553 restoreShowEntityMode();
554 myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
556 myGroup = SMESH::SMESH_Group::_nil();
557 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
558 myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
560 // NPAL19389: create a group with a selection in another group
561 // set actor of myMesh, if it is visible, else try
562 // any visible actor of group or submesh of myMesh
563 SetAppropriateActor();
565 setDefaultGroupColor();
570 mySelectionMgr->selectedObjects( aList );
571 if( !aList.IsEmpty() )
573 QString aName = aList.First()->getName();
574 myMeshGroupLine->setText(aName);//??????
575 myMeshGroupLine->home( false );
578 myCurrentLineEdit = 0;
580 myTypeGroup->button(0)->setChecked(true);
584 //=================================================================================
587 //=================================================================================
588 void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
589 const bool theIsConvert)
591 restoreShowEntityMode();
592 myMesh = theGroup->GetMesh();
595 myNameChanged = true;
596 myName->blockSignals(true);
597 myName->setText(SMESH::fromUtf8(theGroup->GetName()));
598 myName->blockSignals(false);
601 SALOMEDS::Color aColor = theGroup->GetColor();
602 setGroupColor( aColor );
604 myMeshGroupLine->setText(SMESH::fromUtf8(theGroup->GetName()));
607 switch(theGroup->GetType()) {
608 case SMESH::NODE: aType = grpNodeSelection; break;
609 case SMESH::ELEM0D: aType = grp0DSelection; break;
610 case SMESH::BALL: aType = grpBallSelection; break;
611 case SMESH::EDGE: aType = grpEdgeSelection; break;
612 case SMESH::FACE: aType = grpFaceSelection; break;
613 case SMESH::VOLUME: aType = grpVolumeSelection; break;
615 case SMESH::NB_ELEMENT_TYPES: break;
617 myTypeGroup->button(aType)->setChecked(true);
619 myGroup = SMESH::SMESH_Group::_narrow( theGroup );
620 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup );
621 myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_narrow( theGroup );
622 myFilter = SMESH::Filter::_nil();
624 if (myGroup->_is_nil() && myGroupOnGeom->_is_nil() && myGroupOnFilter->_is_nil() )
627 // NPAL19389: create a group with a selection in another group
628 // set actor of myMesh, if it is visible, else set
629 // actor of theGroup, if it is visible, else try
630 // any visible actor of group or submesh of myMesh
631 // commented, because an attempt to set selection on not displayed cells leads to error
632 SetAppropriateActor();
634 /* SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
636 anActor = SMESH::FindActorByObject(theGroup);
637 SMESH::SetPickable(anActor);*/
639 int grpType = (!myGroup->_is_nil() ? 0 : (theIsConvert ? 0 : myGroupOnGeom->_is_nil() ? 2 : 1));
640 myGrpTypeGroup->button(grpType)->setChecked(true);
641 onGrpTypeChanged(grpType);
644 if ( grpType == 0 ) { // standalone group
645 myCurrentLineEdit = 0;
647 myAllowElemsModif->setChecked( true );
649 setSelectionMode(aType);
651 setShowEntityMode(); // depends on myTypeId
654 if (!theGroup->IsEmpty()) {
655 SMESH::long_array_var anElements = theGroup->GetListOfID();
656 int k = anElements->length();
657 for (int i = 0; i < k; i++) {
658 myIdList.append(anElements[i]);
659 myElements->addItem(QString::number(anElements[i]));
661 myElements->selectAll();
664 else if ( grpType == 1 ) // group on geom
666 QString aShapeName( "" );
667 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
668 GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape();
669 if (!aGroupShape->_is_nil())
671 _PTR(SObject) aGroupShapeSO = aStudy->FindObjectID(aGroupShape->GetStudyEntry());
673 aShapeName = aGroupShapeSO->GetName().c_str();
675 myGeomGroupLine->setText( aShapeName );
677 else // group on filter
679 myFilter = myGroupOnFilter->GetFilter();
680 if ( !myFilter->_is_nil() ) {
681 SMESH::Predicate_var perdicate = myFilter->GetPredicate();
682 if ( perdicate->_is_nil() )
683 myFilter = SMESH::Filter::_nil();
689 myNameChanged = true;
690 myName->blockSignals(true);
691 myName->setText(SMESH::fromUtf8(theGroup->GetName()));
692 myName->blockSignals(false);
695 onSelectAll(); //updateButtons();
698 //=================================================================================
699 // function : updateButtons()
701 //=================================================================================
702 void SMESHGUI_GroupDlg::updateButtons()
704 bool enable = !myName->text().trimmed().isEmpty();
707 if (myGrpTypeId == 0) { // standalone
708 if ( !mySelectAll->isChecked() )
710 if ( myAllowElemsModif->isChecked() )
712 enable = ( myElements->count() > 0 );
714 else if ((enable = !myFilter->_is_nil() ))
716 SMESH::array_of_ElementType_var types = myFilter->GetTypes();
717 enable = types->length();
720 enable = enable && (!myGroup->_is_nil() || !myMesh->_is_nil());
722 else if (myGrpTypeId == 1) // on geom
724 if (CORBA::is_nil(myGroupOnGeom)) // creation mode
725 enable = ( myGeomObjects->length() > 0 && !myMesh->_is_nil() );
727 else if (myGrpTypeId == 2) // on filter
729 if (( enable = !myFilter->_is_nil() ))
730 if (CORBA::is_nil(myGroupOnFilter) ) // creation mode
731 enable = !myMesh->_is_nil();
735 bool meshHasGeom = ( myMesh->_is_nil() || myMesh->HasShapeToMesh() );
736 if ( myGrpTypeId != 1 )
738 myGrpTypeGroup->button(1)->setEnabled( meshHasGeom );
742 myGeomGroupBtn->setEnabled( meshHasGeom );
743 myGeomGroupLine->setEnabled( meshHasGeom );
746 myOKBtn->setEnabled(enable);
747 myApplyBtn->setEnabled(enable);
750 //=================================================================================
751 // function : onNameChanged()
753 //=================================================================================
754 void SMESHGUI_GroupDlg::onNameChanged (const QString& text)
756 myOldName = myName->text();
758 myNameChanged = !myName->text().trimmed().isEmpty();
761 //=================================================================================
762 // function : onTypeChanged()
763 // purpose : Group elements type radio button management
764 //=================================================================================
765 void SMESHGUI_GroupDlg::onTypeChanged (int id)
767 if (myTypeId != id) {
770 if ( myGrpTypeId == 0 && myCurrentLineEdit == 0)
771 setSelectionMode(id);
773 setSelectionMode( mySelectionMode++ ); // update according to mySelectionMode
775 onObjectSelectionChanged();
780 //=================================================================================
781 // function : onGrpTypeChanged()
782 // purpose : Group type radio button management
783 //=================================================================================
784 void SMESHGUI_GroupDlg::onGrpTypeChanged (int id)
786 if (myGrpTypeId != id) {
788 myWGStack->setCurrentIndex( id );
789 myName->blockSignals(true);
790 myName->setText(myOldName);
791 myName->blockSignals(false);
792 onSelectGeomGroup(id != 0);
797 //=================================================================================
798 // function : onColorChanged()
799 // purpose : Color button management
800 //=================================================================================
801 void SMESHGUI_GroupDlg::onColorChanged(QColor theColor)
806 //=================================================================================
807 // function : setSelectionMode()
808 // purpose : Radio button management
809 //=================================================================================
810 void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
813 if (myMesh->_is_nil())
815 SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
816 bool isSelectAll = mySelectAll->isChecked() || !myAllowElemsModif->isChecked() || myGrpTypeId != 0;
817 if (mySelectionMode != theMode) {
818 // [PAL10408] mySelectionMgr->clearSelected();
819 mySelectionMgr->clearFilters();
820 SMESH::RemoveFilters();
822 if (myActorsList.count() > 0)
823 for (QListIterator<SMESH_Actor*> it( myActorsList ); it.hasNext(); )
824 it.next()->SetPointRepresentation(false);
826 SMESH::SetPointRepresentation(false);
829 case grpNodeSelection:
830 if ( myGrpTypeId == 0 ) // standalone
832 if (myActorsList.count() > 0)
833 for (QListIterator<SMESH_Actor*> it( myActorsList ); it.hasNext(); )
834 it.next()->SetPointRepresentation(true);
836 SMESH::SetPointRepresentation(true);
838 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : NodeSelection);
840 case grpEdgeSelection:
841 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : EdgeSelection);
843 case grpBallSelection:
844 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : BallSelection);
847 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : Elem0DSelection);
849 case grpFaceSelection:
850 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : FaceSelection);
852 case grpVolumeSelection:
853 if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : VolumeSelection);
855 case grpSubMeshSelection: {
857 SMESH_TypeFilter* f = 0;
859 case grpNodeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH); break;
860 case grpEdgeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_EDGE); break;
861 case grpFaceSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_FACE); break;
862 case grpVolumeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_SOLID); break;
863 default: f = new SMESH_TypeFilter(SMESH::SUBMESH);
865 QList<SUIT_SelectionFilter*> filtList;
866 filtList.append( f );
867 filtList.append( new SMESH_TypeFilter(SMESH::SUBMESH_COMPOUND));
868 mySubMeshFilter->setFilters( filtList );
870 mySelectionMgr->installFilter( mySubMeshFilter );
872 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
875 case grpGroupSelection: {
877 SMESH_TypeFilter* f = 0;
879 case grpNodeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_NODE); break;
880 case grp0DSelection: f = new SMESH_TypeFilter(SMESH::GROUP_0D); break;
881 case grpBallSelection: f = new SMESH_TypeFilter(SMESH::GROUP_BALL); break;
882 case grpEdgeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_EDGE); break;
883 case grpFaceSelection: f = new SMESH_TypeFilter(SMESH::GROUP_FACE); break;
884 case grpVolumeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_VOLUME); break;
885 default: f = new SMESH_TypeFilter(SMESH::GROUP);
887 QList<SUIT_SelectionFilter*> filtList;
888 filtList.append( f );
889 myGroupFilter->setFilters( filtList );
891 mySelectionMgr->installFilter(myGroupFilter);
892 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
895 case grpMeshSelection:
896 mySelectionMgr->installFilter(myMeshFilter);
897 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
899 case grpGeomSelection:
900 mySelectionMgr->installFilter(myGeomFilter);
901 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
904 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
907 if ( aViewWindow ) aViewWindow->Repaint();
908 mySelectionMode = theMode;
912 //=================================================================================
913 // function : onApply()
915 //=================================================================================
916 bool SMESHGUI_GroupDlg::onApply()
918 if (mySMESHGUI->isActiveStudyLocked())
921 if (myName->text().trimmed().isEmpty())
924 SMESH::ElementType aType = SMESH::ALL;
926 case grpNodeSelection: aType = SMESH::NODE; break;
927 case grp0DSelection: aType = SMESH::ELEM0D; break;
928 case grpBallSelection: aType = SMESH::BALL; break;
929 case grpEdgeSelection: aType = SMESH::EDGE; break;
930 case grpFaceSelection: aType = SMESH::FACE; break;
931 case grpVolumeSelection: aType = SMESH::VOLUME; break;
935 QStringList anEntryList;
937 SMESH::SMESH_GroupBase_var resultGroup;
938 bool isCreation = false, isConversion = false;
940 SUIT_OverrideCursor wc;
942 if (myGrpTypeId == 0) // standalone
944 if (!mySelectAll->isChecked() && !myElements->count() && myAllowElemsModif->isChecked())
947 mySelectionMgr->clearSelected();
949 if (myGroup->_is_nil()) { // creation or conversion
950 // check if group on geometry is not null
951 if (!myGroupOnGeom->_is_nil() || !myGroupOnFilter->_is_nil()) {
952 if (myMesh->_is_nil())
954 if ( myGroupOnGeom->_is_nil() )
955 myGroup = myMesh->ConvertToStandalone( myGroupOnFilter );
957 myGroup = myMesh->ConvertToStandalone( myGroupOnGeom );
959 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
960 myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
965 if (myGroup->_is_nil()) { // creation
966 if (myMesh->_is_nil())
969 myGroup = SMESH::AddGroup(myMesh, aType, myName->text());
971 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroup );
974 if ( mySelectAll->isChecked() ) {
976 myGroup->AddFrom(myMesh.in());
981 if ( !myFilter->_is_nil() &&
982 ( myNbChangesOfContents == 1 || !myAllowElemsModif->isChecked()))
984 myGroup->AddFrom( myFilter );
988 SMESH::long_array_var anIdList = new SMESH::long_array;
989 int i, k = myElements->count();
991 for (i = 0; i < k; i++) {
992 anIdList[i] = myElements->item(i)->text().toInt();
994 myGroup->Add(anIdList.inout());
1001 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroup );
1004 if ( mySelectAll->isChecked() ) {
1007 myGroup->AddFrom(myMesh.in());
1010 QList<int> aAddList;
1012 int i, total = myElements->count();
1013 for (i = 0; i < total; i++) {
1014 int anId = myElements->item(i)->text().toInt();
1015 int idx = myIdList.indexOf(anId);
1017 aAddList.append(anId);
1019 myIdList.removeAt(idx);
1021 if (!aAddList.empty()) {
1022 SMESH::long_array_var anIdList = new SMESH::long_array;
1023 int added = aAddList.count();
1024 anIdList->length(added);
1025 for (i = 0; i < added; i++)
1026 anIdList[i] = aAddList[i];
1027 myGroup->Add(anIdList.inout());
1029 if (!myIdList.empty()) {
1030 SMESH::long_array_var anIdList = new SMESH::long_array;
1031 int removed = myIdList.count();
1032 anIdList->length(removed);
1033 for (i = 0; i < removed; i++)
1034 anIdList[i] = myIdList[i];
1035 myGroup->Remove(anIdList.inout());
1037 /* init for next operation */
1039 for (i = 0; i < total; i++) {
1040 myIdList.append(myElements->item(i)->text().toInt());
1047 else if (myGrpTypeId == 1) // on geom object
1049 if (CORBA::is_nil(myGroupOnGeom)) { // creation
1050 if (myMesh->_is_nil() || !myGeomObjects->length())
1053 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1055 if (myGeomObjects->length() == 1) {
1056 myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
1057 SMESH::toUtf8(myName->text()),
1061 SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
1062 if ( aSMESHGen->_is_nil() )
1065 // create a geometry group
1066 GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
1067 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1069 if (geomGen->_is_nil() || !aStudy)
1072 GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId());
1076 // check and add all selected GEOM objects: they must be
1077 // a sub-shapes of the main GEOM and must be of one type
1078 TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
1079 for ( int i =0; i < (int)myGeomObjects->length(); i++) {
1080 TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
1082 aGroupType = aSubShapeType;
1083 else if (aSubShapeType != aGroupType) {
1084 aGroupType = TopAbs_SHAPE;
1089 GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
1090 GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
1091 op->UnionList(aGroupVar, myGeomObjects);
1094 // publish the GEOM group in study
1095 QString aNewGeomGroupName ( "Auto_group_for_" );
1096 aNewGeomGroupName += myName->text();
1097 SALOMEDS::SObject_var aNewGroupSO =
1098 geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar,
1099 SMESH::toUtf8(aNewGeomGroupName), aMeshShape);
1102 myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
1103 SMESH::toUtf8(myName->text()),
1106 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
1112 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
1117 if (myGrpTypeId == 2) // group on filter
1119 if ( myFilter->_is_nil() ) return false;
1121 if (CORBA::is_nil(myGroupOnFilter)) { // creation
1122 if (myMesh->_is_nil())
1125 myGroupOnFilter = myMesh->CreateGroupFromFilter(aType,
1126 SMESH::toUtf8(myName->text()),
1129 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
1134 myGroupOnFilter->SetFilter( myFilter );
1136 resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
1144 SALOMEDS::Color aColor = getGroupColor();
1145 resultGroup->SetColor(aColor);
1147 _PTR(SObject) aMeshGroupSO = SMESH::FindSObject( resultGroup );
1149 anEntryList.append( aMeshGroupSO->GetID().c_str() );
1151 resultGroup->SetName(SMESH::toUtf8(myName->text().trimmed()));
1155 SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" );
1157 /* init for the next operation */
1159 myElements->clear();
1160 myGroup = SMESH::SMESH_Group::_nil();
1161 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
1162 myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
1163 myFilter = SMESH::Filter::_nil();
1165 setDefaultGroupColor(); // reset color for case if 'auto-color' feature is enabled.
1171 if ( SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str()))
1173 Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
1174 if ( isConversion ) { // need to reset TVisualObj and actor
1175 SMESH::RemoveVisualObjectWithActors( anIO->getEntry(), true );
1176 SMESH::Update( anIO,true);
1177 myActorsList.clear();
1178 anActor = SMESH::FindActorByEntry( anIO->getEntry() );
1179 if ( !anActor ) return false;
1180 myActorsList.append( anActor );
1182 anActor->setName(SMESH::toUtf8(myName->text()));
1185 switch ( myTypeId ) {
1186 case grpNodeSelection: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
1187 case grp0DSelection: anActor->Set0DColor ( aColor.R, aColor.G, aColor.B ); break;
1188 case grpBallSelection: anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
1189 case grpEdgeSelection: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
1190 case grpVolumeSelection:
1191 SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100");
1192 anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break;
1194 case grpFaceSelection:
1196 SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100");
1197 anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
1200 // update a visible group accoding to a changed contents
1201 if ( !isConversion && anActor->GetVisibility() )
1203 SMESH::Update( anIO, true );
1204 SMESH::RepaintCurrentView();
1209 SMESHGUI::Modified();
1210 mySMESHGUI->updateObjBrowser(true);
1211 mySelectionMgr->clearSelected();
1213 if( LightApp_Application* anApp =
1214 dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
1215 myObjectToSelect = anApp->browseObjects( anEntryList, isApplyAndClose() );
1220 //=================================================================================
1221 // function : onOK()
1223 //=================================================================================
1224 void SMESHGUI_GroupDlg::onOK()
1226 setIsApplyAndClose( true );
1229 setIsApplyAndClose( false );
1231 if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
1234 //=================================================================================
1235 // function : onListSelectionChanged()
1236 // purpose : Called when selection in element list is changed
1237 //=================================================================================
1238 void SMESHGUI_GroupDlg::onListSelectionChanged()
1240 //MESSAGE( "SMESHGUI_GroupDlg::onListSelectionChanged(); myActorsList.count() = " << myActorsList.count());
1241 if( myIsBusy || myActorsList.count() == 0 ) return;
1244 if (myCurrentLineEdit == 0) {
1245 mySelectionMgr->clearSelected();
1246 TColStd_MapOfInteger aIndexes;
1247 QList<QListWidgetItem*> selItems = myElements->selectedItems();
1248 QListWidgetItem* anItem;
1249 foreach(anItem, selItems) aIndexes.Add(anItem->text().toInt());
1250 mySelector->AddOrRemoveIndex(myActorsList.first()->getIO(), aIndexes, false);
1251 SALOME_ListIO aList;
1252 aList.Append(myActorsList.first()->getIO());
1253 mySelectionMgr->setSelectedObjects(aList,false);
1258 //=================================================================================
1259 // function : onObjectSelectionChanged()
1260 // purpose : Called when selection in 3D view or ObjectBrowser is changed
1261 //=================================================================================
1262 void SMESHGUI_GroupDlg::onObjectSelectionChanged()
1264 if ( myIsBusy || !isEnabled()) return;
1265 if (myCurrentLineEdit == myGeomGroupLine && !myGeomGroupBtn->isChecked()) return;
1269 SALOME_ListIO aList;
1270 mySelectionMgr->selectedObjects( aList );
1272 int aNbSel = aList.Extent();
1273 myElements->clearSelection();
1275 if (myCurrentLineEdit)
1277 myCurrentLineEdit->setText( "" );
1278 QString aString = "";
1280 if (myCurrentLineEdit == myMeshGroupLine)
1282 mySelectSubMesh->setEnabled(false);
1283 mySelectGroup->setEnabled(false);
1284 myGroupLine->setText( "" );
1285 mySubMeshLine->setText( "" );
1287 myGeomGroupBtn->setEnabled(false);
1288 myGeomGroupLine->setEnabled(false);
1289 myGeomGroupLine->setText( "" );
1290 myGeomObjects = new GEOM::ListOfGO();
1291 myGeomObjects->length(0);
1293 if (myGeomGroupBtn->isChecked())
1294 myGeomGroupBtn->setChecked(false);
1296 myName->setText( "" );
1298 myElements->clear();
1301 myGroup = SMESH::SMESH_Group::_nil();
1302 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
1303 restoreShowEntityMode();
1304 myMesh = SMESH::SMESH_Mesh::_nil();
1310 Handle(SALOME_InteractiveObject) IO = aList.First();
1313 restoreShowEntityMode();
1314 myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
1315 setShowEntityMode();
1317 if (myMesh->_is_nil())
1324 if ( myFilterDlg && !myMesh->_is_nil()){
1325 myFilterDlg->SetMesh( myMesh );
1327 myGroup = SMESH::SMESH_Group::_nil();
1329 // NPAL19389: create a group with a selection in another group
1330 // set actor of myMesh, if it is visible, else try
1331 // any visible actor of group or submesh of myMesh
1332 SetAppropriateActor();
1334 setDefaultGroupColor();
1335 if (myName->text().isEmpty())
1338 aString = aList.First()->getName();
1339 myMeshGroupLine->setText(aString);
1340 myMeshGroupLine->home( false );
1342 mySelectSubMesh->setEnabled(true);
1343 mySelectGroup->setEnabled(true);
1344 myGeomGroupBtn->setEnabled(true);
1345 myGeomGroupLine->setEnabled(true);
1349 SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
1350 if (aGroup->_is_nil())
1357 myGroup = SMESH::SMESH_Group::_nil();
1358 myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
1362 mySelectSubMesh->setEnabled(true);
1363 mySelectGroup->setEnabled(true);
1365 myCurrentLineEdit = 0;
1370 if (myGrpTypeId == 0)
1376 myElements->clear();
1377 setSelectionMode(myTypeId);
1385 else if (myCurrentLineEdit == myGeomGroupLine)
1387 myGeomObjects = new GEOM::ListOfGO();
1390 _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
1392 if (aNbSel == 0 || !aMeshSO)
1394 myGeomObjects->length(0);
1400 myGeomObjects->length(aNbSel);
1402 GEOM::GEOM_Object_var aGeomGroup;
1405 SALOME_ListIteratorOfListIO anIt (aList);
1406 for (; anIt.More(); anIt.Next())
1408 aGeomGroup = GEOMBase::ConvertIOinGEOMObject(anIt.Value());
1410 // Check if the object is a geometry group
1411 if (CORBA::is_nil(aGeomGroup))
1414 // Check if group constructed on the same shape as a mesh or on its child
1415 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1417 // The main shape of the group
1418 GEOM::GEOM_Object_var aGroupMainShape;
1419 if (aGeomGroup->GetType() == 37) {
1420 GEOM::GEOM_IGroupOperations_wrap anOp =
1421 SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
1422 aGroupMainShape = anOp->GetMainShape(aGeomGroup);
1423 // aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
1426 aGroupMainShape = aGeomGroup;
1427 aGroupMainShape->Register();
1429 _PTR(SObject) aGroupMainShapeSO =
1430 aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
1432 _PTR(SObject) anObj, aRef;
1433 bool isRefOrSubShape = false;
1434 if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) {
1435 if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
1436 isRefOrSubShape = true;
1438 _PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
1439 _PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
1440 while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
1441 if (aRef->GetID() == aFather->GetID())
1442 isRefOrSubShape = true;
1444 aFather = aFather->GetFather();
1448 if (isRefOrSubShape)
1449 myGeomObjects[i++] = aGeomGroup;
1452 myGeomObjects->length(i);
1464 if (myCurrentLineEdit == mySubMeshLine)
1465 aString = tr( "SMESH_SUBMESH_SELECTED" ).arg(aNbSel);
1466 else if (myCurrentLineEdit == myGroupLine)
1467 aString = tr( "SMESH_GROUP_SELECTED" ).arg(aNbSel);
1468 else if (myCurrentLineEdit == myGeomGroupLine)
1469 aString = tr( "%1 Objects" ).arg(aNbSel);
1472 aString = aList.First()->getName();
1476 myCurrentLineEdit->setText(aString);
1477 myCurrentLineEdit->home(false);
1478 // 07.06.2008 skl for IPAL19574:
1479 // change name of group only if it is empty
1480 if( myName->text().trimmed().isEmpty() || !myNameChanged ) {
1481 myOldName = myName->text();
1482 myName->blockSignals(true);
1483 myName->setText(aString);
1484 myName->blockSignals(false);
1489 else // !myCurrentLineEdit: local selection of nodes or elements
1491 if (aNbSel == 1 && myActorsList.count() > 0 )
1493 // NPAL19389: create a group with a selection in another group
1494 // Switch myActor to the newly selected one, if the last
1495 // is visible and belongs to group or submesh of myMesh
1496 /* Handle(SALOME_InteractiveObject) curIO = myActor->getIO();
1497 Handle(SALOME_InteractiveObject) selIO = aList.First();
1498 if (curIO->hasEntry() && selIO->hasEntry()) {
1499 const char* selEntry = selIO->getEntry();
1500 if (strcmp(curIO->getEntry(), selEntry) != 0) {
1501 // different objects: selected and myActor
1502 SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
1503 if (aViewWindow && aViewWindow->isVisible(selIO)) {
1504 // newly selected actor is visible
1507 _PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
1509 CORBA::String_var meshEntry = aSObject->GetID().c_str();
1510 int len = strlen(meshEntry);
1512 if (strncmp(selEntry, meshEntry, len) == 0) {
1513 // selected object is myMesh or a part of it
1514 SMESH_Actor* anActor = SMESH::FindActorByEntry(selEntry);
1517 SMESH::SetPickable(myActor);
1526 QString aListStr = "";
1528 if (myTypeId == 0) {
1529 QListIterator<SMESH_Actor*> it( myActorsList );
1530 while ( it.hasNext() ) {
1532 aNbItems += SMESH::GetNameOfSelectedNodes(mySelector, it.next()->getIO(), tmpStr);
1536 QListIterator<SMESH_Actor*> it( myActorsList );
1537 while ( it.hasNext() ) {
1539 aNbItems += SMESH::GetNameOfSelectedElements(mySelector, it.next()->getIO(), tmpStr);
1544 QListWidgetItem* anItem;
1545 QList<QListWidgetItem*> listItemsToSel;
1546 QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts);
1547 for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
1548 QList<QListWidgetItem*> found = myElements->findItems(*it, Qt::MatchExactly);
1549 foreach(anItem, found)
1550 if (!anItem->isSelected())
1551 listItemsToSel.push_back(anItem);
1553 bool blocked = myElements->signalsBlocked();
1554 myElements->blockSignals(true);
1555 foreach(anItem, listItemsToSel) anItem->setSelected(true);
1556 myElements->blockSignals(blocked);
1557 onListSelectionChanged();
1558 listItemsToSel.clear();
1563 if (myActorsList.count() == 0) {
1564 if (!myGroup->_is_nil()) {
1565 SMESH_Actor* anActor = SMESH::FindActorByObject(myGroup);
1567 myActorsList.append( anActor );
1569 else if(!myGroupOnGeom->_is_nil()) {
1570 SMESH_Actor* anActor = SMESH::FindActorByObject(myGroupOnGeom);
1572 myActorsList.append( anActor );
1575 SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
1577 myActorsList.append( anActor );
1581 // somehow, if we display the mesh, while selecting from another actor,
1582 // the mesh becomes pickable, and there is no way to select any element
1583 if (myActorsList.count() > 0) {
1584 QListIterator<SMESH_Actor*> it( myActorsList );
1585 while ( it.hasNext() ) {
1586 SMESH_Actor* anActor = it.next();
1587 if ( IsActorVisible(anActor) )
1588 anActor->SetPickable(true);
1595 //=================================================================================
1596 // function : onSelectAll()
1597 // purpose : Called when "Select all" is checked
1598 //=================================================================================
1599 void SMESHGUI_GroupDlg::onSelectAll()
1601 bool noElemsModif = ( mySelectAll->isChecked() || !myAllowElemsModif->isChecked() );
1603 myElementsLab->setEnabled( !noElemsModif );
1604 myElements->setEnabled ( !noElemsModif );
1605 myFilterBtn->setEnabled ( !noElemsModif );
1606 myAddBtn->setEnabled ( !noElemsModif );
1607 myRemoveBtn->setEnabled ( !noElemsModif );
1608 mySortBtn->setEnabled ( !noElemsModif );
1609 mySelectBox->setEnabled ( !noElemsModif );
1610 myAllowElemsModif->setEnabled( !mySelectAll->isChecked() );
1611 if ( noElemsModif ) mySMESHGUI->ResetState();
1612 else mySMESHGUI->SetState(800);
1614 int selMode = mySelectionMode;
1615 mySelectionMode = grpNoSelection;
1616 setSelectionMode( selMode );
1620 //=================================================================================
1621 // function : onSelectSubMesh()
1622 // purpose : Called when selection in 3D view or ObjectBrowser is changed
1623 //=================================================================================
1624 void SMESHGUI_GroupDlg::onSelectSubMesh(bool on)
1627 if (mySelectGroup->isChecked()) {
1628 mySelectGroup->setChecked(false);
1630 //VSR: else if (mySelectGeomGroup->isChecked()) {
1631 //VSR: mySelectGeomGroup->setChecked(false);
1633 myCurrentLineEdit = mySubMeshLine;
1634 setSelectionMode(grpSubMeshSelection);
1637 mySubMeshLine->setText( "" );
1638 myCurrentLineEdit = 0;
1640 setSelectionMode(myTypeId);
1642 mySubMeshBtn->setEnabled(on);
1643 mySubMeshLine->setEnabled(on);
1647 //=================================================================================
1648 // function : (onSelectGroup)
1649 // purpose : Called when selection in 3D view or ObjectBrowser is changed
1650 //=================================================================================
1651 void SMESHGUI_GroupDlg::onSelectGroup(bool on)
1654 if (mySelectSubMesh->isChecked()) {
1655 mySelectSubMesh->setChecked(false);
1657 myCurrentLineEdit = myGroupLine;
1658 setSelectionMode(grpGroupSelection);
1661 myGroupLine->setText( "" );
1662 myCurrentLineEdit = 0;
1664 setSelectionMode(myTypeId);
1666 myGroupBtn->setEnabled(on);
1667 myGroupLine->setEnabled(on);
1671 //=================================================================================
1672 // function : (onSelectGeomGroup)
1673 // purpose : Called when group type changed. on == "on geometry" or "on filter"
1674 //=================================================================================
1675 void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on)
1678 if (mySelectSubMesh->isChecked()) {
1679 mySelectSubMesh->setChecked(false);
1681 else if (mySelectGroup->isChecked()) {
1682 mySelectGroup->setChecked(false);
1684 if ( myGrpTypeId == 1 ) { // on geometry
1685 myCurrentLineEdit = myGeomGroupLine;
1689 myCurrentLineEdit = 0;
1691 setSelectionMode(grpAllSelection);
1694 myGeomGroupBtn->setChecked(false);
1695 myGeomObjects->length(0);
1696 myGeomGroupLine->setText( "" );
1697 myCurrentLineEdit = 0;
1699 setSelectionMode( myTypeId );
1703 //=================================================================================
1704 // function : setCurrentSelection()
1706 //=================================================================================
1707 void SMESHGUI_GroupDlg::setCurrentSelection()
1709 QPushButton* send = (QPushButton*)sender();
1710 myCurrentLineEdit = 0;
1711 if (send == myMeshGroupBtn) {
1712 disconnect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
1713 mySelectionMgr->clearSelected();
1715 setSelectionMode(grpMeshSelection);
1717 setSelectionMode(grpGroupSelection);
1718 connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
1719 myCurrentLineEdit = myMeshGroupLine;
1720 onObjectSelectionChanged();
1722 else if (send == mySubMeshBtn) {
1723 myCurrentLineEdit = mySubMeshLine;
1724 onObjectSelectionChanged();
1726 else if (send == myGroupBtn) {
1727 myCurrentLineEdit = myGroupLine;
1728 onObjectSelectionChanged();
1733 //=================================================================================
1734 // function : setFilters()
1735 // purpose : SLOT. Called when "Filter" button pressed.
1736 //=================================================================================
1737 void SMESHGUI_GroupDlg::setFilters()
1739 if(myMesh->_is_nil()) {
1740 SUIT_MessageBox::critical(this,
1742 tr("NO_MESH_SELECTED"));
1746 SMESH::ElementType aType = SMESH::ALL;
1749 case grpNodeSelection: aType = SMESH::NODE; break;
1750 case grp0DSelection: aType = SMESH::ELEM0D; break;
1751 case grpBallSelection: aType = SMESH::BALL; break;
1752 case grpEdgeSelection: aType = SMESH::EDGE; break;
1753 case grpFaceSelection: aType = SMESH::FACE; break;
1754 case grpVolumeSelection: aType = SMESH::VOLUME; break;
1758 if ( myFilterDlg == 0 )
1760 myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, aType );
1761 connect( myFilterDlg, SIGNAL( Accepted() ), SLOT( onFilterAccepted() ) );
1764 myFilterDlg->Init( aType );
1766 if ( !myGroupOnFilter->_is_nil() )
1768 myFilterDlg->SetFilter( myFilter, aType );
1769 myFilterDlg->Init( aType );
1772 bool isStandalone = ( sender() == myFilterBtn );
1773 myFilterDlg->SetEnabled( /*setInViewer=*/isStandalone,
1774 /*diffSources=*/isStandalone );
1775 myFilterDlg->SetMesh( myMesh );
1776 myFilterDlg->SetGroup( myGroupOnFilter );
1777 myFilterDlg->SetSelection();
1778 myFilterDlg->SetSourceWg( myElements, false );
1780 myFilterDlg->show();
1783 //=================================================================================
1784 // function : onFilterAccepted()
1785 // purpose : SLOT. Called when Filter dlg closed with OK button.
1786 // Uncheck "Select submesh" and "Select group" checkboxes
1787 //=================================================================================
1788 void SMESHGUI_GroupDlg::onFilterAccepted()
1790 if ( mySelectSubMesh->isChecked() || mySelectGroup->isChecked() )
1792 mySelectionMode = myTypeId;
1793 mySelectSubMesh->setChecked( false );
1794 mySelectGroup->setChecked( false );
1796 // get a filter from myFilterDlg
1797 myFilter = myFilterDlg->GetFilter();
1798 if ( !myFilter->_is_nil() ) {
1799 SMESH::Predicate_var perdicate = myFilter->GetPredicate();
1800 if ( perdicate->_is_nil() )
1801 myFilter = SMESH::Filter::_nil();
1803 // set mesh to myFilter
1804 if ( !myFilter->_is_nil() ) {
1805 SMESH::SMESH_Mesh_var mesh = myMesh;
1806 if ( mesh->_is_nil() ) {
1807 if ( !myGroup->_is_nil() )
1808 mesh = myGroup->GetMesh();
1809 else if ( !myGroupOnGeom->_is_nil() )
1810 mesh = myGroupOnGeom->GetMesh();
1811 else if ( !myGroupOnFilter->_is_nil() )
1812 mesh = myGroupOnFilter->GetMesh();
1814 myFilter->SetMesh( mesh );
1816 // highlight ids if selection changed in the Viewer (IPAL52924)
1817 myCurrentLineEdit = 0;
1818 onObjectSelectionChanged();
1824 //=================================================================================
1825 // function : onAdd()
1827 //=================================================================================
1828 void SMESHGUI_GroupDlg::onAdd()
1830 SALOME_ListIO aList;
1831 mySelectionMgr->selectedObjects( aList );
1833 int aNbSel = aList.Extent();
1835 if (aNbSel == 0 || myActorsList.count() == 0 || myMesh->_is_nil()) return;
1837 SUIT_OverrideCursor wc;
1840 int sizeBefore = myElements->count();
1842 SMESH::ElementType aType = SMESH::ALL;
1844 case grpNodeSelection:
1845 aType = SMESH::NODE;
1846 mySelector->SetSelectionMode(NodeSelection);
1848 case grpBallSelection:
1849 aType = SMESH::BALL;
1850 mySelector->SetSelectionMode(BallSelection);
1852 case grp0DSelection:
1853 aType = SMESH::ELEM0D;
1854 mySelector->SetSelectionMode(Elem0DSelection);
1856 case grpEdgeSelection:
1857 aType = SMESH::EDGE;
1858 mySelector->SetSelectionMode(EdgeSelection);
1860 case grpFaceSelection:
1861 aType = SMESH::FACE;
1862 mySelector->SetSelectionMode(FaceSelection);
1864 case grpVolumeSelection:
1865 aType = SMESH::VOLUME;
1866 mySelector->SetSelectionMode(VolumeSelection);
1869 mySelector->SetSelectionMode(ActorSelection);
1872 QListWidgetItem* anItem = 0;
1873 QList<QListWidgetItem*> listItemsToSel;
1875 if (myCurrentLineEdit == 0) {
1876 //if (aNbSel != 1) { myIsBusy = false; return; }
1877 QString aListStr = "";
1879 if (myTypeId == 0) {
1880 QListIterator<SMESH_Actor*> it( myActorsList );
1881 while ( it.hasNext() ) {
1883 aNbItems += SMESH::GetNameOfSelectedNodes(mySelector, it.next()->getIO(), tmpStr);
1888 QListIterator<SMESH_Actor*> it( myActorsList );
1889 while ( it.hasNext() ) {
1891 aNbItems += SMESH::GetNameOfSelectedElements(mySelector, it.next()->getIO(), tmpStr);
1896 QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts);
1897 for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
1898 QList<QListWidgetItem*> found = myElements->findItems(*it, Qt::MatchExactly);
1899 if (found.count() == 0) {
1900 anItem = new QListWidgetItem(*it);
1901 myElements->addItem(anItem);
1902 if (!anItem->isSelected())
1903 listItemsToSel.push_back(anItem);
1906 foreach(anItem, found)
1907 if (!anItem->isSelected())
1908 listItemsToSel.push_back(anItem);
1911 bool blocked = myElements->signalsBlocked();
1912 myElements->blockSignals(true);
1913 foreach(anItem, listItemsToSel) anItem->setSelected(true);
1914 myElements->blockSignals(blocked);
1915 onListSelectionChanged();
1916 listItemsToSel.clear();
1918 } else if (myCurrentLineEdit == mySubMeshLine) {
1919 //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
1921 SALOME_ListIO aList;
1922 mySelectionMgr->selectedObjects( aList );
1924 SALOME_ListIteratorOfListIO anIt (aList);
1925 for ( ; anIt.More(); anIt.Next()) {
1926 SMESH::SMESH_subMesh_var aSubMesh =
1927 SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
1928 if (!aSubMesh->_is_nil()) {
1929 // check if mesh is the same
1930 if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
1932 SMESH::long_array_var anElements = aSubMesh->GetElementsByType(aType);
1933 int k = anElements->length();
1934 for (int i = 0; i < k; i++) {
1935 QString aText = QString::number(anElements[i]);
1936 QList<QListWidgetItem*> found = myElements->findItems(aText, Qt::MatchExactly);
1937 if (found.count() == 0) {
1938 anItem = new QListWidgetItem(aText);
1939 myElements->addItem(anItem);
1940 if (!anItem->isSelected())
1941 listItemsToSel.push_back(anItem);
1944 foreach(anItem, found)
1945 if (!anItem->isSelected())
1946 listItemsToSel.push_back(anItem);
1949 bool blocked = myElements->signalsBlocked();
1950 myElements->blockSignals(true);
1951 foreach(anItem, listItemsToSel) anItem->setSelected(true);
1952 myElements->blockSignals(blocked);
1953 onListSelectionChanged();
1954 listItemsToSel.clear();
1956 catch (const SALOME::SALOME_Exception& ex) {
1957 SalomeApp_Tools::QtCatchCorbaException(ex);
1962 mySelectSubMesh->setChecked(false);
1964 onListSelectionChanged();
1966 } else if (myCurrentLineEdit == myGroupLine) {
1967 //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
1968 SALOME_ListIO aList;
1969 mySelectionMgr->selectedObjects( aList );
1971 SALOME_ListIteratorOfListIO anIt (aList);
1972 for ( ; anIt.More(); anIt.Next()) {
1973 SMESH::SMESH_GroupBase_var aGroup =
1974 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIt.Value());
1975 if (!aGroup->_is_nil()) {
1976 // check if mesh is the same
1977 if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
1978 SMESH::long_array_var anElements = aGroup->GetListOfID();
1979 int k = anElements->length();
1980 for (int i = 0; i < k; i++) {
1981 QString aText = QString::number(anElements[i]);
1982 QList<QListWidgetItem*> found = myElements->findItems(aText, Qt::MatchExactly);
1983 if (found.count() == 0) {
1984 anItem = new QListWidgetItem(aText);
1985 myElements->addItem(anItem);
1986 if (!anItem->isSelected())
1987 listItemsToSel.push_back(anItem);
1990 foreach(anItem, found)
1991 if (!anItem->isSelected())
1992 listItemsToSel.push_back(anItem);
1995 bool blocked = myElements->signalsBlocked();
1996 myElements->blockSignals(true);
1997 foreach(anItem, listItemsToSel) anItem->setSelected(true);
1998 myElements->blockSignals(blocked);
1999 onListSelectionChanged();
2000 listItemsToSel.clear();
2004 mySelectGroup->setChecked(false);
2006 onListSelectionChanged();
2008 } else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
2009 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
2010 GEOM::GEOM_IGroupOperations_wrap aGroupOp =
2011 SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
2013 SMESH::ElementType aGroupType = SMESH::ALL;
2014 switch(aGroupOp->GetType(myGeomObjects[0])) {
2015 case TopAbs_VERTEX: aGroupType = SMESH::NODE; break;
2016 case TopAbs_EDGE: aGroupType = SMESH::EDGE; break;
2017 case TopAbs_FACE: aGroupType = SMESH::FACE; break;
2018 case TopAbs_SOLID: aGroupType = SMESH::VOLUME; break;
2019 default: myIsBusy = false; return;
2022 if (aGroupType == aType) {
2023 _PTR(SObject) aGroupSO =
2024 //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(myGeomGroup));
2025 aStudy->FindObjectID(myGeomObjects[0]->GetStudyEntry());
2027 SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
2028 SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
2029 SMESH::BelongToGeom_var aBelongToGeom = aFilterMgr->CreateBelongToGeom();
2030 aBelongToGeom->SetGeom(myGeomObjects[0]);
2031 aBelongToGeom->SetShapeName(aGroupSO->GetName().c_str());
2032 aBelongToGeom->SetElementType(aType);
2033 aFilter->SetPredicate(aBelongToGeom);
2035 SMESH::long_array_var anElements = aFilter->GetElementsId(myMesh);
2037 int k = anElements->length();
2038 for (int i = 0; i < k; i++) {
2039 QString aText = QString::number(anElements[i]);
2040 QList<QListWidgetItem*> found = myElements->findItems(aText, Qt::MatchExactly);
2041 if (found.count() == 0) {
2042 anItem = new QListWidgetItem(aText);
2043 myElements->addItem(anItem);
2044 if (!anItem->isSelected())
2045 listItemsToSel.push_back(anItem);
2048 foreach(anItem, found)
2049 if (!anItem->isSelected())
2050 listItemsToSel.push_back(anItem);
2053 bool blocked = myElements->signalsBlocked();
2054 myElements->blockSignals(true);
2055 foreach(anItem, listItemsToSel) anItem->setSelected(true);
2056 myElements->blockSignals(blocked);
2057 onListSelectionChanged();
2058 listItemsToSel.clear();
2061 //VSR: mySelectGeomGroup->setChecked(false);
2063 onListSelectionChanged();
2066 if ( sizeBefore < myElements->count() )
2067 ++myNbChangesOfContents;
2068 // mySelectionMgr->clearSelected();
2072 //=================================================================================
2073 // function : onRemove()
2075 //=================================================================================
2076 void SMESHGUI_GroupDlg::onRemove()
2079 int sizeBefore = myElements->count();
2081 if (myCurrentLineEdit == 0) {
2082 QList<QListWidgetItem*> selItems = myElements->selectedItems();
2083 QListWidgetItem* item;
2084 foreach(item, selItems) delete item;
2086 SALOME_ListIO aList;
2087 mySelectionMgr->selectedObjects( aList );
2089 int aNbSel = aList.Extent();
2091 if (aNbSel == 0) { myIsBusy = false; return; }
2093 SMESH::ElementType aType = SMESH::ALL;
2095 case grpNodeSelection: aType = SMESH::NODE; break;
2096 case grp0DSelection: aType = SMESH::ELEM0D; break;
2097 case grpBallSelection: aType = SMESH::BALL; break;
2098 case grpEdgeSelection: aType = SMESH::EDGE; break;
2099 case grpFaceSelection: aType = SMESH::FACE; break;
2100 case grpVolumeSelection: aType = SMESH::VOLUME; break;
2103 if (myCurrentLineEdit == mySubMeshLine) {
2104 //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
2105 SALOME_ListIO aList;
2106 mySelectionMgr->selectedObjects( aList );
2108 SALOME_ListIteratorOfListIO anIt (aList);
2109 for ( ; anIt.More(); anIt.Next()) {
2110 SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
2111 if (!aSubMesh->_is_nil()) {
2112 // check if mesh is the same
2113 if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
2114 if (aType == SMESH::NODE) {
2116 SMESH::long_array_var anElements = aSubMesh->GetNodesId();
2117 int k = anElements->length();
2118 for (int i = 0; i < k; i++) {
2119 QList<QListWidgetItem*> found =
2120 myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
2121 QListWidgetItem* anItem;
2122 foreach(anItem, found) delete anItem;
2125 catch (const SALOME::SALOME_Exception& ex) {
2126 SalomeApp_Tools::QtCatchCorbaException(ex);
2131 SMESH::long_array_var anElements = aSubMesh->GetElementsId();
2132 int k = anElements->length();
2133 for (int i = 0; i < k; i++) {
2134 QList<QListWidgetItem*> found =
2135 myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
2136 QListWidgetItem* anItem;
2137 foreach(anItem, found) delete anItem;
2140 catch (const SALOME::SALOME_Exception& ex) {
2141 SalomeApp_Tools::QtCatchCorbaException(ex);
2148 else if (myCurrentLineEdit == myGroupLine) {
2149 SALOME_ListIO aList;
2150 mySelectionMgr->selectedObjects( aList );
2152 SALOME_ListIteratorOfListIO anIt (aList);
2153 for ( ; anIt.More(); anIt.Next()) {
2154 SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
2155 if (!aGroup->_is_nil()) {
2156 // check if mesh is the same
2157 if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
2158 SMESH::long_array_var anElements = aGroup->GetListOfID();
2159 int k = anElements->length();
2160 for (int i = 0; i < k; i++) {
2161 QList<QListWidgetItem*> found =
2162 myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly);
2163 QListWidgetItem* anItem;
2164 foreach(anItem, found) delete anItem;
2172 if ( sizeBefore > myElements->count() )
2173 myNbChangesOfContents += 2; // it's used to detect that "Add" was only once
2177 //=================================================================================
2178 // function : onSort()
2180 //=================================================================================
2181 void SMESHGUI_GroupDlg::onSort()
2183 // PAL5412: sorts items in ascending by "string" value
2184 // myElements->sort(true);
2185 // myElements->update();
2186 int i, k = myElements->count();
2189 QList<int> aSelected;
2190 std::vector<int> anArray(k);
2191 // QMemArray<int> anArray(k);
2193 for (i = 0; i < k; i++) {
2194 int id = myElements->item(i)->text().toInt();
2196 if (myElements->item(i)->isSelected())
2197 aSelected.append(id);
2199 // sort & update list
2200 std::sort(anArray.begin(), anArray.end());
2202 myElements->clear();
2203 QListWidgetItem* anItem;
2204 QList<QListWidgetItem*> listItemsToSel;
2205 for (i = 0; i < k; i++) {
2206 anItem = new QListWidgetItem(QString::number(anArray[i]));
2207 myElements->addItem(anItem);
2208 if (aSelected.contains(anArray[i]))
2209 listItemsToSel.push_back(anItem);
2211 bool blocked = myElements->signalsBlocked();
2212 myElements->blockSignals(true);
2213 foreach(anItem, listItemsToSel) anItem->setSelected(true);
2214 myElements->blockSignals(blocked);
2215 listItemsToSel.clear();
2220 //=================================================================================
2221 // function : onVisibilityChanged()
2223 //=================================================================================
2224 void SMESHGUI_GroupDlg::onVisibilityChanged()
2226 SetAppropriateActor();
2229 //=================================================================================
2230 // function : SMESHGUI_GroupDlg::reject
2231 // purpose : SLOT called when "Close" button pressed. Close dialog
2232 //=================================================================================
2233 void SMESHGUI_GroupDlg::reject()
2235 if (SMESH::GetCurrentVtkView()) {
2236 SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
2237 SMESH::SetPointRepresentation(false);
2238 SMESH::SetPickable();
2239 restoreShowEntityMode();
2242 if( isApplyAndClose() && !myObjectToSelect.isEmpty() ) {
2243 SUIT_DataOwnerPtrList aList;
2244 aList.append( new LightApp_DataOwner( myObjectToSelect ) );
2245 mySelectionMgr->setSelected( aList );
2248 mySelectionMgr->clearSelected();
2249 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
2250 aViewWindow->SetSelectionMode(ActorSelection);
2251 mySelectionMgr->clearFilters();
2252 mySMESHGUI->ResetState();
2256 if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
2259 //=================================================================================
2260 // function : onOpenView()
2262 //=================================================================================
2263 void SMESHGUI_GroupDlg::onOpenView()
2266 SMESH::SetPointRepresentation(false);
2269 mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
2270 mySMESHGUI->EmitSignalDeactivateDialog();
2275 //=================================================================================
2276 // function : onCloseView()
2278 //=================================================================================
2279 void SMESHGUI_GroupDlg::onCloseView()
2285 //=================================================================================
2286 // function : onHelp()
2288 //=================================================================================
2289 void SMESHGUI_GroupDlg::onHelp()
2291 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
2294 app->onHelpContextModule
2295 ( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) : QString(""), myHelpFileName );
2300 QString platform = "winapplication";
2302 QString platform = "application";
2304 SUIT_MessageBox::warning(this, tr( "WRN_WARNING" ),
2305 tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
2306 arg(app->resourceMgr()->stringValue( "ExternalBrowser", platform)).
2307 arg(myHelpFileName));
2311 //=================================================================================
2312 // function : SMESHGUI_GroupDlg::onDeactivate
2313 // purpose : SLOT called when dialog must be deativated
2314 //=================================================================================
2315 void SMESHGUI_GroupDlg::onDeactivate()
2317 mySMESHGUI->ResetState();
2321 //=================================================================================
2322 // function : SMESHGUI_GroupDlg::enterEvent
2323 // purpose : Event filter
2324 //=================================================================================
2325 void SMESHGUI_GroupDlg::enterEvent (QEvent*)
2328 SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
2329 if ( aViewWindow && !mySelector) {
2330 mySelector = aViewWindow->GetSelector();
2332 mySMESHGUI->EmitSignalDeactivateDialog();
2334 mySelectionMode = grpNoSelection;
2335 setSelectionMode(myTypeId);
2336 mySMESHGUI->SetActiveDialogBox(this);
2337 if ( mySelectBox->isEnabled() ) mySMESHGUI->SetState(800);
2338 else mySMESHGUI->ResetState();
2342 //=================================================================================
2343 // function : keyPressEvent()
2345 //=================================================================================
2346 void SMESHGUI_GroupDlg::keyPressEvent( QKeyEvent* e )
2348 QDialog::keyPressEvent( e );
2349 if ( e->isAccepted() )
2352 if ( e->key() == Qt::Key_F1 )
2359 //================================================================================
2361 * \brief Enable showing of the popup when Geometry selection btn is clicked
2362 * \param enable - true to enable
2364 //================================================================================
2366 enum { DIRECT_GEOM_INDEX = 0, GEOM_BY_MESH_INDEX };
2368 void SMESHGUI_GroupDlg::updateGeomPopup()
2370 bool enable = false;
2372 if ( !myMesh->_is_nil() )
2373 enable = myMesh->NbEdges() > 0;
2375 if ( myGeomGroupBtn )
2377 disconnect( myGeomGroupBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
2379 if ( !myGeomPopup ) {
2380 myGeomPopup = new QMenu(this);
2381 myActions[myGeomPopup->addAction( tr( "DIRECT_GEOM_SELECTION" ) )] = DIRECT_GEOM_INDEX;
2382 myActions[myGeomPopup->addAction( tr( "GEOM_BY_MESH_ELEM_SELECTION" ) )] = GEOM_BY_MESH_INDEX;
2383 connect( myGeomPopup, SIGNAL( triggered( QAction* ) ), SLOT( onGeomPopup( QAction* ) ) );
2385 connect( myGeomGroupBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
2391 //=================================================================================
2392 // function : onGeomSelectionButton()
2394 //=================================================================================
2395 void SMESHGUI_GroupDlg::onGeomSelectionButton(bool isBtnOn)
2397 if ( myGeomPopup && isBtnOn )
2399 myCurrentLineEdit = myGeomGroupLine;
2400 QAction* a = myGeomPopup->exec( QCursor::pos() );
2401 if (!a || myActions[a] == DIRECT_GEOM_INDEX)
2402 setSelectionMode(grpGeomSelection);
2406 myCurrentLineEdit = 0;
2407 setSelectionMode(grpAllSelection);
2411 //=================================================================================
2412 // function : onGeomPopup()
2414 //=================================================================================
2415 void SMESHGUI_GroupDlg::onGeomPopup( QAction* a )
2417 int index = myActions[a];
2418 if ( index == GEOM_BY_MESH_INDEX )
2420 mySelectionMode = grpNoSelection;
2421 if ( !myShapeByMeshOp ) {
2422 myShapeByMeshOp = new SMESHGUI_ShapeByMeshOp(true);
2423 connect(myShapeByMeshOp, SIGNAL(committed(SUIT_Operation*)),
2424 SLOT(onPublishShapeByMeshDlg(SUIT_Operation*)));
2425 connect(myShapeByMeshOp, SIGNAL(aborted(SUIT_Operation*)),
2426 SLOT(onCloseShapeByMeshDlg(SUIT_Operation*)));
2428 // set mesh object to SMESHGUI_ShapeByMeshOp and start it
2429 if ( !myMesh->_is_nil() ) {
2431 hide(); // stop processing selection
2433 myShapeByMeshOp->setModule( mySMESHGUI );
2434 myShapeByMeshOp->setStudy( 0 ); // it's really necessary
2435 myShapeByMeshOp->SetMesh( myMesh );
2436 myShapeByMeshOp->start();
2441 //================================================================================
2443 * \brief SLOT. Is called when Ok is pressed in SMESHGUI_ShapeByMeshDlg
2445 //================================================================================
2447 void SMESHGUI_GroupDlg::onPublishShapeByMeshDlg(SUIT_Operation* op)
2449 if ( myShapeByMeshOp == op ) {
2450 mySMESHGUI->getApp()->updateObjectBrowser();
2452 // Select a found geometry object
2453 GEOM::GEOM_Object_var aGeomVar = myShapeByMeshOp->GetShape();
2454 if ( !aGeomVar->_is_nil() )
2456 QString ID = aGeomVar->GetStudyEntry();
2457 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
2458 if ( _PTR(SObject) aGeomSO = aStudy->FindObjectID( ID.toLatin1().data() )) {
2459 SALOME_ListIO anIOList;
2460 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
2461 ( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );
2462 anIOList.Append( anIO );
2463 mySelectionMgr->setSelectedObjects( anIOList, false );
2464 onObjectSelectionChanged();
2470 //================================================================================
2472 * \brief SLOT. Is called when Close is pressed in SMESHGUI_ShapeByMeshDlg
2474 //================================================================================
2476 void SMESHGUI_GroupDlg::onCloseShapeByMeshDlg(SUIT_Operation* op)
2478 if ( myShapeByMeshOp == op )
2481 setSelectionMode(grpGeomSelection);
2485 //=================================================================================
2486 // function : setGroupColor()
2488 //=================================================================================
2489 void SMESHGUI_GroupDlg::setGroupColor( const SALOMEDS::Color& theColor )
2491 QColor aQColor( (int)( theColor.R * 255.0 ),
2492 (int)( theColor.G * 255.0 ),
2493 (int)( theColor.B * 255.0 ) );
2494 setGroupQColor( aQColor );
2497 //=================================================================================
2498 // function : getGroupColor()
2500 //=================================================================================
2501 SALOMEDS::Color SMESHGUI_GroupDlg::getGroupColor() const
2503 QColor aQColor = getGroupQColor();
2505 SALOMEDS::Color aColor;
2506 aColor.R = (float)aQColor.red() / 255.0;
2507 aColor.G = (float)aQColor.green() / 255.0;
2508 aColor.B = (float)aQColor.blue() / 255.0;
2513 //=================================================================================
2514 // function : setGroupQColor()
2516 //=================================================================================
2517 void SMESHGUI_GroupDlg::setGroupQColor( const QColor& theColor )
2519 if( theColor.isValid() )
2520 myColorBtn->setColor( theColor );
2523 //=================================================================================
2524 // function : getGroupQColor()
2526 //=================================================================================
2527 QColor SMESHGUI_GroupDlg::getGroupQColor() const
2529 return myColorBtn->color();
2532 //=================================================================================
2533 // function : setDefaultGroupColor()
2535 //=================================================================================
2536 void SMESHGUI_GroupDlg::setDefaultGroupColor()
2538 if( myMesh->_is_nil() )
2541 bool isAutoColor = myMesh->GetAutoColor();
2543 QColor aQColor = myColorBtn->color();
2546 if ( !aQColor.isValid() ) {
2547 int r = 0, g = 0, b = 0;
2548 SMESH::GetColor( "SMESH", "default_grp_color", r, g, b, QColor( 255, 170, 0 ) );
2549 aQColor.setRgb( r, g, b );
2554 #ifdef SIMPLE_AUTOCOLOR // simplified algorithm for auto-colors
2555 SALOMEDS::Color aColor = SMESHGUI::getPredefinedUniqueColor();
2556 #else // old algorithm for auto-colors
2557 SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
2559 QList<SALOMEDS::Color> aReservedColors;
2560 for( int i = 0, n = aListOfGroups.length(); i < n; i++ )
2562 SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
2563 SALOMEDS::Color aReservedColor = aGroupObject->GetColor();
2564 aReservedColors.append( aReservedColor );
2567 SALOMEDS::Color aColor = SMESHGUI::getUniqueColor( aReservedColors );
2568 #endif // SIMPLE_AUTOCOLOR
2570 aQColor.setRgb( (int)( aColor.R * 255.0 ),
2571 (int)( aColor.G * 255.0 ),
2572 (int)( aColor.B * 255.0 ) );
2576 setGroupQColor( aQColor );
2579 //=================================================================================
2580 // function : SetAppropriateActor()
2581 // purpose : Find more appropriate of visible actors, set it to myActor, allow picking
2582 // NPAL19389: create a group with a selection in another group.
2583 // if mesh actor is not visible - find any first visible group or sub-mesh
2584 //=================================================================================
2585 bool SMESHGUI_GroupDlg::SetAppropriateActor()
2587 bool isActor = false;
2588 myActorsList.clear();
2590 if (myMesh->_is_nil()) return false;
2592 SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
2594 if (myGrpTypeGroup->checkedId() > 0) { // try current group on geometry actor
2595 SMESH_Actor* anActor = 0;
2596 if (!myGroupOnGeom->_is_nil())
2597 anActor = SMESH::FindActorByObject(myGroupOnGeom);
2598 if (!myGroupOnFilter->_is_nil())
2599 anActor = SMESH::FindActorByObject(myGroupOnFilter);
2600 if (anActor && anActor->hasIO())
2603 if (aViewWindow && !aViewWindow->isVisible(anActor->getIO()))
2606 myActorsList.append(anActor);
2612 SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
2613 if (anActor && anActor->hasIO()) {
2615 if (aViewWindow && !aViewWindow->isVisible(anActor->getIO()))
2618 myActorsList.append(anActor);
2622 SMESH_Actor* aGroupActor = 0;
2623 if (!isActor && !myGroup->_is_nil()) {
2624 aGroupActor = SMESH::FindActorByObject(myGroup);
2625 if (aGroupActor && aGroupActor->hasIO())
2626 myActorsList.append(aGroupActor);
2629 // try any visible actor of group or sub-mesh of current mesh
2632 _PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
2634 CORBA::String_var meshEntry = aSObject->GetID().c_str();
2635 int len = strlen(meshEntry);
2637 // iterate on all actors in current view window, search for
2638 // any visible actor, that belongs to group or submesh of current mesh
2639 VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors());
2640 vtkActorCollection *aCollection = aCopy.GetActors();
2641 int nbItems = aCollection->GetNumberOfItems();
2642 for (int i=0; i<nbItems && !isActor; i++)
2644 SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(aCollection->GetItemAsObject(i));
2645 if (anActor && anActor->hasIO()) {
2646 Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
2647 if (aViewWindow->isVisible(anIO)) {
2648 if (anIO->hasEntry() && strncmp(anIO->getEntry(), meshEntry, len) == 0 && !myActorsList.contains(anActor) )
2649 myActorsList.append(anActor);
2656 // Show a standalone group if nothing else is visible (IPAL52227)
2657 if ( myActorsList.count() == 1 &&
2658 myActorsList[0] == aGroupActor &&
2659 aViewWindow && !aViewWindow->isVisible(aGroupActor->getIO()))
2660 SMESH::UpdateView( aViewWindow, SMESH::eDisplay, aGroupActor->getIO()->getEntry() );
2664 if (myActorsList.count() > 0) {
2665 QListIterator<SMESH_Actor*> it( myActorsList );
2666 while ( it.hasNext() ) {
2667 SMESH_Actor* anActor = it.next();
2668 if ( IsActorVisible(anActor) )
2669 anActor->SetPickable(true);
2673 return ( isActor || (myActorsList.count() > 0) );
2676 //=======================================================================
2677 //function : setShowEntityMode
2678 //purpose : make shown only entity corresponding to my type
2679 //=======================================================================
2680 void SMESHGUI_GroupDlg::setShowEntityMode()
2682 if ( !myMesh->_is_nil() ) {
2683 if ( SMESH_Actor* actor = SMESH::FindActorByObject(myMesh) ) {
2684 if (!myStoredShownEntity)
2685 myStoredShownEntity = actor->GetEntityMode();
2686 switch ( myTypeId ) {
2687 case grpNodeSelection: restoreShowEntityMode(); break;
2688 case grp0DSelection: actor->SetEntityMode( SMESH_Actor::e0DElements ); break;
2689 case grpBallSelection: actor->SetEntityMode( SMESH_Actor::eBallElem ); break;
2690 case grpEdgeSelection: actor->SetEntityMode( SMESH_Actor::eEdges ); break;
2691 case grpFaceSelection: actor->SetEntityMode( SMESH_Actor::eFaces ); break;
2692 case grpVolumeSelection: actor->SetEntityMode( SMESH_Actor::eVolumes ); break;
2698 //=======================================================================
2699 //function : restoreShowEntityMode
2700 //purpose : restore ShowEntity mode of myActor
2701 //=======================================================================
2702 void SMESHGUI_GroupDlg::restoreShowEntityMode()
2704 if ( myStoredShownEntity && !myMesh->_is_nil() ) {
2705 if ( SMESH_Actor* actor = SMESH::FindActorByObject(myMesh) ) {
2706 actor->SetEntityMode(myStoredShownEntity);
2709 myStoredShownEntity = 0;
2712 //=======================================================================
2713 //function : IsActorVisible
2714 //purpose : return visibility of the actor
2715 //=======================================================================
2716 bool SMESHGUI_GroupDlg::IsActorVisible( SMESH_Actor* theActor )
2718 SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
2719 if (theActor && aViewWindow)
2720 return aViewWindow->isVisible(theActor->getIO());
2724 //================================================================
2725 //function : setIsApplyAndClose
2726 //purpose : Set value of the flag indicating that the dialog is
2727 // accepted by Apply & Close button
2728 //================================================================
2729 void SMESHGUI_GroupDlg::setIsApplyAndClose( const bool theFlag )
2731 myIsApplyAndClose = theFlag;
2734 //================================================================
2735 //function : isApplyAndClose
2736 //purpose : Get value of the flag indicating that the dialog is
2737 // accepted by Apply & Close button
2738 //================================================================
2739 bool SMESHGUI_GroupDlg::isApplyAndClose() const
2741 return myIsApplyAndClose;