Salome HOME
Improvement: Bug PAL10401 wrong sens in cut line
[modules/visu.git] / src / VISUGUI / VisuGUI_CutLinesDlg.cxx
index a92048576ae44c5c3fe87ee0283fc5d69984cde1..1db03f8f6ce1e0355aa12aa2a35a6ca2f6a9b60a 100644 (file)
@@ -9,15 +9,25 @@
 //  Module : VISU
 
 #include "VisuGUI_CutLinesDlg.h"
-#include "VISU_CutLines_i.hh"
+
 #include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_Gen_i.hh"
+#include "VISU_CutLines_i.hh"
+
 #include "VISU_PipeLine.hxx"
-#include "VTKViewer_ViewFrame.h"
+#include "VISU_PipeLineUtils.hxx"
 #include "VISU_CutLinesPL.hxx"
-#include "VISU_Gen_i.hh"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
+#include "SVTK_ViewWindow.h"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Study.h"
+
+#include "SUIT_Desktop.h"
+
+#include "OB_Browser.h"
 
 #include <qlayout.h>
 #include <qhbox.h>
 #include <vtkPolyData.h>
 #include <vtkAppendPolyData.h>
 #include <vtkDataSetMapper.h>
+#include <vtkGlyph3D.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkFloatArray.h>
+#include <vtkGlyphSource2D.h>
 
 using namespace std;
 
-extern VisuGUI *visuGUI;
-
-#include  "QAD_RightFrame.h"
-#define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
-
 bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
 bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
 
-VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg(bool theIsCreation)
-    : QDialog(  QAD_Application::getDesktop(), "VisuGUI_CutLinesDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), 
-      myPreviewActor(0),
-      myStudy(QAD_Application::getDesktop()->getActiveStudy())
+VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
+     : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutLinesDlg", false,
+               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+       myPreviewActor(0),myPreviewActorGlyphs(0)
 {
-  myStudyFrame = myStudy -> getActiveStudyFrame();
-  setCaption( "Cut Lines Definition" );
-  setSizeGripEnabled( true );
-  myIsCreation = theIsCreation;
-  
-  QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6);
+  setCaption("Cut Lines Definition");
+  setSizeGripEnabled(true);
+
+  QVBoxLayout* aMainLayout = new QVBoxLayout (this, 7, 6);
   aMainLayout->setSpacing(5);
-  
-  hasInit = false; 
-  
+
+  hasInit = false;
+
   // Tab pane
   QTabWidget* aTabPane = new QTabWidget(this);
 
   // Plane of lines
   QFrame* aPlanePane = new QFrame(this);
-  QVBoxLayout* aPlaneLayout = new QVBoxLayout( aPlanePane, 5, 6 ); 
-    
+  QVBoxLayout* aPlaneLayout = new QVBoxLayout(aPlanePane, 5, 6);
+
   mySelPlane = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aPlanePane);
   mySelPlane->setInsideSpacing( 5 );
   mySelPlane->setInsideMargin( 5 );
-    
-  QRadioButton* aBxy = new QRadioButton( tr( "|| X-Y" ), mySelPlane);  // 0
-  QRadioButton* aByz = new QRadioButton( tr( "|| Y-Z" ), mySelPlane);  // 1
-  QRadioButton* aBzx = new QRadioButton( tr( "|| Z-X" ), mySelPlane);  // 2
+
+  QRadioButton* aBxy = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane);  // 0
+  QRadioButton* aByz = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane);  // 1
+  QRadioButton* aBzx = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane);  // 2
+  aBxy->setChecked(false);
+  aByz->setChecked(false);
   aBzx->setChecked(true);
 
   aPlaneLayout->addWidget( mySelPlane );
-   
+
   QGroupBox* aRotBox = new QGroupBox( tr( "LBL_ROTATION" ), aPlanePane );
   aRotBox->setColumnLayout(2, Qt::Horizontal );
 
   myRotXLbl = new QLabel( tr( "LBL_ROT_X" ), aRotBox);
-  myRotXSpn = new QAD_SpinBoxDbl( aRotBox, -45, 45, 5 );
+  myRotXSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
   myRotXSpn->setValue( 0 );
   myRotYLbl = new QLabel( tr( "LBL_ROT_Y" ), aRotBox );
-  myRotYSpn = new QAD_SpinBoxDbl( aRotBox, -45, 45, 5 );
+  myRotYSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
   myRotYSpn->setValue( 0 );
 
   aPlaneLayout->addWidget( aRotBox );
-    
-  QHGroupBox* aBaseBox = new QHGroupBox( tr( "Base plane position" ), aPlanePane );
+
+  QHGroupBox* aBaseBox = new QHGroupBox (tr("BASE_PLANE_POS"), aPlanePane);
   myBasePlanePos = new QLineEdit (aBaseBox);
   mydvalidator = new QDoubleValidator(this);
   mydvalidator->setDecimals(32);
   myBasePlanePos->setValidator(mydvalidator);
 
