Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/visu.git] / src / VISUGUI / VisuGUI_ClippingDlg.cxx
index 4a7d8b95a00309a0717e6ff74275fbbe11231146..0312ffd7b7e4e9ce57883b254e19cc5ac9b5e8c4 100644 (file)
@@ -1,23 +1,24 @@
-// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either 
-// version 2.1 of the License.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-// Lesser General Public License for more details.
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-
 #include "VisuGUI_ClippingDlg.h"
 
 #include "VisuGUI.h"
 
 #include "VISU_Prs3d_i.hh"
 #include "VISU_Result_i.hh"
+#include "VISU_ColoredPrs3dHolder_i.hh"
 
 #include "VISU_PipeLine.hxx"
+#include "VISU_DataSetActor.h"
 
 #include "LightApp_SelectionMgr.h"
 #include "LightApp_Application.h"
 
 #include "SVTK_ViewWindow.h"
+#include <VTKViewer_Utilities.h>
 
 #include "SUIT_Session.h"
 #include "SUIT_Desktop.h"
 #include "SUIT_OverrideCursor.h"
 
 #include "SALOME_Actor.h"
+#include "VISU_ViewManager_i.hh"
 
 // QT Includes
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qcombobox.h>
-#include <qcheckbox.h>
-#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qvalidator.h>
-#include <qtabwidget.h>
-#include <qhbuttongroup.h>
-#include <qradiobutton.h>
-#include <qspinbox.h>
+#include <QLabel>
+#include <QComboBox>
+#include <QCheckBox>
+#include <QLayout>
+#include <QGroupBox>
+#include <QButtonGroup>
+#include <QValidator>
+#include <QTabWidget>
+#include <QRadioButton>
+#include <QSpinBox>
+#include <QKeyEvent>
+#include <QPushButton>
+#include <QListWidget>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QStackedWidget>
 
 // VTK Includes
 #include <vtkMath.h>
@@ -66,6 +76,7 @@
 #include <vtkPolyData.h>
 #include <vtkUnstructuredGrid.h>
 #include <vtkProperty.h>
+#include <vtkImplicitFunctionCollection.h>
 
 // OCCT Includes
 #include <gp_Dir.hxx>
@@ -90,12 +101,13 @@ namespace VISU {
     }
   }
 
-  void RangeStepAndValidator (QtxDblSpinBox* theSpinBox, double min, double max,
+  void RangeStepAndValidator (QtxDoubleSpinBox* theSpinBox, double min, double max,
                               double step, unsigned short decimals)
   {
     theSpinBox->setRange(min, max);
-    theSpinBox->setLineStep(step);
-    ((QDoubleValidator*)theSpinBox->validator())->setRange(min, max, decimals);
+    theSpinBox->setSingleStep(step);
+    theSpinBox->setRange(min, max );
+    theSpinBox->setDecimals( decimals);
   }
 };
 
