Salome HOME
PR: synchro V7_main tag mergefrom_V6_main_06Mar13
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AddQuadraticElementDlg.cxx
index d42791c4fc87c3ba755509bd5f2e7144f541356b..2f7459ee2efb42225e8e68419c81cf8ed1174283 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -121,7 +121,7 @@ namespace SMESH
     vtkUnstructuredGrid* myGrid;
     //vtkProperty* myBackProp, *myProp;
 
-    //vtkFloatingPointType myRGB[3], myBackRGB[3];
+    //double myRGB[3], myBackRGB[3];
 
     SALOME_Actor* myFaceOrientation;
     vtkPolyDataMapper* myFaceOrientationDataMapper;
@@ -140,7 +140,7 @@ namespace SMESH
 
       // Create and display actor
       myMapper = vtkDataSetMapper::New();
-      myMapper->SetInput(myGrid);
+      myMapper->SetInputData(myGrid);
 
       myPreviewActor = SALOME_Actor::New();
       myPreviewActor->PickableOff();
@@ -148,7 +148,7 @@ namespace SMESH
       myPreviewActor->SetMapper(myMapper);
 
       vtkProperty* myProp = vtkProperty::New();
-      vtkFloatingPointType aRGB[3], aBackRGB[3];
+      double aRGB[3], aBackRGB[3];
       GetColor( "SMESH", "fill_color", aRGB[0], aRGB[1], aRGB[2], QColor( 0, 170, 255 ) );
       myProp->SetColor( aRGB[0], aRGB[1], aRGB[2] );
       myPreviewActor->SetProperty( myProp );
@@ -164,10 +164,10 @@ namespace SMESH
 
       // Orientation of faces
       myFaceOrientationFilter = SMESH_FaceOrientationFilter::New();
-      myFaceOrientationFilter->SetInput(myGrid);
+      myFaceOrientationFilter->SetInputData(myGrid);
 
       myFaceOrientationDataMapper = vtkPolyDataMapper::New();
-      myFaceOrientationDataMapper->SetInput(myFaceOrientationFilter->GetOutput());
+      myFaceOrientationDataMapper->SetInputConnection(myFaceOrientationFilter->GetOutputPort());
 
       myFaceOrientation = SALOME_Actor::New();
       myFaceOrientation->PickableOff();
@@ -628,13 +628,13 @@ void SMESHGUI_AddQuadraticElementDlg::Init()
   connect(myReverseCB,    SIGNAL(stateChanged(int)), SLOT(onReverse(int)));
 
   connect(buttonOk, SIGNAL(clicked()),     SLOT(ClickOnOk()));
-  connect(buttonCancel, SIGNAL(clicked()), SLOT(ClickOnCancel()));
+  connect(buttonCancel, SIGNAL(clicked()), SLOT(reject()));
   connect(buttonApply, SIGNAL(clicked()),  SLOT(ClickOnApply()));
   connect(buttonHelp, SIGNAL(clicked()),   SLOT(ClickOnHelp()));
 
   connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
-  connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
-  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), SLOT(ClickOnCancel()));
+  connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(reject()));
+  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), SLOT(reject()));
 
   myCurrentLineEdit = myCornerNodes;
 
@@ -711,12 +711,12 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply()
   int idx = 0;
   if( addToGroup ) {
     aGroupName = ComboBox_GroupName->currentText();
-    for ( int i = 1; i < ComboBox_GroupName->count(); i++ ) {
+    for ( int i = 1; i <= ComboBox_GroupName->count(); i++ ) {
       QString aName = ComboBox_GroupName->itemText( i );
       if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
         idx = i;
     }
-    if ( idx > 0 && idx < myGroups.count() ) {
+    if ( idx > 0 && idx <= myGroups.count() ) {
       SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
       if ( !aGeomGroup->_is_nil() ) {
         int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),
@@ -803,14 +803,14 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply()
 void SMESHGUI_AddQuadraticElementDlg::ClickOnOk()
 {
   ClickOnApply();
-  ClickOnCancel();
+  reject();
 }
 
 //=================================================================================
-// function : ClickOnCancel()
+// function : reject()
 // purpose  :
 //=================================================================================
-void SMESHGUI_AddQuadraticElementDlg::ClickOnCancel()
+void SMESHGUI_AddQuadraticElementDlg::reject()
 {
   mySelectionMgr->clearSelected();
   mySimulation->SetVisibility(false);
@@ -819,7 +819,7 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnCancel()
     aViewWindow->SetSelectionMode( ActorSelection );
   disconnect(mySelectionMgr, 0, this, 0);
   mySMESHGUI->ResetState();
-  reject();
+  QDialog::reject();
 }
 
 //=================================================================================
@@ -1134,26 +1134,6 @@ void SMESHGUI_AddQuadraticElementDlg::enterEvent (QEvent*)
   ActivateThisDialog();
 }
 
-//=================================================================================
-// function : closeEvent()
-// purpose  :
-//=================================================================================
-void SMESHGUI_AddQuadraticElementDlg::closeEvent (QCloseEvent*)
-{
-  /* same than click on cancel button */
-  ClickOnCancel();
-}
-
-//=================================================================================
-// function : hideEvent()
-// purpose  : caused by ESC key
-//=================================================================================
-void SMESHGUI_AddQuadraticElementDlg::hideEvent (QHideEvent*)
-{
-  if (!isMinimized())
-    ClickOnCancel();
-}
-
 //=================================================================================
 // function : onReverse()
 // purpose  :