-  myCBSetDef = new QCheckBox(tr("Set default"),aBaseBox);
-  
-  aPlaneLayout->addWidget( aBaseBox );
-  
-  QHBox* aPosBox = new QHBox(aPlanePane);
+  myCBSetDef = new QCheckBox (tr("SET_DEFAULT"),aBaseBox);
+
+  aPlaneLayout->addWidget(aBaseBox);
+
+  QHBox* aPosBox = new QHBox (aPlanePane);
   aPosBox->setSpacing(5);
-  QLabel* aPosLbl = new QLabel( tr( "LBL_POS" ), aPosBox );
-  myPosSpn = new QAD_SpinBoxDbl( aPosBox, 0, 1, 0.1 );
-  myPosSpn->setValue( 0.5 );  
-  aPlaneLayout->addWidget( aPosBox );
+  QLabel* aPosLbl = new QLabel (tr("LBL_POS"), aPosBox);
+  myPosSpn = new QtxDblSpinBox (0, 1, 0.1, aPosBox);
+  myPosSpn->setValue(0.5);
+  aPlaneLayout->addWidget(aPosBox);
 
-  myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), aPlanePane);
+  myPreviewCheck = new QCheckBox (tr("LBL_SHOW_PREVIEW"), aPlanePane);
   myPreviewCheck->setChecked(false);
-  aPlaneLayout->addWidget( myPreviewCheck );
+  aPlaneLayout->addWidget(myPreviewCheck);
+
+  myAllCurvesInvertedCheck = new QCheckBox(tr("LBL_INVERT_CURVES"), aPlanePane);
+  myAllCurvesInvertedCheck->setChecked(false);
+  aPlaneLayout->addWidget(myAllCurvesInvertedCheck);
 
-  myCreateTable = new QCheckBox(tr("LBL_GENERATE_TABLE"), aPlanePane);
+  myCreateTable = new QCheckBox (tr("LBL_GENERATE_TABLE"), aPlanePane);
   myCreateTable->setChecked(MYGenerateTable);
   aPlaneLayout->addWidget( myCreateTable );
 
@@ -124,39 +137,39 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg(bool theIsCreation)
 
 
   aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
-  
+
   // Number of lines
   QFrame* aLinesPane = new QFrame(this);
-  QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 ); 
-  
+  QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 );
+
   mySelPlane2 = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aLinesPane);
   mySelPlane2->setInsideSpacing( 5 );
   mySelPlane2->setInsideMargin( 5 );
-  QRadioButton* aBxy2 = new QRadioButton( tr( "|| X-Y" ), mySelPlane2);  // 0
-  QRadioButton* aByz2 = new QRadioButton( tr( "|| Y-Z" ), mySelPlane2);  // 1
-  QRadioButton* aBzx2 = new QRadioButton( tr( "|| Z-X" ), mySelPlane2);  // 2
+
+  QRadioButton* aBxy2 = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane2);  // 0
+  QRadioButton* aByz2 = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane2);  // 1
+  QRadioButton* aBzx2 = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane2);  // 2
   aBzx2->setEnabled(false);
   aByz2->setChecked(true);
   aLinesLayout->addWidget( mySelPlane2 );
 
   QGroupBox* aRotBox2 = new QGroupBox( tr( "LBL_ROTATION" ), aLinesPane );
   aRotBox2->setColumnLayout(2, Qt::Horizontal );
-  
+
   myRotXLbl2 = new QLabel( tr( "LBL_ROT_X" ), aRotBox2);
-  myRotXSpn2 = new QAD_SpinBoxDbl( aRotBox2, -45, 45, 5 );
+  myRotXSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
   myRotXSpn2->setValue( 0 );
   myRotYLbl2 = new QLabel( tr( "LBL_ROT_Y" ), aRotBox2 );
-  myRotYSpn2 = new QAD_SpinBoxDbl( aRotBox2, -45, 45, 5 );
+  myRotYSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
   myRotYSpn2->setValue( 0 );
   aLinesLayout->addWidget( aRotBox2 );
 
   QHBox* aNbBox = new QHBox(aLinesPane);
   aNbBox->setSpacing(5);
   QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
-  myNbSpn = new QAD_SpinBoxDbl( aNbBox, 1, 100, 1 );
-  myNbSpn->setValue( 10 );  
+  myNbSpn = new QtxDblSpinBox( 1, 100, 1, aNbBox );
+  myNbSpn->setValue( 10 );
+
   aLinesLayout->addWidget( aNbBox );
 
   myPosTable = new QTable(aLinesPane, "Positions of cut planes" );
@@ -164,7 +177,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg(bool theIsCreation)
   myPosTable->setMinimumWidth( 294 );
   myPosTable->setNumCols(2);
   myPosTable->setNumRows(0);
-  
+
   QHeader *th = myPosTable->horizontalHeader();
   th->setLabel( 0, "Position" );
   th->setLabel( 1, "Set default" );
@@ -174,11 +187,11 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg(bool theIsCreation)
   QHBox* aPosBox2 = new QHBox(aLinesPane);
   aPosBox2->setSpacing(5);
   QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 );
-  myPosSpn2 = new QAD_SpinBoxDbl( aPosBox2, 0, 1, 0.1 );
-  myPosSpn2->setValue( 0.5 );  
+  myPosSpn2 = new QtxDblSpinBox( 0, 1, 0.1, aPosBox2 );
+  myPosSpn2->setValue( 0.5 );
   aLinesLayout->addWidget( aPosBox2 );
   aLinesLayout->addStretch();