@@ -237,123 +249,126 @@ struct TSetVisiblity {
 //
 //=================================================================================
 VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule,
-                                          const char* name,
-                                          bool modal,
-                                          WFlags fl)
-  : QDialog(VISU::GetDesktop(theModule), name, modal, WStyle_Customize |
-            WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+                                          bool modal )
+  : QDialog(VISU::GetDesktop(theModule), Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
     mySelectionMgr(VISU::GetSelectionMgr(theModule)),
     myVisuGUI(theModule),
     myPrs3d(0),
-    myIsSelectPlane(false)
+    myIsSelectPlane(false),
+    myDSActor(0)
 {
-  if (!name)
-    setName("VisuGUI_ClippingDlg");
-  setCaption(tr("TITLE"));
+  setWindowTitle(tr("TITLE"));
   setSizeGripEnabled(TRUE);
-  QGridLayout* VisuGUI_ClippingDlgLayout = new QGridLayout(this);
+  setAttribute( Qt::WA_DeleteOnClose, true );
+
+  QVBoxLayout* VisuGUI_ClippingDlgLayout = new QVBoxLayout(this);
   VisuGUI_ClippingDlgLayout->setSpacing(6);
   VisuGUI_ClippingDlgLayout->setMargin(11);
+  
+  QStackedWidget* aStackWidget = new QStackedWidget(this);
+  VisuGUI_ClippingDlgLayout->addWidget(aStackWidget);
+  // Local planes
+  QWidget* aLocalPlanes = new QWidget(aStackWidget);
+  QVBoxLayout* aLocalLayout = new QVBoxLayout(aLocalPlanes);
+  aStackWidget->addWidget(aLocalPlanes);
 
   // Controls for selecting, creating, deleting planes
-  QGroupBox* GroupPlanes = new QGroupBox (this, "GroupPlanes");
-  GroupPlanes->setTitle(tr("GRP_PLANES"));
-  GroupPlanes->setColumnLayout(0, Qt::Vertical);
-  GroupPlanes->layout()->setSpacing(0);
-  GroupPlanes->layout()->setMargin(0);
-  QGridLayout* GroupPlanesLayout = new QGridLayout (GroupPlanes->layout());
+  QGroupBox* GroupPlanes = new QGroupBox (tr("GRP_PLANES"),  aLocalPlanes);
+  QGridLayout* GroupPlanesLayout = new QGridLayout (GroupPlanes);
   GroupPlanesLayout->setAlignment(Qt::AlignTop);
   GroupPlanesLayout->setSpacing(6);
   GroupPlanesLayout->setMargin(11);
+  aLocalLayout->addWidget(GroupPlanes);
 
-  ComboBoxPlanes = new QComboBox (GroupPlanes, "ComboBoxPlanes");
+  ComboBoxPlanes = new QComboBox (GroupPlanes);
   GroupPlanesLayout->addWidget(ComboBoxPlanes, 0, 0);
 
   QSpacerItem* spacerGP = new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
   GroupPlanesLayout->addItem(spacerGP, 0, 1);
 
-  buttonNew = new QPushButton (GroupPlanes, "buttonNew");
+  buttonNew = new QPushButton (GroupPlanes );
   buttonNew->setText(tr("BUT_NEW"));
   GroupPlanesLayout->addWidget(buttonNew, 0, 2);
 
-  buttonDelete = new QPushButton(GroupPlanes, "buttonDelete");
+  buttonDelete = new QPushButton(GroupPlanes);
   buttonDelete->setText(tr("BUT_DELETE"));
   GroupPlanesLayout->addWidget(buttonDelete, 0, 3);
 
   // Controls for defining plane parameters
 
   // Tab pane
-  QGroupBox* GroupParameters = new QGroupBox(this, "GroupParameters");
-  GroupParameters->setTitle(tr("GRP_PARAMETERS"));
-  GroupParameters->setColumnLayout(0, Qt::Vertical);
-  GroupParameters->layout()->setSpacing(0);
-  GroupParameters->layout()->setMargin(0);
-  QGridLayout* GroupParametersLayout = new QGridLayout (GroupParameters->layout());
+  QGroupBox* GroupParameters = new QGroupBox(tr("GRP_PARAMETERS"), aLocalPlanes);
+  QGridLayout* GroupParametersLayout = new QGridLayout (GroupParameters);
   GroupParametersLayout->setAlignment(Qt::AlignTop);
   GroupParametersLayout->setSpacing(6);
   GroupParametersLayout->setMargin(11);
+  aLocalLayout->addWidget(GroupParameters);
 
   TabPane = new QTabWidget (GroupParameters);
   TabPane->addTab(createParamsTab()   , tr("TAB_NON_STRUCTURED"));
   TabPane->addTab(createIJKParamsTab(), tr("TAB_IJK_STRUCTURED"));
   GroupParametersLayout->addWidget(TabPane, 0, 0);
 
+
+
+
+
   // "Show preview" and "Auto Apply" check boxes
+  QHBoxLayout* aCheckBoxLayout = new QHBoxLayout(this);
+  VisuGUI_ClippingDlgLayout->addLayout(aCheckBoxLayout);
 
   PreviewCheckBox = new QCheckBox (tr("SHOW_PREVIEW_CHK"), this);
   PreviewCheckBox->setChecked(true);
+  aCheckBoxLayout->addWidget(PreviewCheckBox);
+  aCheckBoxLayout->addStretch();
 
   AutoApplyCheckBox = new QCheckBox (tr("AUTO_APPLY_CHK"), this);
   AutoApplyCheckBox->setChecked(false);
+  aCheckBoxLayout->addWidget(AutoApplyCheckBox);
 
   // Controls for "Ok", "Apply" and "Close" button
-  QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
-  GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7,
-                                          (QSizePolicy::SizeType)0, 0, 0,
-                                          GroupButtons->sizePolicy().hasHeightForWidth()));
+  QGroupBox* GroupButtons = new QGroupBox (this);
+  VisuGUI_ClippingDlgLayout->addWidget(GroupButtons);
+  QSizePolicy aSizePolicy(QSizePolicy::Expanding,
+                          QSizePolicy::Fixed );
+  aSizePolicy.setHeightForWidth( GroupButtons->sizePolicy().hasHeightForWidth() );
+  aSizePolicy.setHorizontalStretch( 0 );
+  aSizePolicy.setVerticalStretch( 0 );
+  GroupButtons->setSizePolicy( aSizePolicy );
   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());
