Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/visu.git] / src / VISUGUI / VisuGUI_CutPlanesDlg.cxx
index 0e87bf97cab33215f6b11438fd5810ff2c822977..7758df1e5f2e3cb768499dd7b63551ee6539a28f 100644 (file)
 //  Module : VISU
 //  $Header$
 
-using namespace std;
 #include "VisuGUI_CutPlanesDlg.h"
-#include <qlayout.h>
+#include "VISU_CutPlanes_i.hh"
+#include "VISU_CutPlanesPL.hxx"
+
+#include "VisuGUI.h"
+#include "VTKViewer_ViewFrame.h"
+
 #include "QAD_Application.h"
 #include "QAD_Desktop.h"
+#include "QAD_RightFrame.h"
 
-/*!
-  Constructor
-*/
-VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
-    : QDialog(  QAD_Application::getDesktop(), "VisuGUI_CutPlanesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
-  setCaption( tr( "Cut Planes Definition" ) );
-  setSizeGripEnabled( TRUE );
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qstyle.h>
+#include <qstring.h>
+#include <qvalidator.h>
+#include <qlineedit.h>
+#include <qtabwidget.h>
 
+#include <vtkRenderer.h>
+#include <vtkPolyData.h>
+#include <vtkAppendPolyData.h>
+#include <vtkDataSetMapper.h>
+
+
+#define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
+
+using namespace std;
+
+extern VisuGUI *visuGUI;
+
+VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study* theStudy)
+  :QFrame(theParent), myPreviewActor(0),myStudy(theStudy)
+{
   QGridLayout* TopLayout = new QGridLayout( this ); 
   TopLayout->setSpacing( 6 );
-  TopLayout->setMargin( 11 );
+  TopLayout->setMargin( 10 );
+
   QButtonGroup* SelPlane = new QButtonGroup( tr( "Orientation" ), this, "SelPlane" );
   SelPlane->setTitle( tr( "Orientation" ) );
   SelPlane->setColumnLayout(0, Qt::Vertical );
@@ -55,9 +74,9 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
   SelPlaneLayout->setSpacing( 6 );
   SelPlaneLayout->setMargin( 11 );
 
-  RBzx = new QRadioButton( tr( "// Z-X" ), SelPlane, "RBzx" );
-  RByz = new QRadioButton( tr( "// Y-Z" ), SelPlane, "RByz" );
   RBxy = new QRadioButton( tr( "// X-Y" ), SelPlane, "RBxy" );
+  RByz = new QRadioButton( tr( "// Y-Z" ), SelPlane, "RByz" );
+  RBzx = new QRadioButton( tr( "// Z-X" ), SelPlane, "RBzx" );
   SelPlaneLayout->addWidget( RBxy, 0, 0 );
   SelPlaneLayout->addWidget( RByz, 0, 1 );
   SelPlaneLayout->addWidget( RBzx, 0, 2 );
@@ -68,6 +87,18 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
   nbPlan->setValue( 1 );
   nbPlan->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
+  myPosTable = new QTable(this, "Positions of planes" );
+  myPosTable->setMaximumHeight( 227 );
+  myPosTable->setMinimumWidth( 294 );
+  myPosTable->setNumCols(2);
+  myPosTable->setNumRows(0);
+  connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
+  
+  QHeader *th = myPosTable->horizontalHeader();
+  th->setLabel( 0, "Position" );
+  th->setLabel( 1, "Set default" );
+  th->setStyle("QStyle::CE_PushButton");
+    
   QGroupBox* GBrot = new QGroupBox( tr( "Rotations" ), this, "GBrot" );
   GBrot->setColumnLayout(0, Qt::Vertical );
   GBrot->layout()->setSpacing( 0 );
@@ -83,6 +114,7 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
   Rot1 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
   Rot1->setValue( 0 );
   Rot1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  connect( Rot1, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
   GBrotLayout->addWidget( Rot1, 0, 1 );
 
   LabelRot2 = new QLabel( tr( "Rotation around Y (Z to X):" ), GBrot, "LabelRot2" );
@@ -91,179 +123,451 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
   Rot2 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
   Rot2->setValue( 0 );
   Rot2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  connect( Rot2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
   GBrotLayout->addWidget( Rot2, 1, 1 );
 
-  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-
-  QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 );
-
-  QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons, "buttonCancel" );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
   QLabel* aPosLbl = new QLabel(tr( "LBL_POS" ), this);
   myPosSpn = new QAD_SpinBoxDbl( this, 0, 1, 0.1 );
 
-  // layouting
+  myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
+  myPreviewCheck->setChecked(false);
+  connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
+
   TopLayout->addMultiCellWidget( SelPlane, 0, 0, 0, 1 );
-  TopLayout->addWidget( LabelPosi_3,   1, 0 );
-  TopLayout->addWidget( nbPlan,        1, 1 );
-  TopLayout->addMultiCellWidget( GBrot,        2, 2, 0, 1 );
-  TopLayout->addWidget(aPosLbl, 3, 0 );
-  TopLayout->addWidget(myPosSpn, 3, 1 );
-  TopLayout->addMultiCellWidget( GroupButtons, 4, 4, 0, 1 );
+  TopLayout->addMultiCellWidget( GBrot, 1, 1, 0, 1 );
+  TopLayout->addWidget( LabelPosi_3,   2, 0 );
+  TopLayout->addWidget( nbPlan,        2, 1 );
+  TopLayout->addMultiCellWidget( myPosTable, 3, 3, 0, 1 );
+  TopLayout->setRowStretch ( 3, 3 );
+  TopLayout->addWidget(aPosLbl, 4, 0 );
+  TopLayout->addWidget(myPosSpn, 4, 1 );
+  TopLayout->addMultiCellWidget( myPreviewCheck, 5, 5, 0, 1 );
 
   // signals and slots connections
   connect( SelPlane, SIGNAL( clicked( int )), this, SLOT( orientationChanged( int ) ) );
-  
-  connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+  connect( nbPlan, SIGNAL( valueChanged( int )), this, SLOT( DrawTable( ) ) );
+  connect( myPosSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
+  connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
 
   // default values
+  myCutPlanes = NULL;
+  hasInit = false;
   X1 = 0; X2 = 0;
   Y1 = 0; Y2 = 0;
   Z1 = 0; Z2 = 0;
-  RBxy->setChecked( true );
-  orientationChanged( 0 );
-}
+  RByz->setChecked( true );
+  
+} // End of Constructor
 