+
   aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
 
   myScalarPane = new VisuGUI_ScalarBarPane(this, false);
@@ -191,46 +204,49 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg(bool theIsCreation)
   QHBox* aBtnBox = new QHBox(this);
   aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
   aBtnBox->setLineWidth( 1 );
-  QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout(); 
+  QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout();
   aBtnLayout->setAutoAdd( false );
   aBtnLayout->setSpacing( 5 );
   aBtnLayout->setMargin( 11 );
 
-  QPushButton* aOkBtn = new QPushButton(tr( "VISU_BUT_OK" ),  aBtnBox);
+  QPushButton* aOkBtn = new QPushButton (tr("BUT_OK"), aBtnBox);
   aOkBtn->setAutoDefault( TRUE );
   aOkBtn->setDefault( true );
   aBtnLayout->addWidget(aOkBtn);
+
   aBtnLayout->addStretch();
-  
+
   QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
   aBtnLayout->addWidget(aCloseBtn);
-   
+
   aMainLayout->addWidget(aBtnBox);
 
   myCutLines = NULL;
-  
+
   // signals and slots connections
-  connect(mySelPlane, SIGNAL(clicked(int)), this, SLOT(onPlaneSelect(int)));
-  connect(myCBSetDef , SIGNAL( toggled(bool) ), this , SLOT( setBaseDefault() ) );
-  connect(myPosSpn , SIGNAL( valueChanged( double ) ), this , SLOT( setBaseDefault() ) );
-  connect(mySelPlane2, SIGNAL(clicked(int)), this, SLOT(onCutSelect(int)));
-  connect( myNbSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
-  connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
-  connect( myPosSpn2, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
-  connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
-  connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
-  connect( myRotXSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
-  connect( myRotYSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
-  connect( myRotXSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
-  connect( myRotYSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
-  connect( myBasePlanePos, SIGNAL( textChanged(const QString& )), this, SLOT( onPlanePos(const QString& ) ) );
-  connect( myCreateTable, SIGNAL( toggled(bool)), myCurvesCheck, SLOT( setEnabled(bool) ));
+  connect(mySelPlane    , SIGNAL(clicked(int))          , this, SLOT(onPlaneSelect(int)));
+  connect(myCBSetDef    , SIGNAL(toggled(bool))         , this, SLOT(setBaseDefault()));
+  connect(myPosSpn      , SIGNAL(valueChanged(double))  , this, SLOT(setBaseDefault()));
+  connect(mySelPlane2   , SIGNAL(clicked(int))          , this, SLOT(onCutSelect(int)));
+  connect(myNbSpn       , SIGNAL(valueChanged(double))  , this, SLOT(DrawTable()));
+  connect(th            , SIGNAL(clicked(int))          , this, SLOT(setDefault(int)));
+  connect(myPosSpn2     , SIGNAL(valueChanged(double))  , this, SLOT(DrawTable()));
+  connect(myPreviewCheck, SIGNAL(toggled(bool))         , this, SLOT(onPreviewCheck(bool)));
+  connect(myAllCurvesInvertedCheck, SIGNAL(toggled(bool)),this, SLOT(onAllCurvesInvertedCheck(bool)));
+  connect(myPosTable    , SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)));
+  connect(myRotXSpn     , SIGNAL(valueChanged(double))  , this, SLOT(onRotation(double)));
+  connect(myRotYSpn     , SIGNAL(valueChanged(double))  , this, SLOT(onRotation(double)));
+  connect(myRotXSpn2    , SIGNAL(valueChanged(double))  , this, SLOT(onRotation(double)));
+  connect(myRotYSpn2    , SIGNAL(valueChanged(double))  , this, SLOT(onRotation(double)));
+  connect(myBasePlanePos, SIGNAL(textChanged(const QString&)), this, SLOT(onPlanePos(const QString&)));
+  connect(myCreateTable , SIGNAL(toggled(bool)), myCurvesCheck, SLOT(setEnabled(bool)));
 
   connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
   connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
-  connect( myStudy, SIGNAL(closed()),  this, SLOT( reject() ) );
-  connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
+  //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
+  //connect(VisuGUI::application()->desktop(),
+  //        SIGNAL(windowActivated(SUIT_ViewWindow*)),
+  //        this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
 }
 
 /*!
@@ -238,14 +254,17 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg(bool theIsCreation)
 */
 VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
 {
+  cout<<"### VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg"<<endl;
   deletePlanes();
-  if(myCutLines) delete myCutLines; 
-  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
-    vf->Repaint();  
+  if (myCutLines) //delete myCutLines;
+    myCutLines->Destroy();
+  if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
+    vf->Repaint();
 }
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::initFromPrsObject(VISU::CutLines_i* thePrs) {
+void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs)
+{
   myPrs = thePrs;
   myScalarPane->initFromPrsObject(thePrs);
 
@@ -253,8 +272,8 @@ void VisuGUI_CutLinesDlg::initFromPrsObject(VISU::CutLines_i* thePrs) {
   myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
   myPosSpn->setValue(thePrs->GetDisplacement());
   setOrientation(thePrs->GetOrientationType());
-  
-  myNbSpn->setValue( thePrs->GetNbLines() );  
+
+  myNbSpn->setValue( (int)thePrs->GetNbLines() );
   myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI);
   myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI);
   myPosSpn2->setValue(thePrs->GetDisplacement2());
@@ -263,6 +282,8 @@ void VisuGUI_CutLinesDlg::initFromPrsObject(VISU::CutLines_i* thePrs) {
   hasInit = true;
   myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false);
   myCutLines->SameAs(thePrs);
+  myCutLines->CopyCurvesInverted(thePrs->GetCurvesInverted());
+  if (myCutLines->IsAllCurvesInverted()) myAllCurvesInvertedCheck->setChecked(true);
   myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
   myCBSetDef->setChecked(thePrs->IsDefault());
   DrawTable();
@@ -273,63 +294,83 @@ void VisuGUI_CutLinesDlg::initFromPrsObject(VISU::CutLines_i* thePrs) {
   }
 }
 
-
 //------------------------------------------------------------------------------
-int VisuGUI_CutLinesDlg::storeToPrsObject(VISU::CutLines_i* thePrs) {
-
+int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs)
+{
   myScalarPane->storeToPrsObject(thePrs);
 
-  thePrs->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
+  thePrs->SetOrientation(getOrientaion(),
+                         myRotXSpn->value()*PI/180.,
+                         myRotYSpn->value()*PI/180.);
   thePrs->SetDisplacement(myPosSpn->value());
   thePrs->SetNbLines((int)myNbSpn->value());
-  thePrs->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
+
+  thePrs->SetOrientation2(getOrientaion(false),
+                          myRotXSpn2->value()*PI/180.,
+                          myRotYSpn2->value()*PI/180.);
   thePrs->SetDisplacement2(myPosSpn2->value());
-  
+
   if (!myCBSetDef->isChecked())
     thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble());
   else thePrs->SetDefault();
-  
-  for (int i = 0; i < (int)myNbSpn->value(); ++i) 
-    {
-      if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
-       thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
-      else thePrs->SetDefaultPosition(i);
-    }
+
+  for (int i = 0; i < (int)myNbSpn->value(); ++i) {
+    if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
+      thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
+    else thePrs->SetDefaultPosition(i);
+  }
+  if (myAllCurvesInvertedCheck->isChecked())
+    thePrs->SetAllCurvesInverted(true);
   return 1;
 }
 
-
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::createPlanes() {
-  if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
+void VisuGUI_CutLinesDlg::createPlanes()
+{
+  SVTK_ViewWindow* aView = VISU::GetViewWindow();
+  if (aView == NULL) return;
   if (myCutLines == NULL) return;
   if (myPreviewActor != 0) return;
 
+  storeToPrsObject(myCutLines);
+  myCutLines->GetPL()->Update();
   vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
   vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
   aPlaneMapper->SetInput(aPolyData->GetOutput());
   aPlaneMapper->ScalarVisibilityOff();
-
+  
+  myPreviewActorGlyphs = myPreviewActorGlyphs = SALOME_Actor::New();
+  myPreviewActorGlyphs->PickableOff();
+  updateGlyphs(false);
+  
   myPreviewActor = SALOME_Actor::New();
   myPreviewActor->PickableOff();
   myPreviewActor->SetMapper(aPlaneMapper);
   aPlaneMapper->Delete();
-  GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
+  aView->AddActor(myPreviewActor);
+  aView->AddActor(myPreviewActorGlyphs);
+  aView->getRenderer()->Render();
+  aView->onFitAll();
 }
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::deletePlanes() {
+void VisuGUI_CutLinesDlg::deletePlanes()
+{
   if (myPreviewActor == 0) return;
-  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
-    vf->RemoveActor(myPreviewActor);
+  if (SVTK_ViewWindow* aView = VISU::GetViewWindow()){
+    aView->RemoveActor(myPreviewActor);
+    aView->RemoveActor(myPreviewActorGlyphs);
+  }
   myPreviewActor->Delete();
+  myPreviewActorGlyphs->Delete();
   myPreviewActor = 0;
+  myPreviewActorGlyphs = 0;
 }
 
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::onPlaneSelect(int theId) {
+void VisuGUI_CutLinesDlg::onPlaneSelect (int theId)
+{
   for (int i = 0; i < mySelPlane2->count(); i++)
     mySelPlane2->find(i)->setEnabled(true);
   QButton* aBtn = mySelPlane2->find(theId);
@@ -338,13 +379,13 @@ void VisuGUI_CutLinesDlg::onPlaneSelect(int theId) {
   case 0:
     myRotXLbl->setText( tr("LBL_ROT_X"));
     myRotYLbl->setText( tr("LBL_ROT_Y"));
-    ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);    
+    ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
     onCutSelect(1, false);
     break;
   case 1:
     myRotXLbl->setText( tr("LBL_ROT_Y"));
     myRotYLbl->setText( tr("LBL_ROT_Z"));
-    ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);    
+    ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
     onCutSelect(2, false);
     break;
   case 2:
@@ -358,7 +399,8 @@ void VisuGUI_CutLinesDlg::onPlaneSelect(int theId) {
 }
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::onCutSelect(int theId, bool theUpdate) {
+void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate)
+{
   switch (theId) {
   case 0:
     myRotXLbl2->setText( tr("LBL_ROT_X"));
@@ -372,41 +414,51 @@ void VisuGUI_CutLinesDlg::onCutSelect(int theId, bool theUpdate) {
     myRotXLbl2->setText( tr("LBL_ROT_Z"));
     myRotYLbl2->setText( tr("LBL_ROT_X"));
   }
-  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+  SVTK_ViewWindow* aView = VISU::GetViewWindow();
+  if (aView) {
     if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
-      myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
-      myCutLines->SetDisplacement2(myPosSpn2->value());
-      myCutLines->GetPL()->Update();
+      /*myCutLines->SetOrientation2(getOrientaion(false),
+                                  myRotXSpn2->value()*PI/180.,
+                                  myRotYSpn2->value()*PI/180.);
+                                 myCutLines->SetDisplacement2(myPosSpn2->value());*/
+      //myCutLines->GetPL()->Update();
       deletePlanes();
-      createPlanes();  
-      vf->Repaint();  
+      createPlanes();
+      //aView->Repaint();
     }
   }
 }
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::setBaseDefault(bool theUpdate) {
+void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate)
+{
   if (!hasInit) return;
-  
-  if ( myCBSetDef->isChecked() )
-    {
-      if (!myCutLines->IsDefault()) myCutLines->SetDefault();
-      myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
-      myCutLines->SetDisplacement(myPosSpn->value());
-      float aPos = myCutLines->GetBasePlanePosition();
-      myBasePlanePos->setText( QString::number(aPos) );
-      myBasePlanePos->setEnabled(false);
-      if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
-       if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
-         myCutLines->SetBasePlanePosition(aPos);
-         myCutLines->GetPL()->Update();
-         deletePlanes();
-         createPlanes();  
-         vf->Repaint();  
-       }
+
+  if (myCBSetDef->isChecked()) {
+    if (!myCutLines->IsDefault()) myCutLines->SetDefault();
+    /*myCutLines->SetOrientation(getOrientaion(),
+                               myRotXSpn->value()*PI/180.,
+                               myRotYSpn->value()*PI/180.);
+                              myCutLines->SetDisplacement(myPosSpn->value());*/
+    /*    float aPos = myCutLines->GetBasePlanePosition();
+    myBasePlanePos->setText( QString::number(aPos) );
+    myBasePlanePos->setEnabled(false);*/
+    SVTK_ViewWindow* aView = VISU::GetViewWindow();
+    if (aView) {
+      if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
+        //myCutLines->SetBasePlanePosition(aPos);
+       //        myCutLines->GetPL()->Update();
+        deletePlanes();
+        createPlanes();
+        //aView->Repaint();
       }
     }
-  else myBasePlanePos->setEnabled(true);   
+    float aPos = myCutLines->GetBasePlanePosition();
+    myBasePlanePos->setText( QString::number(aPos) );
+    myBasePlanePos->setEnabled(false);
+  } else {
+    myBasePlanePos->setEnabled(true);
+  }
 }
 
 //------------------------------------------------------------------------------
@@ -415,13 +467,17 @@ void VisuGUI_CutLinesDlg::DrawTable()
   if (!hasInit) return;
 
   int aNbRows = myPosTable->numRows();
-  int aNbPlanes = (int)myNbSpn->value();  
-     
-  myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
+  int aNbPlanes = (int)myNbSpn->value();
+
+  myCutLines->SetOrientation(getOrientaion(),
+                             myRotXSpn->value()*PI/180.,
+                             myRotYSpn->value()*PI/180.);
 
   myCutLines->SetNbLines(aNbPlanes);
   myCutLines->SetDisplacement2(myPosSpn2->value());
-  myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
+  myCutLines->SetOrientation2(getOrientaion(false),
+                              myRotXSpn2->value()*PI/180.,
+                              myRotYSpn2->value()*PI/180.);
 
   if (aNbRows>0)
     for (int i = 0; i < aNbRows; ++i) {
@@ -430,7 +486,7 @@ void VisuGUI_CutLinesDlg::DrawTable()
       if (!aItem->isChecked())
        myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble());
     }
-  
+
   if (aNbPlanes > aNbRows)
     myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
   else if (aNbPlanes < aNbRows)
@@ -445,9 +501,8 @@ void VisuGUI_CutLinesDlg::DrawTable()
   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(myCutLines->GetLinePosition(i)));
+    VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem
+      (myPosTable, QTableItem::OnTyping, QString::number(myCutLines->GetLinePosition(i)));
     aEditItem->setReplaceable(false);
     aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i));
     myPosTable->setItem(i, 0, aEditItem);