+  QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons);
+  GroupButtons->setLayout(GroupButtonsLayout);
   GroupButtonsLayout->setAlignment(Qt::AlignTop);
   GroupButtonsLayout->setSpacing(6);
   GroupButtonsLayout->setMargin(11);
-  buttonHelp = new QPushButton (GroupButtons, "buttonHelp");
+  buttonHelp = new QPushButton (GroupButtons);
   buttonHelp->setText(tr("BUT_HELP"));
   buttonHelp->setAutoDefault(TRUE);
   GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
-  buttonCancel = new QPushButton (GroupButtons, "buttonCancel");
+  buttonCancel = new QPushButton (GroupButtons);
   buttonCancel->setText(tr("BUT_CLOSE"));
   buttonCancel->setAutoDefault(TRUE);
   GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
-  buttonApply = new QPushButton (GroupButtons, "buttonApply");
+  buttonApply = new QPushButton (GroupButtons);
   buttonApply->setText(tr("BUT_APPLY"));
   buttonApply->setAutoDefault(TRUE);
   GroupButtonsLayout->addWidget(buttonApply, 0, 1);
   QSpacerItem* spacer_9 = new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
   GroupButtonsLayout->addItem(spacer_9, 0, 2);
-  buttonOk = new QPushButton (GroupButtons, "buttonOk");
+  buttonOk = new QPushButton (GroupButtons);
   buttonOk->setText(tr("BUT_OK"));
   buttonOk->setAutoDefault(TRUE);
   buttonOk->setDefault(TRUE);
   GroupButtonsLayout->addWidget(buttonOk, 0, 0);
 
-  VisuGUI_ClippingDlgLayout->addMultiCellWidget(GroupPlanes,     0, 0, 0, 1);
-  VisuGUI_ClippingDlgLayout->addMultiCellWidget(GroupParameters, 1, 1, 0, 1);
-  VisuGUI_ClippingDlgLayout->addWidget(PreviewCheckBox,          2,    0);
-  VisuGUI_ClippingDlgLayout->addWidget(AutoApplyCheckBox,        2,    1);
-  VisuGUI_ClippingDlgLayout->addMultiCellWidget(GroupButtons,    3, 3, 0, 1);
-
   // Initial state
   VISU::RangeStepAndValidator(SpinBoxDistance, 0.0, 1.0, 0.01, 3);
   VISU::RangeStepAndValidator(SpinBoxRot1, -180.0, 180.0, 1, 3);
   VISU::RangeStepAndValidator(SpinBoxRot2, -180.0, 180.0, 1, 3);
 
-  ComboBoxOrientation->insertItem(tr("PARALLEL_XOY_COMBO_ITEM"));
-  ComboBoxOrientation->insertItem(tr("PARALLEL_YOZ_COMBO_ITEM"));
-  ComboBoxOrientation->insertItem(tr("PARALLEL_ZOX_COMBO_ITEM"));
+  ComboBoxOrientation->addItem(tr("PARALLEL_XOY_COMBO_ITEM"));
+  ComboBoxOrientation->addItem(tr("PARALLEL_YOZ_COMBO_ITEM"));
+  ComboBoxOrientation->addItem(tr("PARALLEL_ZOX_COMBO_ITEM"));
 
   SpinBoxDistance->setValue(0.5);
 