-/*!
-  Destructor
-*/
-VisuGUI_CutPlanesDlg::~VisuGUI_CutPlanesDlg()
+
+VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane()
 {
+  deletePlanes();
+  if(myCutPlanes) myCutPlanes->Destroy();
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+    vf->Repaint();
 }
 
 
-void VisuGUI_CutPlanesDlg::initFromPrsObject(VISU::CutPlanes_i* thePrs) {
+void VisuGUI_CutPlanesPane::initFromPrsObject(VISU::CutPlanes_i* thePrs) {
   setNbPlanes(thePrs->GetNbPlanes());
   setRotation(thePrs->GetRotateX()*180./PI, thePrs->GetRotateY()*180./PI);
   setPlanePos(thePrs->GetOrientationType());
   myPosSpn->setValue(thePrs->GetDisplacement());
+  hasInit = true;
+  // init table
+  myCutPlanes = new VISU::CutPlanes_i(thePrs->GetResult(),false);
+  myCutPlanes->SameAs(thePrs);
+  DrawTable();
+
+  // Draw Preview
+  if (myPreviewCheck->isChecked()) {
+    createPlanes();
+  }
+}
+
+
+void VisuGUI_CutPlanesPane::createPlanes() {
+  if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
+  if (myCutPlanes == NULL) return;
+  if (myPreviewActor != 0) return;
+
+  vtkAppendPolyData* aPolyData = myCutPlanes->GetCutPlanesPL()->GetAppendPolyData();
+  vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
+  if (!aPolyData->GetOutput()->GetNumberOfCells()) {
+    onPreviewCheck(false);
+    return;
+  }
+  aPlaneMapper->SetInput(aPolyData->GetOutput());
+  aPlaneMapper->ScalarVisibilityOff();
+
+  myPreviewActor = SALOME_Actor::New();
+  myPreviewActor->PickableOff();
+  myPreviewActor->SetMapper(aPlaneMapper);
+  aPlaneMapper->Delete();
+  GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
 }
 
-void VisuGUI_CutPlanesDlg::storeToPrsObject(VISU::CutPlanes_i* thePrs) {
+
+
+int VisuGUI_CutPlanesPane::storeToPrsObject(VISU::CutPlanes_i* thePrs) {
+  thePrs->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
   thePrs->SetNbPlanes(getNbPlanes());
-  thePrs->SetRotateX(getRotation1()*PI/180.);
-  thePrs->SetRotateY(getRotation2()*PI/180.);
-  thePrs->SetOrientationType(getOrientaion());
   thePrs->SetDisplacement(myPosSpn->value());
-  thePrs->Update();
+  for (int i = 0; i < getNbPlanes(); ++i) 
+    {
+      if (!((QCheckTableItem*)myPosTable->item(i, 1))->isChecked())
+       thePrs->SetPlanePosition( i, myPosTable->text(i, 0).toDouble());
+      else thePrs->SetDefault(i);
+    }
+  return 1;
 }
 
+
 /*!
   Called when orientation is changed
 */
-void VisuGUI_CutPlanesDlg::orientationChanged( int )
+void VisuGUI_CutPlanesPane::orientationChanged( int Id )
 {
-  if ( RBxy->isChecked() ) {
+  if ( Id == 0 ) { // RBxy->isChecked()
     LabelRot1->setText( tr( "Rotation around X (Y to Z):" ) );
     LabelRot2->setText( tr( "Rotation around Y (Z to X):" ) );
-  } else if ( RByz->isChecked() ) {
+  } else if ( Id == 1 ) { // RByz->isChecked()
     LabelRot1->setText( tr( "Rotation around Y (Z to X):" ) );
     LabelRot2->setText( tr( "Rotation around Z (X to Y):" ) );
   } else { 
     LabelRot1->setText( tr( "Rotation around Z (X to Y):" ) );
     LabelRot2->setText( tr( "Rotation around X (Y to Z):" ) );
   }
+  DrawTable();
 }
 
 
 
-/*!
-  Sets bounds ( must be called first )
-*/
-void VisuGUI_CutPlanesDlg::setBounds( const double x1, const double x2, 
-                                     const double y1, const double y2, 
-                                     const double z1, const double z2 )
-{
-  X1 = min( x1, x2 ); X2 = max( x1, x2 );
-  Y1 = min( y1, y2 ); Y2 = max( y1, y2 );
-  Z1 = min( z1, z2 ); Z2 = max( z1, z2 );
-  orientationChanged( 0 );
-}
-
-/*!
-  Sets nb of planes
-*/
-void VisuGUI_CutPlanesDlg::setNbPlanes( const int nbp )
-{
-  nbPlan->setValue( nbp );
-}
-
-/*!
-  Gets nb of planes
-*/
-int VisuGUI_CutPlanesDlg::getNbPlanes()
-{
-  return nbPlan->value();
-}
 
 /*!
   Sets planes orientation and position
 */
-void VisuGUI_CutPlanesDlg::setPlanePos( const VISU::CutPlanes::Orientation  orient/*, const double pos1, const double pos2 */)
+void VisuGUI_CutPlanesPane::setPlanePos( const VISU::CutPlanes::Orientation  orient)
 {
   if ( orient == VISU::CutPlanes::XY )           // xy
-    RBxy->setChecked( true );
+    {
+      RBxy->setChecked( true );
+      orientationChanged( 0 );
+    }
   else if ( orient == VISU::CutPlanes::YZ )       // yz
-    RByz->setChecked( true );
+    {
+      RByz->setChecked( true );
+      orientationChanged( 1 );
+    }
   else                         // zx
-    RBzx->setChecked( true );
-  orientationChanged( 0 );
+   {
+     RBzx->setChecked( true );
+     orientationChanged( 2 );
+   }
+  
 }
 
-
 /*!
   Gets planes orientation
 */
-VISU::CutPlanes::Orientation VisuGUI_CutPlanesDlg::getOrientaion()
+VISU::CutPlanes::Orientation VisuGUI_CutPlanesPane::getOrientaion()
 {
   VISU::CutPlanes::Orientation orient;
   if ( RBxy->isChecked() )     // xy
     orient = VISU::CutPlanes::XY;
-  if ( RByz->isChecked() )     // yz
+  else if ( RByz->isChecked() )     // yz
     orient = VISU::CutPlanes::YZ;
-  if ( RBzx->isChecked() )     // zx
+  else if ( RBzx->isChecked() )     // zx
     orient = VISU::CutPlanes::ZX;
   return orient;
 }
 
-
 /*!
   Sets planes rotation
 */
-void VisuGUI_CutPlanesDlg::setRotation( const double r1, const double r2 )
+void VisuGUI_CutPlanesPane::setRotation( const double r1, const double r2 )
 {
   Rot1->setValue( r1 );
   Rot2->setValue( r2 );
 }
 
 /*!
-  Gets plane rotation 1
+  Draw the table of planes positions
 */
-double VisuGUI_CutPlanesDlg::getRotation1()
+
+void VisuGUI_CutPlanesPane::DrawTable()
+{
+  if (myCutPlanes == NULL) return;
+  if (!hasInit) return;
+
+  int aNbRows = myPosTable->numRows();
+  int aNbPlanes = getNbPlanes();  
+
+  myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
+  myCutPlanes->SetNbPlanes(aNbPlanes);
+  myCutPlanes->SetDisplacement(myPosSpn->value());
+  if (aNbRows>0)
+    for (int i = 0; i < aNbRows; ++i) {
+      QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
+      if (aItem == 0) break;
+      if (!aItem->isChecked())
+       myCutPlanes->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
+    }
+  
+  if (aNbPlanes > aNbRows)
+    myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
+  else if (aNbPlanes < aNbRows)
+    myPosTable->setNumRows(aNbPlanes);
+
+  int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
+  for (int i = 0; i<aMin; i++) {
+    myPosTable->setText(i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
+    ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutPlanes->IsDefault(i));
+  }
+
+  QHeader *vh = myPosTable->verticalHeader();
+  QString str("Plane# %1");
+  for (int i=aMin; i<aNbPlanes; i++) {
+    VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable, 
+                                                            QTableItem::OnTyping, 
+                                                            QString::number(myCutPlanes->GetPlanePosition(i)));
+    aEditItem->setReplaceable(false);
+    aEditItem->setEnabled(!myCutPlanes->IsDefault(i));
+    myPosTable->setItem(i, 0, aEditItem);
+
+    QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
+    aCheck->setChecked(myCutPlanes->IsDefault(i));
+    aCheck->setReplaceable(false);
+    myPosTable->setItem(i, 1, aCheck);
+    
+    vh->setLabel( i, str.arg(i+1) );
+  }
+
+  // Update preview
+  if (myPreviewCheck->isChecked()) {
+    if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+      myCutPlanes->GetPL()->Update();
+      deletePlanes();
+      createPlanes();
+      vf->Repaint();
+    }
+  }
+}
+
+void VisuGUI_CutPlanesPane::setDefault(int all)
 {
-  return Rot1->value();
+  myPosTable->setCurrentCell(-1, 1);
+  myPosTable->clearSelection();
+  if (all == 0) return;
+  if (all == 1)
+    for (int i = 0; i < getNbPlanes(); ++i) 
+      ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
+       
+  for (int i = 0; i < getNbPlanes(); ++i) {
+    if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
+      myCutPlanes->SetDefault(i);
+      myPosTable->setText( i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
+      myPosTable->item( i, 0 )->setEnabled(false);
+    } else 
+      myPosTable->item( i, 0 )->setEnabled(true); 
+  }
+}
+
+void VisuGUI_CutPlanesPane::onValueChanged(int theRow, int theCol) {
+  if (theCol == 0) {
+    QString aTxt = myPosTable->text(theRow, 0);
+    bool isChanged = !aTxt.isEmpty();
+    ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
+
+    if (myPreviewCheck->isChecked()) {
+      //Update Preview
+      if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+       myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble());
+       myCutPlanes->GetPL()->Update();
+       deletePlanes();
+       createPlanes();
+       vf->Repaint();
+      }
+    }
+  } else {
+    bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
+    if (isDefault) {
+      myCutPlanes->SetDefault(theRow);
+      myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow)));
+
+      if (myPreviewCheck->isChecked()) {
+       if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+         //Update Preview
+         myCutPlanes->GetPL()->Update();
+         deletePlanes();
+         createPlanes();
+         vf->Repaint();
+       }
+      }
+    }
+    myPosTable->item(theRow, 0)->setEnabled(!isDefault);
+  }
+}
+
+
+void VisuGUI_CutPlanesPane::deletePlanes() {
+  if (myPreviewActor == 0) return;
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+    vf->RemoveActor(myPreviewActor);
+  myPreviewActor->Delete();
+  myPreviewActor = 0;
+}
+
+void VisuGUI_CutPlanesPane::onRotation(double theValue) {
+  if (myCutPlanes == NULL) return;
+  if (myPreviewCheck->isChecked()) {
+    if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+      myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
+      myCutPlanes->GetPL()->Update();
+      deletePlanes();
+      createPlanes();  
+      vf->Repaint();  
+    }
+  }
+}
+
+
+void VisuGUI_CutPlanesPane::onPreviewCheck(bool thePreview) {
+  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+    if (thePreview) {
+      storeToPrsObject(myCutPlanes);
+      myCutPlanes->GetPL()->Update();
+      createPlanes();
+      vf->onViewFitAll();
+    } else {
+      deletePlanes();
+      vf->Repaint();
+    }
+  }
 }
 