@@ -456,45 +511,118 @@ void VisuGUI_CutLinesDlg::DrawTable()
     aCheck->setChecked(myCutLines->IsDefaultPosition(i));
     aCheck->setReplaceable(false);
     myPosTable->setItem(i, 1, aCheck);
-    
+
     vh->setLabel( i, str.arg(i+1) );
   }
   // Update preview
-  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+  SVTK_ViewWindow* aView = VISU::GetViewWindow();
+  if (aView) {
     if (myPreviewCheck->isChecked()) {
-      myCutLines->GetPL()->Update();
+      //      myCutLines->GetPL()->Update();
       deletePlanes();
       createPlanes();
-      vf->Repaint();
+      //aView->Repaint();
     }
   }
 }
 
+void VisuGUI_CutLinesDlg::updateGlyphs(bool update){
+  if (myPreviewActorGlyphs == 0 ) return;
+  const float *aDirLn = myCutLines->GetCutLinesPL()->GetDirLn();
+  const float *aBasePnt = myCutLines->GetCutLinesPL()->GetBasePnt();
+  float aSecondPnt[3];
+  float aBoundCenter[3];
+
+  vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
+  vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
+  aPlaneMapper->SetInput(aPolyData->GetOutput());
+  float bounds[6];
+  aPlaneMapper->GetBounds(bounds);
+
+  for(int i=0; i<3; i++) aBoundCenter[i] = (bounds[i*2] + bounds[i*2+1])/2.0;
+  for(int i=0; i<3; i++){ 
+    if (myAllCurvesInvertedCheck->isChecked())
+      aSecondPnt[i] = aBasePnt[i] + aDirLn[i];
+    else
+      aSecondPnt[i] = -aBasePnt[i] - aDirLn[i];
+  }
+  
+  float max_bound = 0;
+  max_bound < bounds[1]-bounds[0] ? max_bound = bounds[1] - bounds[0] : max_bound = max_bound;
+  max_bound < bounds[3]-bounds[2] ? max_bound = bounds[3] - bounds[2] : max_bound = max_bound;
+  max_bound < bounds[5]-bounds[4] ? max_bound = bounds[5] - bounds[4] : max_bound = max_bound;
+
+  vtkPolyData* profile = vtkPolyData::New();
+  vtkPoints* aPoints = vtkPoints::New();
+  vtkGlyph3D* glyphs = vtkGlyph3D::New();
+  vtkFloatArray *aFloatArray = vtkFloatArray::New();
+  vtkGlyphSource2D* source = vtkGlyphSource2D::New();
+  
+  source->FilledOn();
+  source->SetCenter(aBoundCenter);
+  source->SetGlyphTypeToArrow();
+  
+  aPoints->InsertNextPoint(aBasePnt);
+  profile->SetPoints(aPoints);
+  
+  aFloatArray->SetNumberOfComponents(3);
+  for(int i=0; i<3 ;i++)
+      aFloatArray->InsertNextValue(aSecondPnt[i]);
+  
+  vtkDataSetAttributes* aDataSetAttributes;
+  aDataSetAttributes = profile->GetPointData();
+  aDataSetAttributes->SetVectors(aFloatArray);
+  
+  glyphs->SetScaleFactor(0.25*max_bound);
+  glyphs->SetVectorModeToUseVector();
+  glyphs->SetScaleModeToScaleByVector();
+  glyphs->SetInput(profile);
+  glyphs->SetSource(source->GetOutput());
+
+  vtkPolyDataMapper* aGlyphsMapper = vtkPolyDataMapper::New();
+  aGlyphsMapper->ScalarVisibilityOff();
+  aGlyphsMapper->SetInput(glyphs->GetOutput());
+  
+  myPreviewActorGlyphs->SetMapper(aGlyphsMapper);
+
+  profile->Delete();
+  glyphs->Delete();
+  aPoints->Delete();
+  aGlyphsMapper->Delete();
+  aFloatArray->Delete();
+  source->Delete();
+  aPlaneMapper->Delete();
+
+  if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
+    if (update)
+      vf->Repaint();
+}
+
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::setDefault(int all)
+void VisuGUI_CutLinesDlg::setDefault (int all)
 {
   myPosTable->setCurrentCell(-1, 1);
   myPosTable->clearSelection();
   if (all == 0) return;
   if (all == 1)
-    for (int i = 0; i < (int)myNbSpn->value(); ++i) 
+    for (int i = 0; i < (int)myNbSpn->value(); ++i)
       ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
-       
+
   for (int i = 0; i < (int)myNbSpn->value(); ++i) {
     if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
       myCutLines->SetDefaultPosition(i);
       myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i)));
       myPosTable->item( i, 0 )->setEnabled(false);