@@ -367,7 +382,7 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule,
   connect(SpinBoxDistance        , SIGNAL(valueChanged(double))     , this, SLOT(SetCurrentPlaneParam()));
   connect(SpinBoxRot1            , SIGNAL(valueChanged(double))     , this, SLOT(SetCurrentPlaneParam()));
   connect(SpinBoxRot2            , SIGNAL(valueChanged(double))     , this, SLOT(SetCurrentPlaneParam()));
-  connect(ButtonGroupIJKAxis     , SIGNAL(clicked(int))             , this, SLOT(onIJKAxisChanged(int)));
+  connect(ButtonGroupIJKAxis     , SIGNAL(buttonClicked(int))             , this, SLOT(onIJKAxisChanged(int)));
   connect(SpinBoxIJKIndex        , SIGNAL(valueChanged(int))        , this, SLOT(SetCurrentPlaneIJKParam()));
   connect(CheckBoxIJKPlaneReverse, SIGNAL(toggled(bool))            , this, SLOT(SetCurrentPlaneIJKParam()));
   connect(TabPane                , SIGNAL(currentChanged (QWidget*)), this, SLOT(onTabChanged(QWidget*)));
@@ -409,32 +424,32 @@ QWidget* VisuGUI_ClippingDlg::createParamsTab()
   GroupParametersLayout->setSpacing(6);
   GroupParametersLayout->setMargin(11);
 
-  TextLabelOrientation = new QLabel(GroupParameters, "TextLabelOrientation");
+  TextLabelOrientation = new QLabel(GroupParameters);
   TextLabelOrientation->setText(tr("LBL_ORIENTATION"));
   GroupParametersLayout->addWidget(TextLabelOrientation, 0, 0);
 
-  ComboBoxOrientation = new QComboBox(GroupParameters, "ComboBoxOrientation");
+  ComboBoxOrientation = new QComboBox(GroupParameters);
   GroupParametersLayout->addWidget(ComboBoxOrientation, 0, 1);
 
-  TextLabelDistance = new QLabel(GroupParameters, "TextLabelDistance");
+  TextLabelDistance = new QLabel(GroupParameters);
   TextLabelDistance->setText(tr("LBL_DISTANCE"));
   GroupParametersLayout->addWidget(TextLabelDistance, 1, 0);
 
-  SpinBoxDistance = new QtxDblSpinBox(GroupParameters, "SpinBoxDistance");
+  SpinBoxDistance = new QtxDoubleSpinBox(GroupParameters);
   GroupParametersLayout->addWidget(SpinBoxDistance, 1, 1);
 
-  TextLabelRot1 = new QLabel(GroupParameters, "TextLabelRot1");
+  TextLabelRot1 = new QLabel(GroupParameters);
   TextLabelRot1->setText(tr("LBL_ROTATION_YZ"));
   GroupParametersLayout->addWidget(TextLabelRot1, 2, 0);
 
-  SpinBoxRot1 = new QtxDblSpinBox(GroupParameters, "SpinBoxRot1");
+  SpinBoxRot1 = new QtxDoubleSpinBox(GroupParameters);
   GroupParametersLayout->addWidget(SpinBoxRot1, 2, 1);
 
-  TextLabelRot2 = new QLabel(GroupParameters, "TextLabelRot2");
+  TextLabelRot2 = new QLabel(GroupParameters);
   TextLabelRot2->setText(tr("LBL_ROTATION_XZ"));
   GroupParametersLayout->addWidget(TextLabelRot2, 3, 0);
 
-  SpinBoxRot2 = new QtxDblSpinBox(GroupParameters, "SpinBoxRot2");
+  SpinBoxRot2 = new QtxDoubleSpinBox(GroupParameters);
   GroupParametersLayout->addWidget(SpinBoxRot2, 3, 1);
 
   return GroupParameters;
@@ -454,22 +469,28 @@ QWidget* VisuGUI_ClippingDlg::createIJKParamsTab()
   IJKParametersLayout->setMargin(11);
 
   // Axis group