+
+
+
+//###################################################################
+
+
+
 /*!
-  Gets plane rotation 2
+  Constructor
 */
-double VisuGUI_CutPlanesDlg::getRotation2()
+VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg(bool theIsCreation, bool theIsModal)
+  : QDialog(  QAD_Application::getDesktop(), "VisuGUI_CutPlanesDlg", theIsModal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu/* | WDestructiveClose */),
+    myStudy(QAD_Application::getDesktop()->getActiveStudy())
+{
+  myStudyFrame = myStudy -> getActiveStudyFrame();
+  if (!theIsModal) {
+    setWFlags(getWFlags() | WDestructiveClose);
+  }
+  setCaption( tr( "Cut Planes Definition" ) );
+  setSizeGripEnabled( TRUE );
+  myIsCreation = theIsCreation;
+
+  QVBoxLayout* TopLayout = new QVBoxLayout( this ); 
+  TopLayout->setSpacing( 6 );
+  TopLayout->setMargin( 11 );
+  QTabWidget* aTabBox = new QTabWidget(this);
+  myCutPane = new  VisuGUI_CutPlanesPane(this, myStudy);
+  aTabBox->addTab(myCutPane, "Cut Planes");
+  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+  myScalarPane->setMargin( 5 );
+  aTabBox->addTab(myScalarPane, "Scalar Bar");
+
+  TopLayout->addWidget(aTabBox);
+
+  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
+  GroupButtons->setTitle( tr( ""  ) );
+  GroupButtons->setColumnLayout(0, Qt::Vertical );
+  GroupButtons->layout()->setSpacing( 0 );
+  GroupButtons->layout()->setMargin( 0 );
+  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+  GroupButtonsLayout->setAlignment( Qt::AlignTop );
+  GroupButtonsLayout->setSpacing( 6 );
+  GroupButtonsLayout->setMargin( 11 );
+
+  QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+  buttonOk->setAutoDefault( TRUE );
+  buttonOk->setDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+  GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 );
+
+  QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons, "buttonCancel" );
+  buttonCancel->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+  TopLayout->addWidget(GroupButtons);
+
+  connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
+  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+  connect( myStudy, SIGNAL(closed()), this, SLOT( reject() ) );
+  connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
+}
+
+
+void VisuGUI_CutPlanesDlg::accept() {
+  if (myScalarPane->check()) {
+    if (!isModal()) {
+      if (storeToPrsObject(myPrs)) {
+       if (myIsCreation) { 
+         if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+           try {
+           visuGUI->CreateActor(myPrs);
+           }
+           catch (...) {
+             reject();
+             return;
+           }
+           GET_VTK_VIEWFRAME(myStudy)->onViewFitAll(); 
+         }
+       } else {
+         visuGUI->RecreateActor(myPrs);
+         if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+           if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
+             vf->getRenderer()->ResetCameraClippingRange();
+             vf->Repaint();
+           }
+         }
+       }
+      } else {
+       if (myIsCreation) {
+         visuGUI->DeletePresentation(myPrs);
+       }
+      }
+    }
+    QDialog::accept();
+  }
+}
+
+void VisuGUI_CutPlanesDlg::reject() {
+  if (myIsCreation && (!isModal())) {
+    visuGUI->DeletePresentation(myPrs);
+    myStudy -> updateObjBrowser();
+  }
+  QDialog::reject();
+}
+
+void VisuGUI_CutPlanesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
+  if (theFrame != myStudyFrame) 
+    reject();
+}
+
+//###################################################################
+
+
+
+QWidget* VisuGUI_NumEditItem::createEditor() const 
 {
-  return Rot2->value();
+  QLineEdit *editline = new QLineEdit(text(), table()->viewport());
+  QDoubleValidator *dvalidator = new QDoubleValidator(table()->viewport());
+  dvalidator->setDecimals(32);
+  editline->setValidator(dvalidator);
+  return editline;
 }