Back to index

salome-smesh  6.5.0
SMESHGUI_CreatePolyhedralVolumeDlg.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // SMESH SMESHGUI : GUI for SMESH component
00024 // File   : SMESHGUI_CreatePolyhedralVolumeDlg.cxx
00025 // Author : Michael ZORIN, Open CASCADE S.A.S.
00026 // SMESH includes
00027 //
00028 #include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
00029 
00030 #include "SMESHGUI.h"
00031 #include "SMESHGUI_Utils.h"
00032 #include "SMESHGUI_VTKUtils.h"
00033 #include "SMESHGUI_MeshUtils.h"
00034 #include "SMESHGUI_GroupUtils.h"
00035 #include "SMESHGUI_IdValidator.h"
00036 
00037 #include <SMESH_Actor.h>
00038 #include <SMESH_ActorUtils.h>
00039 #include <SMDS_Mesh.hxx>
00040 
00041 // SALOME GUI includes
00042 #include <SUIT_Desktop.h>
00043 #include <SUIT_ResourceMgr.h>
00044 #include <SUIT_Session.h>
00045 #include <SUIT_MessageBox.h>
00046 #include <SUIT_ViewManager.h>
00047 #include <SUIT_OverrideCursor.h>
00048 
00049 #include <SalomeApp_Application.h>
00050 #include <LightApp_SelectionMgr.h>
00051 
00052 #include <SVTK_ViewWindow.h>
00053 
00054 // OCCT includes
00055 #include <TColStd_ListOfInteger.hxx>
00056 #include <TColStd_ListIteratorOfListOfInteger.hxx>
00057 
00058 // VTK includes
00059 #include <vtkCell.h>
00060 #include <vtkIdList.h>
00061 #include <vtkUnstructuredGrid.h>
00062 #include <vtkDataSetMapper.h>
00063 #include <vtkProperty.h>
00064 
00065 // Qt includes
00066 #include <QApplication>
00067 #include <QButtonGroup>
00068 #include <QComboBox>
00069 #include <QGroupBox>
00070 #include <QLabel>
00071 #include <QLineEdit>
00072 #include <QPushButton>
00073 #include <QRadioButton>
00074 #include <QCheckBox>
00075 #include <QHBoxLayout>
00076 #include <QVBoxLayout>
00077 #include <QGridLayout>
00078 #include <QListWidget>
00079 #include <QKeyEvent>
00080 
00081 // IDL includes
00082 #include <SALOMEconfig.h>
00083 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
00084 
00085 #define SPACING 6
00086 #define MARGIN  11
00087 
00088 namespace SMESH
00089 {
00090   class TPolySimulation
00091   {
00092     SVTK_ViewWindow* myViewWindow;
00093 
00094     SALOME_Actor *myPreviewActor;
00095     vtkDataSetMapper* myMapper;
00096     vtkUnstructuredGrid* myGrid;
00097 
00098   public:
00099 
00100     TPolySimulation(SalomeApp_Application* app)
00101     {
00102       SUIT_ViewManager* mgr = app->activeViewManager();
00103       myViewWindow = mgr ? dynamic_cast<SVTK_ViewWindow*>( mgr->getActiveView() ) : NULL;
00104 
00105       myGrid = vtkUnstructuredGrid::New();
00106   
00107       // Create and display actor
00108       myMapper = vtkDataSetMapper::New();
00109       myMapper->SetInput( myGrid );
00110 
00111       myPreviewActor = SALOME_Actor::New();
00112       myPreviewActor->PickableOff();
00113       myPreviewActor->VisibilityOff();
00114       myPreviewActor->SetMapper( myMapper );
00115       myPreviewActor->SetRepresentation( 3 );
00116 
00117       vtkFloatingPointType anRGB[3];
00118       vtkProperty* aProp = vtkProperty::New();
00119       GetColor( "SMESH", "selection_element_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
00120       aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
00121       myPreviewActor->SetProperty( aProp );
00122       vtkFloatingPointType aFactor,aUnits;
00123       myPreviewActor->SetResolveCoincidentTopology(true);
00124       myPreviewActor->GetPolygonOffsetParameters(aFactor,aUnits);
00125       myPreviewActor->SetPolygonOffsetParameters(aFactor,0.2*aUnits);
00126       aProp->Delete();
00127 
00128       myViewWindow->AddActor( myPreviewActor );
00129       
00130     }
00131 
00132 
00133     typedef std::vector<vtkIdType> TVTKIds;
00134     void SetPosition(SMESH_Actor* theActor, 
00135                      vtkIdType theType, 
00136                      const TVTKIds& theIds,
00137                      bool theReset=true)
00138     {
00139       vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
00140       myGrid->SetPoints(aGrid->GetPoints());
00141 
00142       ResetGrid(theReset);
00143       
00144       vtkIdList *anIds = vtkIdList::New();
00145 
00146       for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
00147         anIds->InsertId(i,theIds[i]);
00148 
00149       myGrid->InsertNextCell(theType,anIds);
00150       if(theIds.size()!=0){
00151         myGrid->InsertNextCell(theType,anIds);
00152         myGrid->Modified();
00153       }
00154         
00155       anIds->Delete();
00156 
00157       SetVisibility(true);
00158 
00159     }
00160   
00161     void ResetGrid(bool theReset=true){
00162       if (theReset) myGrid->Reset();
00163     }
00164 
00165     void SetVisibility(bool theVisibility){
00166       myPreviewActor->SetVisibility(theVisibility);
00167       RepaintCurrentView();
00168     }
00169 
00170 
00171     ~TPolySimulation(){
00172       if( myViewWindow )
00173         myViewWindow->RemoveActor(myPreviewActor);
00174 
00175       myPreviewActor->Delete();
00176 
00177       myMapper->RemoveAllInputs();
00178       myMapper->Delete();
00179 
00180       myGrid->Delete();
00181     }
00182 
00183   };
00184 }
00185 
00186 //=================================================================================
00187 // class    : SMESHGUI_CreatePolyhedralVolumeDlgDlg()
00188 // purpose  : 
00189 //=================================================================================
00190 SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI* theModule )
00191   : QDialog( SMESH::GetDesktop( theModule ) ),
00192     mySMESHGUI( theModule ),
00193     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
00194 {
00195   QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH",tr("ICON_SELECT")));
00196 
00197   setModal(false);
00198   setAttribute(Qt::WA_DeleteOnClose, true);
00199   setWindowTitle( tr( "SMESH_CREATE_POLYHEDRAL_VOLUME_TITLE" ) );
00200   setSizeGripEnabled( true );
00201 
00202   QVBoxLayout* topLayout = new QVBoxLayout( this ); 
00203   topLayout->setSpacing( SPACING );
00204   topLayout->setMargin( MARGIN );
00205 
00206   /***************************************************************/
00207   ConstructorsBox = new QGroupBox(tr( "SMESH_ELEMENTS_TYPE" ), this);
00208   GroupConstructors = new QButtonGroup(this);
00209   QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout( ConstructorsBox );
00210   ConstructorsBoxLayout->setSpacing( SPACING );
00211   ConstructorsBoxLayout->setMargin( MARGIN );
00212 
00213   RadioButton1 = new QRadioButton( tr( "MESH_NODE" ),  ConstructorsBox );
00214   RadioButton2 = new QRadioButton( tr( "SMESH_FACE" ), ConstructorsBox );
00215 
00216   ConstructorsBoxLayout->addWidget( RadioButton1 );
00217   ConstructorsBoxLayout->addWidget( RadioButton2 );
00218   GroupConstructors->addButton(RadioButton1, 0);
00219   GroupConstructors->addButton(RadioButton2, 1);
00220   
00221   /***************************************************************/
00222   GroupContent = new QGroupBox( tr( "SMESH_CONTENT" ), this );
00223   QGridLayout* GroupContentLayout = new QGridLayout( GroupContent );
00224   GroupContentLayout->setSpacing( SPACING );
00225   GroupContentLayout->setMargin( MARGIN );
00226   
00227   TextLabelIds = new QLabel( tr( "SMESH_ID_NODES" ), GroupContent );
00228   SelectElementsButton  = new QPushButton( GroupContent );
00229   SelectElementsButton->setIcon( image0 );
00230   LineEditElements  = new QLineEdit( GroupContent );
00231   LineEditElements->setValidator( new SMESHGUI_IdValidator( this ) );
00232 
00233   myFacesByNodesLabel = new QLabel( tr( "FACES_BY_NODES" ), GroupContent );
00234   myFacesByNodes = new QListWidget( GroupContent);
00235   myFacesByNodes->setSelectionMode( QListWidget::ExtendedSelection );
00236   myFacesByNodes->setMinimumHeight( 150);
00237 
00238   AddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), GroupContent );
00239   RemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), GroupContent );
00240 
00241   Preview = new QCheckBox( tr( "SMESH_POLYEDRE_PREVIEW" ), GroupContent );
00242 
00243   GroupContentLayout->addWidget( TextLabelIds,         0, 0 );
00244   GroupContentLayout->addWidget( SelectElementsButton, 0, 1 );
00245   GroupContentLayout->addWidget( LineEditElements,     0, 2, 1, 2 );
00246   GroupContentLayout->addWidget( myFacesByNodesLabel,  1, 0 );
00247   GroupContentLayout->addWidget( myFacesByNodes,       2, 0, 3, 3 );
00248   GroupContentLayout->addWidget( AddButton,            2, 3 );
00249   GroupContentLayout->addWidget( RemoveButton,         3, 3 );
00250   GroupContentLayout->addWidget( Preview,              5, 0, 1, 4 );
00251 
00252   /***************************************************************/
00253   GroupGroups = new QGroupBox( tr( "SMESH_ADD_TO_GROUP" ), this );
00254   GroupGroups->setCheckable( true );
00255   QHBoxLayout* GroupGroupsLayout = new QHBoxLayout(GroupGroups);
00256   GroupGroupsLayout->setSpacing(SPACING);
00257   GroupGroupsLayout->setMargin(MARGIN);
00258 
00259   TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
00260   ComboBox_GroupName = new QComboBox( GroupGroups );
00261   ComboBox_GroupName->setEditable( true );
00262   ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert );
00263 
00264   GroupGroupsLayout->addWidget( TextLabel_GroupName );
00265   GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
00266 
00267   /***************************************************************/
00268   GroupButtons = new QGroupBox( this );
00269   QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
00270   GroupButtonsLayout->setSpacing( SPACING );
00271   GroupButtonsLayout->setMargin( MARGIN );
00272 
00273   buttonOk = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), GroupButtons );
00274   buttonOk->setAutoDefault( true );
00275   buttonOk->setDefault( true );
00276   buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons );
00277   buttonApply->setAutoDefault( true );
00278   buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons );
00279   buttonCancel->setAutoDefault( true );
00280   buttonHelp = new QPushButton( tr("SMESH_BUT_HELP" ), GroupButtons );
00281   buttonHelp->setAutoDefault(true);
00282 
00283   GroupButtonsLayout->addWidget( buttonOk );
00284   GroupButtonsLayout->addSpacing( 10 );
00285   GroupButtonsLayout->addWidget( buttonApply );
00286   GroupButtonsLayout->addSpacing( 10 );
00287   GroupButtonsLayout->addStretch();
00288   GroupButtonsLayout->addWidget( buttonCancel );
00289   GroupButtonsLayout->addWidget( buttonHelp);
00290 
00291   /***************************************************************/
00292   topLayout->addWidget( ConstructorsBox );
00293   topLayout->addWidget( GroupContent );
00294   topLayout->addWidget( GroupGroups );
00295   topLayout->addWidget( GroupButtons );
00296   
00297   mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
00298   
00299   RadioButton1->setChecked( true );
00300  
00301   mySMESHGUI->SetActiveDialogBox( (QDialog*)this );
00302 
00303   myHelpFileName = "adding_nodes_and_elements_page.html#adding_polyhedrons_anchor";
00304   
00305   Init();
00306 }
00307 
00308 //=================================================================================
00309 // function : ~SMESHGUI_CreatePolyhedralVolumeDlg()
00310 // purpose  : Destroys the object and frees any allocated resources
00311 //=================================================================================
00312 SMESHGUI_CreatePolyhedralVolumeDlg::~SMESHGUI_CreatePolyhedralVolumeDlg()
00313 {
00314   delete mySimulation;
00315 }
00316 
00317 static bool busy = false;
00318 
00319 //=================================================================================
00320 // function : Init()
00321 // purpose  :
00322 //=================================================================================
00323 void SMESHGUI_CreatePolyhedralVolumeDlg::Init()
00324 {
00325   myEditCurrentArgument = LineEditElements;
00326   mySMESHGUI->SetActiveDialogBox( (QDialog*)this );
00327 
00328   /* reset "Add to group" control */
00329   GroupGroups->setChecked( false );
00330 
00331   myNbOkElements = 0;
00332   myActor = 0;
00333 
00334   mySimulation = new SMESH::TPolySimulation( dynamic_cast<SalomeApp_Application*>( mySMESHGUI->application() ) );
00335 
00336   /* signals and slots connections */
00337   connect(buttonOk,     SIGNAL( clicked() ), SLOT( ClickOnOk() ) );
00338   connect(buttonCancel, SIGNAL( clicked() ), SLOT( ClickOnCancel() ) );
00339   connect(buttonApply,  SIGNAL( clicked() ), SLOT( ClickOnApply() ) );
00340   connect(buttonHelp,   SIGNAL( clicked() ), SLOT( ClickOnHelp() ) );
00341 
00342   connect(GroupConstructors, SIGNAL(buttonClicked(int) ), SLOT( ConstructorsClicked(int) ) );
00343   connect(SelectElementsButton, SIGNAL( clicked() ), SLOT( SetEditCurrentArgument() ) );
00344   connect(LineEditElements, SIGNAL( textChanged(const QString&) ), SLOT(onTextChange(const QString&)));
00345 
00346   connect(myFacesByNodes, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged()));
00347   connect(AddButton, SIGNAL(clicked()), this, SLOT(onAdd()));
00348   connect(RemoveButton, SIGNAL(clicked()), this, SLOT(onRemove()));
00349   
00350   connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
00351   connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
00352   connect( Preview, SIGNAL(toggled(bool)), this, SLOT(ClickOnPreview(bool)));
00353   /* to close dialog if study change */
00354   connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
00355   
00356   ConstructorsClicked(0);
00357   SelectionIntoArgument();
00358 }
00359 
00360 
00361 //=================================================================================
00362 // function : ConstructorsClicked()
00363 // purpose  : Radio button management
00364 //=================================================================================
00365 void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId)
00366 {
00367   //disconnect(mySelectionMgr, 0, this, 0);
00368 
00369   SALOME_ListIO io;
00370   mySelectionMgr->selectedObjects( io );
00371   SALOME_ListIO aList;
00372   mySelectionMgr->setSelectedObjects( aList );
00373   myEditCurrentArgument->clear();
00374   myNbOkElements = 0;
00375   buttonApply->setEnabled(false);
00376   buttonOk->setEnabled(false);
00377   mySimulation->SetVisibility(false);
00378 
00379   switch(constructorId)
00380     {
00381     case 0 :
00382       { 
00383         if ( myActor ){
00384           myActor->SetPointRepresentation(true);
00385         }
00386         else
00387           SMESH::SetPointRepresentation(true);
00388         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00389           aViewWindow->SetSelectionMode(NodeSelection);
00390         
00391         AddButton->setEnabled(false);
00392         RemoveButton->setEnabled(false);
00393         TextLabelIds->setText( tr( "SMESH_ID_NODES" ) );
00394         myFacesByNodesLabel->show();
00395         myFacesByNodes->clear();
00396         myFacesByNodes->show();
00397         AddButton->show();
00398         RemoveButton->show();
00399         Preview->show();
00400         break;
00401       }
00402     case 1 :
00403       {
00404         if( myActor ){
00405           myActor->SetPointRepresentation(false);
00406         } else {
00407           SMESH::SetPointRepresentation(false);
00408         }
00409         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00410           aViewWindow->SetSelectionMode(FaceSelection);
00411         
00412         TextLabelIds->setText( tr( "SMESH_ID_FACES" ) );
00413         myFacesByNodesLabel->hide();
00414         myFacesByNodes->hide();
00415         AddButton->hide();
00416         RemoveButton->hide();
00417         Preview->show();
00418         break;
00419       }
00420     }
00421   
00422   //connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
00423   mySelectionMgr->setSelectedObjects( io );
00424 
00425   QApplication::instance()->processEvents();
00426   updateGeometry();
00427   resize(100,100);
00428 }
00429 
00430 //=================================================================================
00431 // function : ClickOnPreview()
00432 // purpose  :
00433 //=================================================================================
00434 void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnPreview(bool theToggled){
00435   Preview->setChecked(theToggled);
00436   displaySimulation();
00437 }
00438 
00439 //=================================================================================
00440 // function : ClickOnApply()
00441 // purpose  :
00442 //=================================================================================
00443 void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply()
00444 {
00445   if( !isValid() )
00446     return;
00447 
00448   if ( myNbOkElements>0 && !mySMESHGUI->isActiveStudyLocked())
00449     {
00450       if(checkEditLine(false) == -1) {return;}
00451       busy = true;
00452       long anElemId = -1;
00453 
00454       bool addToGroup = GroupGroups->isChecked();
00455       QString aGroupName;
00456       
00457       SMESH::SMESH_GroupBase_var aGroup;
00458       int idx = 0;
00459       if( addToGroup ) {
00460         aGroupName = ComboBox_GroupName->currentText();
00461         for ( int i = 1; i < ComboBox_GroupName->count(); i++ ) {
00462           QString aName = ComboBox_GroupName->itemText( i );
00463           if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
00464             idx = i;
00465         }
00466         if ( idx > 0 && idx < myGroups.count() ) {
00467           SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
00468           if ( !aGeomGroup->_is_nil() ) {
00469             int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),
00470                                                  tr( "MESH_STANDALONE_GRP_CHOSEN" ).arg( aGroupName ),
00471                                                  tr( "SMESH_BUT_YES" ), tr( "SMESH_BUT_NO" ), 0, 1 );
00472             if ( res == 1 ) return;
00473           }
00474           aGroup = myGroups[idx-1];
00475         }
00476       }
00477 
00478       if (GetConstructorId() == 0)
00479         {
00480           SMESH::long_array_var anIdsOfNodes = new SMESH::long_array;
00481           SMESH::long_array_var aQuantities  = new SMESH::long_array;
00482 
00483           aQuantities->length( myFacesByNodes->count() );
00484 
00485           TColStd_ListOfInteger aNodesIds;
00486 
00487           int aNbQuantities = 0;
00488           for (int i = 0; i < myFacesByNodes->count(); i++ ) {
00489             QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts );
00490             for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it)
00491               aNodesIds.Append( (*it).toInt() );
00492 
00493             aQuantities[aNbQuantities++] = anIds.count();
00494           }
00495 
00496           anIdsOfNodes->length(aNodesIds.Extent());
00497 
00498           int aNbIdsOfNodes = 0;
00499           TColStd_ListIteratorOfListOfInteger It;
00500           It.Initialize(aNodesIds);
00501           for( ;It.More();It.Next())
00502             anIdsOfNodes[aNbIdsOfNodes++] = It.Value();
00503             
00504           try{
00505             SUIT_OverrideCursor aWaitCursor;
00506             SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
00507             anElemId = aMeshEditor->AddPolyhedralVolume(anIdsOfNodes, aQuantities);
00508           }catch(SALOME::SALOME_Exception& exc){
00509             INFOS("Follow exception was cought:\n\t"<<exc.details.text);
00510           }catch(std::exception& exc){
00511             INFOS("Follow exception was cought:\n\t"<<exc.what());
00512           }catch(...){
00513             INFOS("Unknown exception was cought !!!");
00514           }
00515         }
00516       else if (GetConstructorId() == 1)
00517         {
00518           SMESH::long_array_var anIdsOfFaces = new SMESH::long_array;
00519           
00520           QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
00521           anIdsOfFaces->length(aListId.count());
00522           for ( int i = 0; i < aListId.count(); i++ )
00523             anIdsOfFaces[i] = aListId[i].toInt();
00524           
00525           try{
00526             SUIT_OverrideCursor aWaitCursor;
00527             SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
00528             anElemId = aMeshEditor->AddPolyhedralVolumeByFaces(anIdsOfFaces);
00529           }catch(SALOME::SALOME_Exception& exc){
00530             INFOS("Follow exception was cought:\n\t"<<exc.details.text);
00531           }catch(std::exception& exc){
00532             INFOS("Follow exception was cought:\n\t"<<exc.what());
00533           }catch(...){
00534             INFOS("Unknown exception was cought !!!");
00535           }
00536         }
00537 
00538       if ( anElemId != -1 && addToGroup && !aGroupName.isEmpty() ) {
00539         SMESH::SMESH_Group_var aGroupUsed;
00540         if ( aGroup->_is_nil() ) {
00541           // create new group 
00542           aGroupUsed = SMESH::AddGroup( myMesh, SMESH::VOLUME, aGroupName );
00543           if ( !aGroupUsed->_is_nil() ) {
00544             myGroups.append(SMESH::SMESH_GroupBase::_duplicate(aGroupUsed));
00545             ComboBox_GroupName->addItem( aGroupName );
00546           }
00547         }
00548         else {
00549           SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGroup );
00550           if ( !aGeomGroup->_is_nil() ) {
00551             aGroupUsed = myMesh->ConvertToStandalone( aGeomGroup );
00552             if ( !aGroupUsed->_is_nil() && idx > 0 ) {
00553               myGroups[idx-1] = SMESH::SMESH_GroupBase::_duplicate(aGroupUsed);
00554               SMESHGUI::GetSMESHGUI()->getApp()->updateObjectBrowser();
00555             }
00556           }
00557           else
00558             aGroupUsed = SMESH::SMESH_Group::_narrow( aGroup );
00559         }
00560         
00561         if ( !aGroupUsed->_is_nil() ) {
00562           SMESH::long_array_var anIdList = new SMESH::long_array;
00563           anIdList->length( 1 );
00564           anIdList[0] = anElemId;
00565           aGroupUsed->Add( anIdList.inout() );
00566         }
00567       }
00568 
00569       //SALOME_ListIO aList;
00570       //mySelectionMgr->setSelectedObjects( aList );
00571       SMESH::UpdateView();
00572       if( myActor ){
00573         unsigned int anEntityMode = myActor->GetEntityMode();
00574         myActor->SetEntityMode(SMESH_Actor::eVolumes | anEntityMode);
00575       }
00576       //ConstructorsClicked( GetConstructorId() );
00577       busy = false;
00578 
00579       SMESHGUI::Modified();
00580     }
00581     myFacesByNodes->clear();
00582 }
00583 
00584 //=================================================================================
00585 // function : ClickOnOk()
00586 // purpose  :
00587 //=================================================================================
00588 void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnOk()
00589 {
00590   if(checkEditLine(false) == -1) {return;}
00591   ClickOnApply();
00592   ClickOnCancel();
00593 }
00594 
00595         
00596 //=================================================================================
00597 // function : ClickOnCancel()
00598 // purpose  :
00599 //=================================================================================
00600 void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnCancel()
00601 {
00602   mySelectionMgr->clearFilters();
00603   //SALOME_ListIO aList;
00604   //mySelectionMgr->setSelectedObjects( aList );
00605   SMESH::SetPointRepresentation(false);
00606   mySimulation->SetVisibility(false);
00607   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00608     aViewWindow->SetSelectionMode( ActorSelection );
00609   disconnect( mySelectionMgr, 0, this, 0 );
00610   mySMESHGUI->ResetState();
00611   reject();
00612 }
00613 
00614 //=================================================================================
00615 // function : ClickOnHelp()
00616 // purpose  :
00617 //=================================================================================
00618 void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnHelp()
00619 {
00620   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
00621   if (app) 
00622     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
00623   else {
00624     QString platform;
00625 #ifdef WIN32
00626     platform = "winapplication";
00627 #else
00628     platform = "application";
00629 #endif
00630     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
00631                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
00632                              arg(app->resourceMgr()->stringValue("ExternalBrowser",
00633                                                                  platform)).
00634                              arg(myHelpFileName));
00635   }
00636 }
00637 
00638 //=======================================================================
00639 //function : onTextChange
00640 //purpose  : 
00641 //=======================================================================
00642 
00643 void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText)
00644 {
00645   if ( busy ) return;
00646   if (checkEditLine() == -1) return;
00647   busy = true;
00648 
00649   mySimulation->SetVisibility(false);
00650 
00651   SMDS_Mesh* aMesh = 0;
00652   if ( myActor )
00653     aMesh = myActor->GetObject()->GetMesh();
00654 
00655   if (GetConstructorId() == 0)
00656     {
00657       if ( aMesh ) {
00658         TColStd_MapOfInteger newIndices;
00659       
00660         QStringList aListId = theNewText.split( " ", QString::SkipEmptyParts );
00661         for ( int i = 0; i < aListId.count(); i++ ) {
00662           const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
00663           if ( n ) {
00664             newIndices.Add(n->GetID());
00665             myNbOkElements++;
00666           }
00667         }
00668       
00669         mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
00670       
00671         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00672           aViewWindow->highlight( myActor->getIO(), true, true );
00673       
00674         if ( myNbOkElements>0 && aListId.count()>=3)
00675           AddButton->setEnabled(true);
00676         else
00677           AddButton->setEnabled(false);
00678       
00679         displaySimulation();
00680       }
00681     } else if (GetConstructorId() == 1)
00682       {
00683         myNbOkElements = 0;
00684         buttonOk->setEnabled( false );
00685         buttonApply->setEnabled( false );
00686       
00687         // check entered ids of faces and hilight them
00688         QStringList aListId;
00689         if ( aMesh ) {
00690           TColStd_MapOfInteger newIndices;
00691       
00692           aListId = theNewText.split( " ", QString::SkipEmptyParts );
00693 
00694           for ( int i = 0; i < aListId.count(); i++ ) {
00695             const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
00696             if ( e ) {
00697               newIndices.Add(e->GetID());
00698               myNbOkElements++;  
00699             }
00700           }
00701 
00702           mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
00703           if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00704             aViewWindow->highlight( myActor->getIO(), true, true );
00705       
00706           if ( myNbOkElements ) {
00707             if (aListId.count()>1){ 
00708               buttonOk->setEnabled( true );
00709               buttonApply->setEnabled( true );
00710             }
00711             else{
00712               buttonOk->setEnabled( false );
00713               buttonApply->setEnabled( false );
00714             }
00715             if(aListId.count()>1)
00716               displaySimulation();
00717           }
00718         }
00719       }
00720   busy = false;
00721 }
00722 
00723 //=================================================================================
00724 // function : SelectionIntoArgument()
00725 // purpose  : Called when selection as changed or other case
00726 //=================================================================================
00727 void SMESHGUI_CreatePolyhedralVolumeDlg::SelectionIntoArgument()
00728 {
00729   if ( busy ) return;
00730   
00731   // clear
00732   
00733   if (GetConstructorId() == 1 || myFacesByNodes->count() <= 1)
00734     {
00735       myNbOkElements = 0;
00736       AddButton->setEnabled(false);
00737       buttonOk->setEnabled( false );
00738       buttonApply->setEnabled( false );
00739     }
00740 
00741   myActor = 0;
00742 
00743   busy = true;
00744   myEditCurrentArgument->setText( "" );
00745   busy = false;
00746   if ( !GroupButtons->isEnabled() ) // inactive
00747     return;
00748   
00749   mySimulation->SetVisibility(false);
00750   
00751   QString aCurrentEntry = myEntry;
00752 
00753   // get selected mesh
00754   
00755   SALOME_ListIO selected;
00756   mySelectionMgr->selectedObjects( selected );
00757   int nbSel = selected.Extent();
00758   if(nbSel != 1){
00759     return;
00760   }
00761   
00762   myEntry = selected.First()->getEntry();
00763   myMesh = SMESH::GetMeshByIO( selected.First() );
00764   if ( myMesh->_is_nil() )
00765     return;
00766   
00767   // process groups
00768   if ( !myMesh->_is_nil() && myEntry != aCurrentEntry ) {
00769     myGroups.clear();
00770     ComboBox_GroupName->clear();
00771     ComboBox_GroupName->addItem( QString() );
00772     SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
00773     for ( int i = 0, n = aListOfGroups.length(); i < n; i++ ) {
00774       SMESH::SMESH_GroupBase_var aGroup = aListOfGroups[i];
00775       if ( !aGroup->_is_nil() && aGroup->GetType() == SMESH::VOLUME ) {
00776         QString aGroupName( aGroup->GetName() );
00777         if ( !aGroupName.isEmpty() ) {
00778           myGroups.append(SMESH::SMESH_GroupBase::_duplicate(aGroup));
00779           ComboBox_GroupName->addItem( aGroupName );
00780         }
00781       }
00782     }
00783   }
00784 
00785   myActor = SMESH::FindActorByObject(myMesh);
00786   if ( !myActor )
00787     return;
00788   
00789   // get selected nodes/faces
00790   QString aString = "";
00791   int anbNodes=0,aNbFaces=0;
00792   switch(GetConstructorId()){
00793   case 0:{
00794     anbNodes = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString);
00795     if (anbNodes >= 3)
00796       AddButton->setEnabled(true);
00797     else if (anbNodes < 3){
00798       AddButton->setEnabled(false);
00799     }
00800     busy = true;
00801     myEditCurrentArgument->setText( aString );
00802     if (checkEditLine() == -1) {busy = false;return;}
00803     busy = false;
00804     break;
00805   }
00806   case 1:{
00807     // get selected faces
00808     aNbFaces = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
00809     if (aNbFaces<=1){
00810       buttonOk->setEnabled( false );
00811       buttonApply->setEnabled( false );
00812     } else {
00813       buttonOk->setEnabled( true );
00814       buttonApply->setEnabled( true );
00815     }
00816     busy = true;
00817     myEditCurrentArgument->setText( aString );
00818     if (checkEditLine() == -1) {busy = false;return;}
00819     busy = false;
00820     
00821     // OK
00822     myNbOkElements = 1;
00823     break;
00824   }
00825   default: return;
00826   }
00827   if(anbNodes>2 || aNbFaces>1)
00828     displaySimulation();
00829 }
00830 
00831 /*\brief int SMESHGUI_CreatePolyhedralVolumeDlg::checkEditLine()
00832  * Checking of indices in edit line.
00833  * If incorecct indices in edit line warning message appear and myEditCurrentArgument remove last index.
00834  * \retval 1 - if all ok(or no indices in edit line), -1 - if there are incorrect indices.
00835  */
00836 int SMESHGUI_CreatePolyhedralVolumeDlg::checkEditLine(bool checkLast)
00837 {
00838   QString aString = "";
00839   SMDS_Mesh* aMesh = 0;
00840   
00841   if(myMesh->_is_nil()) return 1;
00842   if(!myActor){
00843     myActor = SMESH::FindActorByObject(myMesh);
00844     if(!myActor)
00845       return 1;
00846   }
00847     
00848   aMesh = myActor->GetObject()->GetMesh();
00849 
00850   // checking for nodes
00851   if (checkLast && myEditCurrentArgument->text().right(1) != QString(" ") ) return 1;
00852   QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
00853   for ( int i = 0; i < aListId.count(); i++ ){
00854     switch (GetConstructorId()){
00855     case 0:{ // nodes
00856       const SMDS_MeshNode    * aNode = aMesh->FindNode( aListId[ i ].toInt() );
00857       if( !aNode ){
00858         SUIT_MessageBox::warning(this,
00859                                  tr("SMESH_POLYEDRE_CREATE_ERROR"),
00860                                  tr("The incorrect indices of nodes!"));
00861         
00862         myEditCurrentArgument->clear();
00863         myEditCurrentArgument->setText( aString );
00864         return -1;
00865       }
00866 
00867       break;
00868     }
00869     case 1:{ // faces
00870       bool aElemIsOK = true;
00871       const SMDS_MeshElement * aElem = aMesh->FindElement( aListId[ i ].toInt() );
00872       if (!aElem)
00873         {
00874           aElemIsOK = false;
00875         }
00876       else
00877         {
00878           SMDSAbs_ElementType aType = aMesh->GetElementType( aElem->GetID(),true );
00879           if (aType != SMDSAbs_Face){
00880             aElemIsOK = false;
00881           }
00882         }
00883       if (!aElemIsOK){
00884         SUIT_MessageBox::warning(this,
00885                                  tr("SMESH_POLYEDRE_CREATE_ERROR"),
00886                                  tr("The incorrect indices of faces!"));
00887         
00888         myEditCurrentArgument->clear();
00889         myEditCurrentArgument->setText( aString );
00890         return -1;
00891       }
00892       break;
00893     }
00894     }
00895     aString += aListId[ i ] + " "; 
00896   }
00897 
00898   return 1;
00899 }
00900 
00901 //=======================================================================
00902 //function : displaySimulation
00903 //purpose  : 
00904 //=======================================================================
00905 void SMESHGUI_CreatePolyhedralVolumeDlg::displaySimulation()
00906 {
00907   if ( (myNbOkElements || AddButton->isEnabled()) && GroupButtons->isEnabled() && myActor)
00908     {
00909       SMESH::TPolySimulation::TVTKIds aVTKIds;
00910       vtkIdType aType = VTK_CONVEX_POINT_SET;
00911       SMDS_Mesh* aMesh = 0;
00912       if ( myActor ){
00913         aMesh = myActor->GetObject()->GetMesh();
00914       }
00915       if (GetConstructorId() == 0 && aMesh){
00916         if (!AddButton->isEnabled()){
00917           mySimulation->ResetGrid(true);
00918           for (int i = 0; i < myFacesByNodes->count(); i++) {
00919             QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts );
00920             SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
00921             for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it){
00922               const SMDS_MeshNode* aNode = aMesh->FindNode( (*it).toInt() );
00923               if (!aNode) continue;
00924               vtkIdType aId = myActor->GetObject()->GetNodeVTKId( (*it).toInt() );
00925               aVTKIds.push_back(aId);
00926               aVTKIds_faces.push_back(aId);
00927             }
00928             if(!Preview->isChecked()){
00929               aType = VTK_POLYGON;
00930               mySimulation->SetPosition(myActor, aType, aVTKIds_faces,false);
00931             }
00932           }
00933           if(myFacesByNodes->count() == 0){
00934             mySimulation->SetVisibility(false);
00935           } else {
00936             mySimulation->SetVisibility(true);
00937           }
00938           if(Preview->isChecked()){
00939             mySimulation->SetPosition(myActor, aType, aVTKIds);
00940           }
00941         } else {
00942           // add ids from edit line
00943           QStringList anEditIds = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
00944           for ( int i = 0; i < anEditIds.count(); i++ )
00945             aVTKIds.push_back( myActor->GetObject()->GetNodeVTKId( anEditIds[ i ].toInt() ));
00946           aType = VTK_POLYGON;
00947           mySimulation->SetPosition(myActor, aType, aVTKIds);
00948         }
00949       }else if(GetConstructorId() == 1 && aMesh){
00950         QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
00951         for ( int i = 0; i < aListId.count(); i++ )
00952           {
00953             const SMDS_MeshElement * anElem = aMesh->FindElement( aListId[ i ].toInt() );
00954             if ( !anElem ) continue;
00955             SMDSAbs_ElementType aFaceType = aMesh->GetElementType( anElem->GetID(),true );
00956             if (aFaceType != SMDSAbs_Face) continue;
00957               
00958             SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
00959             SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
00960             while( anIter->more() )
00961               if ( const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next() ){
00962                 vtkIdType aId = myActor->GetObject()->GetNodeVTKId( aNode->GetID() );
00963                 aVTKIds.push_back(aId);
00964                 aVTKIds_faces.push_back(aId);
00965               }
00966             if(!Preview->isChecked()){
00967               aType = VTK_POLYGON;
00968               mySimulation->SetPosition(myActor, aType, aVTKIds_faces);
00969             }
00970           }
00971         if(Preview->isChecked())
00972           mySimulation->SetPosition(myActor, aType, aVTKIds);
00973       }
00974       SMESH::UpdateView();
00975     }
00976 }
00977 
00978 //=================================================================================
00979 // function : SetEditCurrentArgument()
00980 // purpose  :
00981 //=================================================================================
00982 void SMESHGUI_CreatePolyhedralVolumeDlg::SetEditCurrentArgument()
00983 {
00984   QPushButton* send = (QPushButton*)sender();
00985   if(send == SelectElementsButton) {
00986     LineEditElements->setFocus();
00987     myEditCurrentArgument = LineEditElements;
00988   }
00989   SelectionIntoArgument();
00990 }
00991 
00992 //=================================================================================
00993 // function : DeactivateActiveDialog()
00994 // purpose  :
00995 //=================================================================================
00996 void SMESHGUI_CreatePolyhedralVolumeDlg::DeactivateActiveDialog()
00997 {
00998   if ( ConstructorsBox->isEnabled() ) {
00999     ConstructorsBox->setEnabled(false);
01000     GroupContent->setEnabled(false);
01001     GroupButtons->setEnabled(false);
01002     mySimulation->SetVisibility(false);
01003     mySMESHGUI->ResetState();    
01004     mySMESHGUI->SetActiveDialogBox(0);
01005   }
01006 }
01007 
01008 
01009 //=================================================================================
01010 // function : ActivateThisDialog()
01011 // purpose  :
01012 //=================================================================================
01013 void SMESHGUI_CreatePolyhedralVolumeDlg::ActivateThisDialog()
01014 {
01015   /* Emit a signal to deactivate the active dialog */
01016   mySMESHGUI->EmitSignalDeactivateDialog();   
01017   ConstructorsBox->setEnabled(true);
01018   GroupContent->setEnabled(true);
01019   GroupButtons->setEnabled(true);
01020   
01021   mySMESHGUI->SetActiveDialogBox( (QDialog*)this );
01022 
01023   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
01024     aViewWindow->SetSelectionMode( FaceSelection );
01025   SelectionIntoArgument();
01026 }
01027 
01028 
01029 //=================================================================================
01030 // function : enterEvent()
01031 // purpose  :
01032 //=================================================================================
01033 void SMESHGUI_CreatePolyhedralVolumeDlg::enterEvent(QEvent* e)
01034 {
01035   if ( ConstructorsBox->isEnabled() )
01036     return;  
01037   ActivateThisDialog();
01038 }
01039 
01040 
01041 //=================================================================================
01042 // function : closeEvent()
01043 // purpose  :
01044 //=================================================================================
01045 void SMESHGUI_CreatePolyhedralVolumeDlg::closeEvent( QCloseEvent* e )
01046 {
01047   /* same than click on cancel button */
01048   ClickOnCancel();
01049 }
01050 
01051 
01052 //=======================================================================
01053 //function : hideEvent
01054 //purpose  : caused by ESC key
01055 //=======================================================================
01056 
01057 void SMESHGUI_CreatePolyhedralVolumeDlg::hideEvent ( QHideEvent * e )
01058 {
01059   if ( !isMinimized() )
01060     ClickOnCancel();
01061 }
01062 
01063 
01064 //=================================================================================
01065 // function : GetConstructorId()
01066 // purpose  : 
01067 //=================================================================================
01068 int SMESHGUI_CreatePolyhedralVolumeDlg::GetConstructorId()
01069 { 
01070   return GroupConstructors->checkedId();
01071 }
01072 
01073 //=================================================================================
01074 // function : onAdd()
01075 // purpose  :
01076 //=================================================================================
01077 void SMESHGUI_CreatePolyhedralVolumeDlg::onAdd()
01078 {
01079   SALOME_ListIO selected;
01080   mySelectionMgr->selectedObjects( selected );
01081   int aNbSel = selected.Extent();
01082   if (aNbSel == 0 || !myActor || myMesh->_is_nil()) return;
01083   
01084   if (checkEditLine(false) == -1) return;
01085 
01086   busy = true;
01087   if ( !(myEditCurrentArgument->text().isEmpty()) )
01088     {
01089       myFacesByNodes->addItem(myEditCurrentArgument->text());
01090       //myFacesByNodes->setSelected(myFacesByNodes->count() - 1, true);
01091       myNbOkElements = 1;
01092       myEditCurrentArgument->clear();
01093       AddButton->setEnabled(false);
01094       buttonApply->setEnabled( myFacesByNodes->count() > 1 );
01095       buttonOk->setEnabled( myFacesByNodes->count() > 1 );
01096     }
01097   busy = false;
01098   onListSelectionChanged();
01099   displaySimulation();
01100 }
01101 
01102 //=================================================================================
01103 // function : onRemove()
01104 // purpose  :
01105 //=================================================================================
01106 void SMESHGUI_CreatePolyhedralVolumeDlg::onRemove()
01107 {
01108   busy = true;
01109   QList<QListWidgetItem*> selItems = myFacesByNodes->selectedItems();
01110   QListWidgetItem* anItem;
01111 
01112   if ( selItems.count() > 0 ) myNbOkElements = 1;
01113 
01114   foreach( anItem, selItems )
01115     delete anItem;
01116 
01117   RemoveButton->setEnabled( myFacesByNodes->count() > 0 );
01118   buttonOk->setEnabled( myFacesByNodes->count() > 1 );
01119   buttonApply->setEnabled( myFacesByNodes->count() > 1 );
01120 
01121   busy = false;
01122   displaySimulation();
01123 }
01124 
01125 //=================================================================================
01126 // function : onListSelectionChanged()
01127 // purpose  : Called when selection in element list is changed
01128 //=================================================================================
01129 void SMESHGUI_CreatePolyhedralVolumeDlg::onListSelectionChanged()
01130 {
01131   if (busy || !myActor) return;
01132   busy = true;
01133 
01134   SALOME_ListIO aList;
01135   mySelectionMgr->setSelectedObjects( aList );
01136   TColStd_MapOfInteger aIndexes;
01137 
01138   QList<QListWidgetItem*> selItems = myFacesByNodes->selectedItems();
01139   QListWidgetItem* anItem;
01140   foreach( anItem, selItems ) {
01141     QStringList anIds = anItem->text().split( " ", QString::SkipEmptyParts );
01142     for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it)
01143       aIndexes.Add((*it).toInt());
01144   }
01145   RemoveButton->setEnabled(selItems.count() > 0);
01146   mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, true );
01147   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
01148     aViewWindow->highlight( myActor->getIO(), true, true );
01149   mySelectionMgr->clearFilters(); 
01150   aList.Append( myActor->getIO() );
01151   mySelectionMgr->setSelectedObjects( aList );
01152   
01153   busy = false;
01154 }
01155 
01156 //=================================================================================
01157 // function : keyPressEvent()
01158 // purpose  :
01159 //=================================================================================
01160 void SMESHGUI_CreatePolyhedralVolumeDlg::keyPressEvent( QKeyEvent* e )
01161 {
01162   QDialog::keyPressEvent( e );
01163   if ( e->isAccepted() )
01164     return;
01165 
01166   if ( e->key() == Qt::Key_F1 ) {
01167     e->accept();
01168     ClickOnHelp();
01169   }
01170 }
01171 
01172 //=================================================================================
01173 // function : isValid
01174 // purpose  :
01175 //=================================================================================
01176 bool SMESHGUI_CreatePolyhedralVolumeDlg::isValid()
01177 {
01178   if( GroupGroups->isChecked() && ComboBox_GroupName->currentText().isEmpty() ) {
01179     SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ), tr( "GROUP_NAME_IS_EMPTY" ) );
01180     return false;
01181   }
01182   return true;
01183 }