-  ButtonGroupIJKAxis = new QHButtonGroup (tr("GRP_IJK_AXIS"), WidgetIJKTab);
-  new QRadioButton (tr("I_RADIO_BTN"), ButtonGroupIJKAxis);  // 0
-  new QRadioButton (tr("J_RADIO_BTN"), ButtonGroupIJKAxis);  // 1
-  new QRadioButton (tr("K_RADIO_BTN"), ButtonGroupIJKAxis);  // 2
-  ButtonGroupIJKAxis->setButton(0);
+  ButtonGroupIJKAxis = new QButtonGroup ( WidgetIJKTab);
+  //QGroupBox* aGBGroupBoxIJKAxis= new QGroupBox(tr("GRP_IJK_AXIS"), WidgetIJKTab );
+  GroupBoxIJKAxis= new QGroupBox(tr("GRP_IJK_AXIS"), WidgetIJKTab );
+  QHBoxLayout* aHBLay = new QHBoxLayout( GroupBoxIJKAxis  );
+  ButtonGroupIJKAxis->addButton( new QRadioButton (tr("I_RADIO_BTN"), GroupBoxIJKAxis), 0 );  // 0
+  ButtonGroupIJKAxis->addButton( new QRadioButton (tr("J_RADIO_BTN"), GroupBoxIJKAxis), 1 );  // 1
+  ButtonGroupIJKAxis->addButton( new QRadioButton (tr("K_RADIO_BTN"), GroupBoxIJKAxis), 2 );  // 2
+  ButtonGroupIJKAxis->button(0)->setChecked(true);
+  aHBLay->addWidget( ButtonGroupIJKAxis->button(0) );
+  aHBLay->addWidget( ButtonGroupIJKAxis->button(1) );
+  aHBLay->addWidget( ButtonGroupIJKAxis->button(2) );  
 
   // Index
-  TextLabelIJKIndex = new QLabel(WidgetIJKTab, "TextLabelIJKIndex");
+  TextLabelIJKIndex = new QLabel(WidgetIJKTab);
   TextLabelIJKIndex->setText(tr("LBL_IJK_INDEX"));
-  SpinBoxIJKIndex = new QSpinBox(WidgetIJKTab, "SpinBoxIJKIndex");
+  SpinBoxIJKIndex = new QSpinBox(WidgetIJKTab);
 
   // Orientation
   CheckBoxIJKPlaneReverse = new QCheckBox (tr("REVERSE_NORMAL_CHK"), WidgetIJKTab);
   CheckBoxIJKPlaneReverse->setChecked(false);
 
-  IJKParametersLayout->addMultiCellWidget(ButtonGroupIJKAxis, 0, 0, 0, 1);
+  IJKParametersLayout->addWidget(GroupBoxIJKAxis, 0, 0, 1, 2);
   IJKParametersLayout->addWidget(TextLabelIJKIndex,          1, 0);
   IJKParametersLayout->addWidget(SpinBoxIJKIndex,            1, 1);
   IJKParametersLayout->addWidget(CheckBoxIJKPlaneReverse, 2, 0);
@@ -482,6 +503,16 @@ QWidget* VisuGUI_ClippingDlg::createIJKParamsTab()
 // purpose  :
 //=================================================================================
 void VisuGUI_ClippingDlg::ClickOnApply()
+{
+  applyLocalPlanes();
+}
+
+
+//=================================================================================
+// function : applyLocalPlanes()
+// purpose  :
+//=================================================================================
+void VisuGUI_ClippingDlg::applyLocalPlanes()
 {
   if (!myPrs3d)
     return;
@@ -506,7 +537,8 @@ void VisuGUI_ClippingDlg::ClickOnApply()
     }
 
     // Try to apply new clipping