-    } else 
-      myPosTable->item( i, 0 )->setEnabled(true); 
+    } else
+      myPosTable->item( i, 0 )->setEnabled(true);
   }
 }
 
 //------------------------------------------------------------------------------
-VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion(bool IsBasePlane)
+VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion (bool IsBasePlane)
 {
   QHButtonGroup* aBG;
-  
+
   if (IsBasePlane)
     aBG = mySelPlane;
   else
@@ -515,7 +643,7 @@ VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion(bool IsBasePlane
 }
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::setOrientation( const VISU::CutPlanes::Orientation  orient)
+void VisuGUI_CutLinesDlg::setOrientation (const VISU::CutPlanes::Orientation orient)
 {
   switch (orient) {
   case VISU::CutPlanes::XY:
@@ -526,14 +654,14 @@ void VisuGUI_CutLinesDlg::setOrientation( const VISU::CutPlanes::Orientation  or
     ((QRadioButton*)mySelPlane->find(1))->setChecked(true);
     onPlaneSelect(1);
     break;
-  case VISU::CutPlanes::ZX:      
+  case VISU::CutPlanes::ZX:
     ((QRadioButton*)mySelPlane->find(2))->setChecked(true);
     onPlaneSelect(2);
   }
 }
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::setOrientation2( const VISU::CutPlanes::Orientation  orient )
+void VisuGUI_CutLinesDlg::setOrientation2 (const VISU::CutPlanes::Orientation orient)
 {
   switch (orient) {
   case VISU::CutPlanes::XY:
@@ -544,69 +672,74 @@ void VisuGUI_CutLinesDlg::setOrientation2( const VISU::CutPlanes::Orientation  o
     ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
     onCutSelect(1);
     break;
-  case VISU::CutPlanes::ZX:      
+  case VISU::CutPlanes::ZX:
     ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
     onCutSelect(2);
   }
 }
 
-
-void VisuGUI_CutLinesDlg::onValueChanged(int theRow, int theCol) {
+void VisuGUI_CutLinesDlg::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 (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+    SVTK_ViewWindow* aView = VISU::GetViewWindow();
+    if (aView) {
       if (myPreviewCheck->isChecked()) {
        //Update Preview
-       myCutLines->SetLinePosition( theRow, aTxt.toDouble());
-       myCutLines->GetPL()->Update();
+       //myCutLines->SetLinePosition( theRow, aTxt.toDouble());
+       //      myCutLines->GetPL()->Update();
        deletePlanes();
        createPlanes();
-       vf->Repaint();
+       //aView->Repaint();
       }
     }
-  } else {
+  } else if (theCol == 1){
     bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
     if (isDefault) {
-      myCutLines->SetDefaultPosition(theRow);
-      myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
-
-      if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+      //myCutLines->SetDefaultPosition(theRow);
+      // myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
+      SVTK_ViewWindow* aView = VISU::GetViewWindow();
+      if (aView) {
        if (myPreviewCheck->isChecked()) {
          //Update Preview
-         myCutLines->GetPL()->Update();
+         //      myCutLines->GetPL()->Update();
          deletePlanes();
          createPlanes();
-         vf->Repaint();
+         //aView->Repaint();
        }
       }
+      myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
     }
     myPosTable->item(theRow, 0)->setEnabled(!isDefault);
   }
 }
 
-
-void VisuGUI_CutLinesDlg::accept() {
+void VisuGUI_CutLinesDlg::accept()
+{
+  //if ( !VisuGUI::CheckActiveStudyLock() ) {
+  //  reject();
+  //  return;
+  //}
   MYGenerateTable = myCreateTable->isChecked();
   MYGenerateCurve = myCurvesCheck->isChecked();
-  if (myScalarPane->check()) {
-    ((QWidget*)sender())->setDisabled(true);
+  //  if (myScalarPane->check()) {
+    /*jfa tmp:((QWidget*)sender())->setDisabled(true);
     storeToPrsObject(myPrs);
     if (myIsCreation) {
       if (isGenerateTable()) {
        visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
        if (isGenerateCurves()) {
-         SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
-         SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
-         if(!aSObject->_is_nil()) {
-           SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
-           SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+         SALOMEDSClient_Study* aStudy = study()->studyDS();
+         SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+         if( aSObject ) {
+           SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
+           SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
            for ( ;aIter->More(); aIter->Next()) {
-             SALOMEDS::SObject_var aTblObj = aIter->Value();
-             if (!aTblObj->_is_nil()) {
-               SALOMEDS::GenericAttribute_var anAttr;
+             SALOMEDSClient_SObject* aTblObj = aIter->Value();
+             if ( aTblObj ) {
+               SALOMEDSClient_GenericAttribute* anAttr;
                if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
                  visuGUI->CreatePlot(aTblObj);
                }
@@ -615,34 +748,33 @@ void VisuGUI_CutLinesDlg::accept() {
          }
        }
       }
-      if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+      if (GET_VTK_VIEWWINDOW(myMgr)) {
        try {
          visuGUI->CreateActor(myPrs);
-       }
-       catch (...) {
+       } catch (...) {
          reject();
          return;
        }
-       GET_VTK_VIEWFRAME(myStudy)->onViewFitAll(); 
+       GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
       }
     } else {
-      visuGUI->RecreateActor(myPrs); 
-      if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) { 
-       if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) { 
-         vf->getRenderer()->ResetCameraClippingRange(); 
-         vf->Repaint(); 
+      visuGUI->RecreateActor(myPrs);
+      if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
+       if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
+         vf->getRenderer()->ResetCameraClippingRange();
+         vf->Repaint();
        }
       }
       // Remove old Table
-      SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
-      SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
-      if(!aSObject->_is_nil()) {
-       SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
-       SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+      SALOMEDSClient_Study* aStudy = study()->studyDS();
+      SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+      if( aSObject ) {
+       SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
+       SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
        for ( ;aIter->More(); aIter->Next()) {
-         SALOMEDS::SObject_var aTblObj = aIter->Value();
-         if (!aTblObj->_is_nil()) {
-           SALOMEDS::GenericAttribute_var anAttr;
+         SALOMEDSClient_SObject* aTblObj = aIter->Value();
+         if ( aTblObj ) {
+           SALOMEDSClient_GenericAttribute* anAttr;
            if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
              aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
              break;
@@ -650,15 +782,15 @@ void VisuGUI_CutLinesDlg::accept() {
          }
        }
        if (isGenerateTable()) {
-         visuGUI->GetVisuGen()->CreateTable(aSObject->GetID());
+         visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str());
          if (isGenerateCurves()) {
-           SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
-           SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
-           SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+           SALOMEDSClient_Study* aStudy = study()->studyDS();
+           SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
+           SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
            for ( ;aIter->More(); aIter->Next()) {
-             SALOMEDS::SObject_var aTblObj = aIter->Value();
-             if (!aTblObj->_is_nil()) {
-               SALOMEDS::GenericAttribute_var anAttr;
+             SALOMEDSClient_SObject* aTblObj = aIter->Value();
+             if ( aTblObj ) {
+               SALOMEDSClient_GenericAttribute* anAttr;
                if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
                  visuGUI->CreatePlot(aTblObj);
                }
@@ -668,26 +800,30 @@ void VisuGUI_CutLinesDlg::accept() {
        }
       }
     }
-    myStudy->updateObjBrowser();  
+    VisuGUI::application()->objectBrowser()->updateTree();*/
+    deletePlanes();
     QDialog::accept();
-  }
+    //  }
 }
 
-void VisuGUI_CutLinesDlg::reject() {
-  if (myIsCreation) {
-    visuGUI->DeletePresentation(myPrs); 
-    myStudy->updateObjBrowser();
-  }
+void VisuGUI_CutLinesDlg::reject()
+{
+  /*jfa tmp:if (myIsCreation) {
+    myPrs->RemoveFromStudy();
+    VisuGUI::application()->objectBrowser()->updateTree();
+  }*/
+  deletePlanes();
   QDialog::reject();
 }
 
-void VisuGUI_CutLinesDlg::onPreviewCheck(bool thePreview) {
-  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
+{
+  if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
     if (thePreview) {
-      storeToPrsObject(myCutLines);
-      myCutLines->GetPL()->Update();
+      //storeToPrsObject(myCutLines);
+      //      myCutLines->GetPL()->Update();
       createPlanes();
-      vf->onViewFitAll();
+      //vf->onFitAll();
     } else {
       deletePlanes();
       vf->Repaint();
@@ -695,37 +831,52 @@ void VisuGUI_CutLinesDlg::onPreviewCheck(bool thePreview) {
   }
 }
 
-void VisuGUI_CutLinesDlg::onRotation(double theValue) {
+/*! Inverting all curves in the table
+ */
+void VisuGUI_CutLinesDlg::onAllCurvesInvertedCheck(bool theInvert)
+{
+  myCutLines->SetAllCurvesInverted(theInvert);
+  updateGlyphs(true);
+}
+
+void VisuGUI_CutLinesDlg::onRotation (double theValue)
+{
   if (myCutLines == NULL) return;
-  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+  SVTK_ViewWindow* aView = VISU::GetViewWindow();
+  if (aView) {
     if (myPreviewCheck->isChecked()) {
-      myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
-      myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
-      myCutLines->GetPL()->Update();
+
+      /*myCutLines->SetOrientation(getOrientaion(),
+                                 myRotXSpn->value()*PI/180.,
+                                 myRotYSpn->value()*PI/180.);
+      myCutLines->SetOrientation2(getOrientaion(false),
+                                  myRotXSpn2->value()*PI/180.,
+                                  myRotYSpn2->value()*PI/180.);*/
+      //      myCutLines->GetPL()->Update();
       deletePlanes();
-      createPlanes();  
-      vf->Repaint();  
+      createPlanes();
+      //aView->Repaint();
     }
   }
 }
 
-void VisuGUI_CutLinesDlg::onPlanePos(const QString& theValue) {
+void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
+{
   if (myCutLines == NULL) return;
-  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+  SVTK_ViewWindow* aView = VISU::GetViewWindow();
+  if (aView) {
     if (myPreviewCheck->isChecked()) {
-      myCutLines->SetBasePlanePosition(theValue.toDouble());
-      myCutLines->GetPL()->Update();
+      //myCutLines->SetBasePlanePosition(theValue.toDouble());
+      //      myCutLines->GetPL()->Update();
       deletePlanes();
-      createPlanes();  
-      vf->Repaint();  
+      createPlanes();
+      //aView->Repaint();
     }
   }
 }
 
-void VisuGUI_CutLinesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
-  if (theFrame != myStudyFrame) 
-    reject();
-}
-
-
-
+//jfa tmp:void VisuGUI_CutLinesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
+//jfa tmp:{
+//jfa tmp:  if (theWnd != myStudyWnd)
+//jfa tmp:    reject();
+//jfa tmp:}