-    myPrs3d->RemoveAllClippingPlanes();
+    //myPrs3d->RemoveAllClippingPlanes();
+    removeAllClippingPlanes(myPrs3d);
 
     VISU::TPlanes::iterator anIter = myPlanes.begin();
     for (; anIter != myPlanes.end(); anIter++) {
@@ -531,17 +563,18 @@ void VisuGUI_ClippingDlg::ClickOnApply()
 
     if (isFailed) {
       // Restore previous clipping state because of failure.
-      myPrs3d->RemoveAllClippingPlanes();
+      //myPrs3d->RemoveAllClippingPlanes();
+      removeAllClippingPlanes(myPrs3d);
 
       TPlns::iterator anOldIter = anOldPlanes.begin();
       for (; anOldIter != anOldPlanes.end(); anOldIter++) {
         myPrs3d->AddClippingPlane(anOldIter->GetPointer());
       }
 
-      SUIT_MessageBox::warn1(VISU::GetDesktop(myVisuGUI),
-                             tr("WRN_VISU"),
-                             tr("WRN_EMPTY_RESULTING_PRS"),
-                             tr("BUT_OK") );
+      SUIT_MessageBox::warning(VISU::GetDesktop(myVisuGUI),
+                               tr("WRN_VISU"),
+                               tr("WRN_EMPTY_RESULTING_PRS"),
+                               tr("BUT_OK") );
     }
 
     //VISU::RenderViewWindow(aViewWindow);
@@ -549,6 +582,9 @@ void VisuGUI_ClippingDlg::ClickOnApply()
   }
 }
 
+
+
+
 //=================================================================================
 // function : ClickOnOk()
 // purpose  :
@@ -585,10 +621,10 @@ void VisuGUI_ClippingDlg::ClickOnHelp()
 #else
     platform = "application";
 #endif
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
+    SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
+                             QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
+                             QObject::tr("BUT_OK"));
   }
 }
 
@@ -613,7 +649,19 @@ void VisuGUI_ClippingDlg::onSelectionChanged()
     if (!anIO.IsNull()) 
       myIO = anIO;
 
-    SetPrs3d(dynamic_cast<VISU::Prs3d_i*>(aBase));
+    //----
+    // rnv: fix for issue 0020114 (EDF VISU 918 : Impossible to 
+    // create a new clipping plane on field presentation)
+    // set last visited presentation from holder as myPrs3d
+    VISU::ColoredPrs3dHolder_i* aHolder = dynamic_cast<VISU::ColoredPrs3dHolder_i*>(aBase);
+    VISU::Prs3d_i* aPrs3d = NULL;
+    if(aHolder) 
+      aPrs3d = aHolder->GetPrs3dDevice();
+    else
+      aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aBase);
+    //----
+    
+    SetPrs3d(aPrs3d);
     if (myPrs3d) {
       std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
       myPlanes.clear();
@@ -640,7 +688,7 @@ void VisuGUI_ClippingDlg::onSelectionChanged()
     }
 
     // enable/disable IJK tab
-    TabPane->setTabEnabled(WidgetIJKTab, isStructured());
+    TabPane->setTabEnabled(TabPane->indexOf(WidgetIJKTab), isStructured());
     Sinchronize();
     VISU::RenderViewWindow(aViewWindow);
   }
@@ -673,9 +721,9 @@ void VisuGUI_ClippingDlg::onSelectPlane(int theIndex)
   case VISU::YZ: item = 1; break;
   case VISU::ZX: item = 2; break;
   }
-  ComboBoxOrientation->setCurrentItem(item);
+  ComboBoxOrientation->setCurrentIndex(item);
 
-  bool isIJK = (TabPane->currentPage() == WidgetIJKTab);
+  bool isIJK = (TabPane->currentWidget() == WidgetIJKTab);
   if (isIJK)
     setIJKByNonStructured();
   else
@@ -729,7 +777,7 @@ void VisuGUI_ClippingDlg::ClickOnDelete()
   if (!myPrs3d || myPlanes.empty())
     return;
 
-  int aPlaneIndex = ComboBoxPlanes->currentItem();
+  int aPlaneIndex = ComboBoxPlanes->currentIndex();
 
   VISU::TPlanes::iterator anIter = myPlanes.begin() + aPlaneIndex;
   anIter->GetPointer()->myActor->SetVisibility(false);
@@ -781,58 +829,44 @@ void VisuGUI_ClippingDlg::Sinchronize()
   QString aName;
   for (int i = 1; i<=aNbPlanes; i++) {
     aName = QString(tr("PLANES_COMBO_ITEM_i")).arg(i);
-    ComboBoxPlanes->insertItem(aName);
+    ComboBoxPlanes->addItem(aName);
   }
 
   int aPos = ComboBoxPlanes->count() - 1;
-  ComboBoxPlanes->setCurrentItem(aPos);
+  ComboBoxPlanes->setCurrentIndex(aPos);
 
   bool anIsControlsEnable = (aPos >= 0);
   if (anIsControlsEnable) {
     onSelectPlane(aPos);
   } else {
-    ComboBoxPlanes->insertItem(tr("PLANES_COMBO_ITEM_no"));
+    ComboBoxPlanes->addItem(tr("PLANES_COMBO_ITEM_no"));
     SpinBoxRot1->setValue(0.0);
     SpinBoxRot2->setValue(0.0);
     SpinBoxDistance->setValue(0.5);
   }
 
   buttonDelete           ->setEnabled(anIsControlsEnable);
-  buttonApply            ->setEnabled(anIsControlsEnable);
-  PreviewCheckBox        ->setEnabled(anIsControlsEnable);
-  AutoApplyCheckBox      ->setEnabled(anIsControlsEnable);
+  //buttonApply            ->setEnabled(anIsControlsEnable);
+  //  PreviewCheckBox        ->setEnabled(anIsControlsEnable);
+  //  AutoApplyCheckBox      ->setEnabled(anIsControlsEnable);
 
   ComboBoxOrientation    ->setEnabled(anIsControlsEnable);
   SpinBoxDistance        ->setEnabled(anIsControlsEnable);
   SpinBoxRot1            ->setEnabled(anIsControlsEnable);
   SpinBoxRot2            ->setEnabled(anIsControlsEnable);
 
-  ButtonGroupIJKAxis     ->setEnabled(anIsControlsEnable);
+  GroupBoxIJKAxis        ->setEnabled(anIsControlsEnable);
   SpinBoxIJKIndex        ->setEnabled(anIsControlsEnable);
   CheckBoxIJKPlaneReverse->setEnabled(anIsControlsEnable);
   //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
-  if(myPrs3d){
+  if ( myPrs3d ) {
     VISU_PipeLine* aPipeLine = myPrs3d->GetPipeLine();
     VISU::PIDMapper anIDMapper = aPipeLine->GetIDMapper();
-    if(anIDMapper->IsStructured()){
-      VISU::TIdTypeVector aVec = anIDMapper->GetStructure();
-      switch(aVec.size()){
-      case 1:
-       ButtonGroupIJKAxis->find(0)->setEnabled(true);
-       ButtonGroupIJKAxis->find(1)->setEnabled(false);
-       ButtonGroupIJKAxis->find(2)->setEnabled(false);
-       break;
-      case 2:
-       ButtonGroupIJKAxis->find(0)->setEnabled(true);
-       ButtonGroupIJKAxis->find(1)->setEnabled(true);
-       ButtonGroupIJKAxis->find(2)->setEnabled(false);
-       break;
-      case 3:
-       ButtonGroupIJKAxis->find(0)->setEnabled(true);
-       ButtonGroupIJKAxis->find(1)->setEnabled(true);
-       ButtonGroupIJKAxis->find(2)->setEnabled(true);
-       break;
-      }
+    if ( anIDMapper->IsStructured() ) {
+      VISU::TStructuredId aStructuredId = anIDMapper->GetStructure();
+      ButtonGroupIJKAxis->button(0)->setEnabled( aStructuredId[0] >= 0 );
+      ButtonGroupIJKAxis->button(1)->setEnabled( aStructuredId[1] >= 0 );
+      ButtonGroupIJKAxis->button(2)->setEnabled( aStructuredId[2] >= 0 );
     }
   }
   //ENK: 23.11.2006
@@ -857,7 +891,7 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneParam()
   if (myPlanes.empty() || myIsSelectPlane)
     return;
 
-  int aCurPlaneIndex = ComboBoxPlanes->currentItem();
+  int aCurPlaneIndex = ComboBoxPlanes->currentIndex();
 
   OrientedPlane* aPlane = myPlanes[aCurPlaneIndex].GetPointer();
 
@@ -876,7 +910,7 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneParam()
     aV[0] = aRot[0] > 0? aV[0]: -aV[0];
     aV[1] = aRot[1] > 0? aV[1]: -aV[1];
 
-    switch (ComboBoxOrientation->currentItem()) {
+    switch (ComboBoxOrientation->currentIndex()) {
     case 0:
       anOrientation = VISU::XY;
 
@@ -976,7 +1010,7 @@ void VisuGUI_ClippingDlg::onTabChanged(QWidget* newTab)
     setIJKByNonStructured();
   else {
     // set correct labels of rotation spin boxes
-    onSelectOrientation(ComboBoxOrientation->currentItem());
+    onSelectOrientation(ComboBoxOrientation->currentIndex());
   }
 }
 
@@ -994,7 +1028,7 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam()
     return;
 
   // get axis data
-  int i, axId = ButtonGroupIJKAxis->id (ButtonGroupIJKAxis->selected());
+  int i, axId = ButtonGroupIJKAxis->id (ButtonGroupIJKAxis->checkedButton());
   VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) axId;
   gp_Dir dir;
   CORBA::String_var aMeshName = myPrs3d->GetMeshName();
@@ -1045,7 +1079,7 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam()
 
   // set paramerets
   myIsSelectPlane = true;
-  ComboBoxOrientation->setCurrentItem(axId);
+  ComboBoxOrientation->setCurrentIndex(axId);
   setRotation(-angle[0], -angle[1]);
   setDistance(distance);
   myIsSelectPlane = false;
@@ -1063,7 +1097,7 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured()
     return;
 
   // get plane normal
-  int planeIndex = ComboBoxPlanes->currentItem();
+  int planeIndex = ComboBoxPlanes->currentIndex();
   OrientedPlane* plane = myPlanes[ planeIndex ].GetPointer();
   vtkPlaneSource* planeSource = plane->myPlaneSource;
   vtkFloatingPointType * planeNormal = planeSource->GetNormal();
@@ -1079,8 +1113,8 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured()
   int aNbAxes = 3;
   VISU_PipeLine* aPipeLine = myPrs3d->GetPipeLine();
   VISU::PIDMapper anIDMapper = aPipeLine->GetIDMapper();
-  if(anIDMapper->IsStructured() && !anIDMapper->myType)
-    aNbAxes = (anIDMapper->GetStructure()).size();
+  if ( anIDMapper->IsStructured() && !anIDMapper->myIsPolarType )
+    aNbAxes = anIDMapper->GetStructureDim();
   for (i = 0; i < aNbAxes; ++i) {
     VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) i;
     CORBA::String_var aMeshName = myPrs3d->GetMeshName();
@@ -1127,7 +1161,7 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured()
   myIsSelectPlane = true;
   CheckBoxIJKPlaneReverse->setChecked(normal * axDir < 0);
   SpinBoxIJKIndex->setValue(i);
-  ButtonGroupIJKAxis->setButton(gridAxId);
+  ButtonGroupIJKAxis->button(gridAxId)->setChecked( true );
   onIJKAxisChanged(gridAxId); // update label and range of index
   myIsSelectPlane = false;
 
@@ -1200,7 +1234,7 @@ void VisuGUI_ClippingDlg::keyPressEvent( QKeyEvent* e )
   if ( e->isAccepted() )
     return;
 
-  if ( e->key() == Key_F1 )
+  if ( e->key() == Qt::Key_F1 )
     {
       e->accept();
       ClickOnHelp();
@@ -1218,3 +1252,15 @@ void VisuGUI_ClippingDlg::SetPrs3d(VISU::Prs3d_i* thePrs)
   } else 
     return;
 }
+
+
+void VisuGUI_ClippingDlg::removeAllClippingPlanes(VISU::Prs3d_i* thePrs)
+{
+  for (int i = thePrs->GetNumberOfClippingPlanes() - 1; i >= 0 ; i--) {
+    OrientedPlane* aPlane = dynamic_cast<OrientedPlane*>(thePrs->GetClippingPlane(i));
+    if (aPlane) 
+      thePrs->RemoveClippingPlane(i);
+  }
+}
+
+