Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/gui.git] / src / SVTK / SVTK_ViewWindow.cxx
index 69e5eae4a358d6cc5180222f903ed9c5b23e6a0e..af284a64bb3ac86d085c46370f31aea03adf7c58 100755 (executable)
@@ -28,6 +28,7 @@
 #include <vtkCamera.h>
 #include <vtkPointPicker.h>
 #include <vtkCellPicker.h>
+#include <vtkAxisActor2D.h>
 
 #include "QtxAction.h"
 
 #include "SVTK_InteractorStyle.h"
 #include "SVTK_RenderWindowInteractor.h"
 #include "SVTK_GenericRenderWindowInteractor.h"
+#include "SVTK_CubeAxesActor2D.h"
 
 #include "SALOME_ListIteratorOfListIO.hxx"
 
 #include "VTKViewer_Algorithm.h"
 #include "SVTK_Functor.h"
 
-//----------------------------------------------------------------------------
+/*!
+  Constructor
+*/
 SVTK_ViewWindow
 ::SVTK_ViewWindow(SUIT_Desktop* theDesktop):
   SUIT_ViewWindow(theDesktop),
@@ -67,6 +71,9 @@ SVTK_ViewWindow
   myView(NULL)
 {}
 
+/*!
+  To initialize #SVTK_ViewWindow instance
+*/
 void
 SVTK_ViewWindow
 ::Initialize(SVTK_ViewModelBase* theModel)
@@ -106,6 +113,9 @@ SVTK_ViewWindow
   }
 }
 
+/*!
+  To initialize #SVTK_ViewWindow instance
+*/
 void
 SVTK_ViewWindow
 ::Initialize(SVTK_View* theView,
@@ -129,12 +139,17 @@ SVTK_ViewWindow
          theModel,SLOT(onSelectionChanged()));
 }
 
+/*!
+  Destructor
+*/
 SVTK_ViewWindow
 ::~SVTK_ViewWindow()
 {}
 
 
-//----------------------------------------------------------------------------
+/*!
+  \return corresponding view
+*/
 SVTK_View* 
 SVTK_ViewWindow
 ::getView() 
@@ -142,6 +157,9 @@ SVTK_ViewWindow
   return myView; 
 }
 
+/*!
+  \return corresponding vtk main window
+*/
 SVTK_MainWindow* 
 SVTK_ViewWindow
 ::getMainWindow() 
@@ -149,6 +167,9 @@ SVTK_ViewWindow
   return myMainWindow; 
 }
 
+/*!
+  \return corresponding vtk render window
+*/
 vtkRenderWindow*
 SVTK_ViewWindow
 ::getRenderWindow()
@@ -156,6 +177,9 @@ SVTK_ViewWindow
   return getMainWindow()->getRenderWindow();
 }
 
+/*!
+  \return corresponding vtk render window interactor
+*/
 vtkRenderWindowInteractor*
 SVTK_ViewWindow
 ::getInteractor()
@@ -163,6 +187,9 @@ SVTK_ViewWindow
   return getMainWindow()->getInteractor();
 }
 
+/*!
+  \return corresponding vtk renderer
+*/
 vtkRenderer*
 SVTK_ViewWindow
 ::getRenderer()
@@ -170,6 +197,9 @@ SVTK_ViewWindow
   return myMainWindow->getRenderer();
 }
 
+/*!
+  \return corresponding vtk selector
+*/
 SVTK_Selector* 
 SVTK_ViewWindow
 ::GetSelector() 
@@ -177,8 +207,9 @@ SVTK_ViewWindow
   return myMainWindow->GetSelector(); 
 }
 
-
-//----------------------------------------------------------------------------
+/*!
+  Processes transformation "front view"
+*/
 void
 SVTK_ViewWindow
 ::onFrontView()
@@ -186,7 +217,9 @@ SVTK_ViewWindow
   myMainWindow->onFrontView();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Processes transformation "back view"
+*/
 void
 SVTK_ViewWindow
 ::onBackView()
@@ -194,7 +227,9 @@ SVTK_ViewWindow
   myMainWindow->onBackView();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Processes transformation "top view"
+*/
 void
 SVTK_ViewWindow
 ::onTopView()
@@ -202,7 +237,9 @@ SVTK_ViewWindow
   myMainWindow->onTopView();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Processes transformation "bottom view"
+*/
 void
 SVTK_ViewWindow
 ::onBottomView()
@@ -210,7 +247,9 @@ SVTK_ViewWindow
   myMainWindow->onBottomView();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Processes transformation "left view"
+*/
 void
 SVTK_ViewWindow
 ::onLeftView()
@@ -218,7 +257,9 @@ SVTK_ViewWindow
   myMainWindow->onLeftView();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Processes transformation "right view"
+*/
 void
 SVTK_ViewWindow
 ::onRightView()
@@ -226,7 +267,9 @@ SVTK_ViewWindow
   myMainWindow->onRightView();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Processes transformation "reset view": sets default orientation of viewport camera
+*/
 void
 SVTK_ViewWindow
 ::onResetView()
@@ -234,7 +277,9 @@ SVTK_ViewWindow
   myMainWindow->onResetView();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Processes transformation "fit all"
+*/
 void
 SVTK_ViewWindow
 ::onFitAll()
@@ -242,7 +287,9 @@ SVTK_ViewWindow
   myMainWindow->onFitAll();
 }
 
-//----------------------------------------------------------------
+/*!
+  SLOT: called if selection is changed
+*/
 void
 SVTK_ViewWindow
 ::onSelectionChanged()
@@ -250,7 +297,10 @@ SVTK_ViewWindow
   myView->onSelectionChanged();
 }
 
-//----------------------------------------------------------------
+/*!
+  Change selection mode
+  \param theMode - new selection mode
+*/
 void
 SVTK_ViewWindow
 ::SetSelectionMode(Selection_Mode theMode)
@@ -258,7 +308,9 @@ SVTK_ViewWindow
   myMainWindow->SetSelectionMode( theMode );
 }
 
-//----------------------------------------------------------------
+/*!
+  \return selection mode
+*/
 Selection_Mode
 SVTK_ViewWindow
 ::SelectionMode() const
@@ -266,7 +318,9 @@ SVTK_ViewWindow
   return myMainWindow->SelectionMode();
 }
 
-//----------------------------------------------------------------
+/*!
+  Unhilights all objects in viewer
+*/
 void 
 SVTK_ViewWindow
 ::unHighlightAll() 
@@ -274,7 +328,12 @@ SVTK_ViewWindow
   myView->unHighlightAll();
 }
 
-//----------------------------------------------------------------
+/*!
+  Hilights/unhilights object in viewer
+  \param theIO - object to be updated
+  \param theIsHighlight - if it is true, object will be hilighted, otherwise it will be unhilighted
+  \param theIsUpdate - update current viewer
+*/
 void
 SVTK_ViewWindow
 ::highlight(const Handle(SALOME_InteractiveObject)& theIO, 
@@ -284,7 +343,10 @@ SVTK_ViewWindow
   myView->highlight( theIO, theIsHighlight, theIsUpdate );
 }
 
-//----------------------------------------------------------------
+/*!
+  \return true if object is in viewer or in collector
+  \param theIO - object to be checked
+*/
 bool
 SVTK_ViewWindow
 ::isInViewer( const Handle(SALOME_InteractiveObject)& theIO ) 
@@ -292,7 +354,10 @@ SVTK_ViewWindow
   return myView->isInViewer( theIO );
 }
 
-//----------------------------------------------------------------
+/*!
+  \return true if object is displayed in viewer
+  \param theIO - object to be checked
+*/
 bool
 SVTK_ViewWindow
 ::isVisible( const Handle(SALOME_InteractiveObject)& theIO ) 
@@ -300,7 +365,22 @@ SVTK_ViewWindow
   return myView->isVisible( theIO );
 }
 
-//----------------------------------------------------------------
+/*!
+  Display object
+  \param theEntry - entry that corresponds to intractive objects
+*/
+Handle(SALOME_InteractiveObject)
+SVTK_ViewWindow
+::FindIObject(const char* theEntry) 
+{
+  return myView->FindIObject(theEntry);
+}
+
+/*!
+  Display object
+  \param theIO - object
+  \param theImmediatly - update viewer
+*/
 void
 SVTK_ViewWindow
 ::Display(const Handle(SALOME_InteractiveObject)& theIO,
@@ -309,6 +389,11 @@ SVTK_ViewWindow
   myView->Display(theIO,theImmediatly);
 }
 
+/*!
+  Erase object
+  \param theIO - object
+  \param theImmediatly - update viewer
+*/
 void
 SVTK_ViewWindow
 ::Erase(const Handle(SALOME_InteractiveObject)& theIO,
@@ -317,6 +402,10 @@ SVTK_ViewWindow
   myView->Erase(theIO,theImmediatly);
 }
 
+/*!
+  Display only passed object
+  \param theIO - object
+*/
 void
 SVTK_ViewWindow
 ::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIO) 
@@ -324,6 +413,9 @@ SVTK_ViewWindow
   myView->DisplayOnly(theIO);
 }
 
+/*!
+  Display all objects in view
+*/
 void 
 SVTK_ViewWindow
 ::DisplayAll() 
@@ -331,6 +423,9 @@ SVTK_ViewWindow
   myView->DisplayAll();
 }
 
+/*!
+  Erase all objects in view
+*/
 void 
 SVTK_ViewWindow
 ::EraseAll() 
@@ -338,7 +433,10 @@ SVTK_ViewWindow
   myView->EraseAll();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Sets background color
+  \param color - new background color
+*/
 void
 SVTK_ViewWindow
 ::setBackgroundColor( const QColor& color )
@@ -346,7 +444,9 @@ SVTK_ViewWindow
   myMainWindow->SetBackgroundColor( color );
 }
 
-//----------------------------------------------------------------------------
+/*!
+  \return background color of viewer
+*/
 QColor
 SVTK_ViewWindow
 ::backgroundColor() const
@@ -354,7 +454,9 @@ SVTK_ViewWindow
   return myMainWindow->BackgroundColor();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Updates current viewer
+*/
 void
 SVTK_ViewWindow
 ::Repaint(bool theUpdateTrihedron)
@@ -362,7 +464,9 @@ SVTK_ViewWindow
   myMainWindow->Repaint( theUpdateTrihedron );
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Redirect the request to #SVTK_Renderer::GetScale
+*/
 void
 SVTK_ViewWindow
 ::GetScale( double theScale[3] ) 
@@ -370,7 +474,9 @@ SVTK_ViewWindow
   myMainWindow->GetScale( theScale );
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Redirect the request to #SVTK_Renderer::SetScale
+*/
 void
 SVTK_ViewWindow
 ::SetScale( double theScale[3] ) 
@@ -378,7 +484,9 @@ SVTK_ViewWindow
   myMainWindow->SetScale( theScale );
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Redirect the request to #SVTK_Renderer::IsTrihedronDisplayed
+*/
 bool
 SVTK_ViewWindow
 ::isTrihedronDisplayed()
@@ -386,6 +494,9 @@ SVTK_ViewWindow
   return myMainWindow->IsTrihedronDisplayed();
 }
 
+/*!
+  Redirect the request to #SVTK_Renderer::IsCubeAxesDisplayed
+*/
 bool
 SVTK_ViewWindow
 ::isCubeAxesDisplayed()
@@ -393,7 +504,9 @@ SVTK_ViewWindow
   return myMainWindow->IsCubeAxesDisplayed();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Redirect the request to #SVTK_Renderer::OnViewTrihedron
+*/
 void 
 SVTK_ViewWindow
 ::onViewTrihedron()
@@ -401,6 +514,9 @@ SVTK_ViewWindow
   myMainWindow->onViewTrihedron();
 }
 
+/*!
+  Redirect the request to #SVTK_Renderer::OnViewCubeAxes
+*/
 void
 SVTK_ViewWindow
 ::onViewCubeAxes()
@@ -408,7 +524,9 @@ SVTK_ViewWindow
   myMainWindow->onViewCubeAxes();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Redirect the request to #SVTK_Renderer::GetTrihedron
+*/
 VTKViewer_Trihedron* 
 SVTK_ViewWindow::
 GetTrihedron()
@@ -416,6 +534,9 @@ GetTrihedron()
   return myMainWindow->GetTrihedron();
 }
 
+/*!
+  Redirect the request to #SVTK_Renderer::GetCubeAxes
+*/
 SVTK_CubeAxesActor2D* 
 SVTK_ViewWindow
 ::GetCubeAxes()
@@ -423,6 +544,9 @@ SVTK_ViewWindow
   return myMainWindow->GetCubeAxes();
 }
 
+/*!
+  \return trihedron size
+*/
 int
 SVTK_ViewWindow
 ::GetTrihedronSize() const
@@ -430,6 +554,11 @@ SVTK_ViewWindow
   return myMainWindow->GetTrihedronSize();
 }
 
+/*!
+  Sets trihedron size
+  \param theSize - new trihedron size
+  \param theRelative - trihedron relativeness
+*/
 void
 SVTK_ViewWindow
 ::SetTrihedronSize(const int theSize, const bool theRelative)
@@ -447,7 +576,9 @@ SVTK_ViewWindow
   myMainWindow->AdjustActors();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Redirect the request to #SVTK_Renderer::OnAdjustTrihedron
+*/
 void
 SVTK_ViewWindow
 ::onAdjustTrihedron()
@@ -455,6 +586,9 @@ SVTK_ViewWindow
   myMainWindow->onAdjustTrihedron();
 }
 
+/*!
+  Redirect the request to #SVTK_Renderer::OnAdjustCubeAxes
+*/
 void
 SVTK_ViewWindow
 ::onAdjustCubeAxes()
@@ -462,7 +596,9 @@ SVTK_ViewWindow
   myMainWindow->onAdjustCubeAxes();
 }
 
-//=======================================================================
+/*!
+  Emits key pressed
+*/
 void
 SVTK_ViewWindow
 ::onKeyPressed(QKeyEvent* event)
@@ -470,7 +606,9 @@ SVTK_ViewWindow
   emit keyPressed( this, event );
 }
 
-//=======================================================================
+/*!
+  Emits key released
+*/
 void
 SVTK_ViewWindow
 ::onKeyReleased(QKeyEvent* event)
@@ -478,7 +616,9 @@ SVTK_ViewWindow
   emit keyReleased( this, event );
 }
 
-//=======================================================================
+/*!
+  Emits mouse pressed
+*/
 void
 SVTK_ViewWindow
 ::onMousePressed(QMouseEvent* event)
@@ -486,7 +626,9 @@ SVTK_ViewWindow
   emit mousePressed(this, event);
 }
 
-//=======================================================================
+/*!
+  Emits mouse released
+*/
 void
 SVTK_ViewWindow
 ::onMouseReleased(QMouseEvent* event)
@@ -494,7 +636,9 @@ SVTK_ViewWindow
   emit mouseReleased( this, event );
 }
 
-//=======================================================================
+/*!
+  Emits mouse moving
+*/
 void
 SVTK_ViewWindow
 ::onMouseMoving(QMouseEvent* event)
@@ -502,7 +646,9 @@ SVTK_ViewWindow
   emit mouseMoving( this, event );
 }
 
-//=======================================================================
+/*!
+  Emits mouse double clicked
+*/
 void
 SVTK_ViewWindow
 ::onMouseDoubleClicked( QMouseEvent* event )
@@ -510,7 +656,9 @@ SVTK_ViewWindow
   emit mouseDoubleClicked( this, event );
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Redirect the request to #SVTK_Renderer::AddActor
+*/
 void
 SVTK_ViewWindow
 ::AddActor( VTKViewer_Actor* theActor, 
@@ -519,7 +667,9 @@ SVTK_ViewWindow
   myMainWindow->AddActor( theActor, theUpdate );
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Redirect the request to #SVTK_Renderer::RemoveActor
+*/
 void
 SVTK_ViewWindow
 ::RemoveActor( VTKViewer_Actor* theActor, 
@@ -528,7 +678,9 @@ SVTK_ViewWindow
   myMainWindow->RemoveActor( theActor, theUpdate );
 }
 
-//----------------------------------------------------------------------------
+/*!
+  \return QImage, containing all scene rendering in window
+*/
 QImage
 SVTK_ViewWindow
 ::dumpView()
@@ -536,7 +688,9 @@ SVTK_ViewWindow
   return myMainWindow->dumpView();
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Redirect the request to #SVTK_Renderer::SetSelectionProp
+*/
 void
 SVTK_ViewWindow
 ::SetSelectionProp(const double& theRed, 
@@ -547,7 +701,9 @@ SVTK_ViewWindow
   myView->SetSelectionProp(theRed,theGreen,theBlue,theWidth);
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Redirect the request to #SVTK_Renderer::SetSelectionProp
+*/
 void
 SVTK_ViewWindow
 ::SetPreselectionProp(const double& theRed, 
@@ -558,7 +714,9 @@ SVTK_ViewWindow
   myView->SetPreselectionProp(theRed,theGreen,theBlue,theWidth);
 }
 
-//----------------------------------------------------------------------------
+/*!
+  Redirect the request to #SVTK_Renderer::SetSelectionTolerance
+*/
 void
 SVTK_ViewWindow
 ::SetSelectionTolerance(const double& theTolNodes, 
@@ -567,7 +725,6 @@ SVTK_ViewWindow
   myView->SetSelectionTolerance(theTolNodes,theTolItems);
 }
 
-//----------------------------------------------------------------------------
 int convertAction( const int accelAction )
 {
   switch ( accelAction ) {
@@ -585,17 +742,155 @@ int convertAction( const int accelAction )
   return accelAction;
 }
 
-//----------------------------------------------------------------------------
-void 
+/*!
+  Performs action
+  \param accelAction - action
+*/
+bool 
 SVTK_ViewWindow
 ::action( const int accelAction  )
 {
+  if ( !myMainWindow->hasFocus() )
+    return false;
   if ( accelAction == SUIT_Accel::ZoomFit )
     onFitAll();
   else {
     int anEvent = convertAction( accelAction );
     myMainWindow->InvokeEvent( anEvent, 0 );
   }
+  return true;
+}
+
+// old visual parameters had 13 values.  New format added additional 
+// 76 values for graduated axes, so both numbers are processed.
+const int nNormalParams = 13;   // number of view windows parameters excluding graduated axes params
+const int nGradAxisParams = 25; // number of parameters of ONE graduated axis (X, Y, or Z)
+const int nAllParams = nNormalParams + 3*nGradAxisParams + 1; // number of all visual parameters
+
+/*! The method returns visual parameters of a graduated axis actor (x,y,z axis of graduated axes)
+ */
+QString getGradAxisVisualParams( vtkAxisActor2D* actor )
+{
+  QString params;
+  if ( !actor )
+    return params;
+
+  // Name
+  bool isVisible = actor->GetTitleVisibility();
+  QString title ( actor->GetTitle() );
+  vtkFloatingPointType color[ 3 ];
+  int font = VTK_ARIAL;
+  int bold = 0;
+  int italic = 0;
+  int shadow = 0;
+
+  vtkTextProperty* txtProp = actor->GetTitleTextProperty();
+  if ( txtProp )
+  {
+    txtProp->GetColor( color );
+    font = txtProp->GetFontFamily();
+    bold = txtProp->GetBold();
+    italic = txtProp->GetItalic();
+    shadow = txtProp->GetShadow();
+  }
+  params.sprintf( "* Graduated Axis: * Name *%u*%s*%.2f*%.2f*%.2f*%u*%u*%u*%u", isVisible, 
+                 title.latin1(), color[0], color[1], color[2], font, bold, italic, shadow );
+
+  // Labels
+  isVisible = actor->GetLabelVisibility();
+  int labels = actor->GetNumberOfLabels();
+  int offset = actor->GetTickOffset();
+  font = VTK_ARIAL;
+  bold = false;
+  italic = false;
+  shadow = false;
+
+  txtProp = actor->GetLabelTextProperty();
+  if ( txtProp )
+  {
+    txtProp->GetColor( color );
+    font = txtProp->GetFontFamily();
+    bold = txtProp->GetBold();
+    italic = txtProp->GetItalic();
+    shadow = txtProp->GetShadow();
+  }
+  params += QString().sprintf( "* Labels *%u*%u*%u*%.2f*%.2f*%.2f*%u*%u*%u*%u", isVisible, labels, offset,  
+                              color[0], color[1], color[2], font, bold, italic, shadow );
+
+  // Tick marks
+  isVisible = actor->GetTickVisibility();
+  int length = actor->GetTickLength();
+  
+  params += QString().sprintf( "* Tick marks *%u*%u", isVisible, length );
+  
+  return params;
+}
+
+/*! The method restores visual parameters of a graduated axis actor (x,y,z axis)
+ */
+void setGradAxisVisualParams( vtkAxisActor2D* actor, const QString& params )
+{
+  if ( !actor )
+    return;
+
+  QStringList paramsLst = QStringList::split( '*', params, true );
+
+  if ( paramsLst.size() == nGradAxisParams ) { // altogether name, lable, ticks parameters make up 25 values
+
+    // retrieve and set name parameters
+    bool isVisible = paramsLst[2].toUShort();
+    QString title = paramsLst[3];
+    vtkFloatingPointType color[3];
+    color[0] = paramsLst[4].toDouble();
+    color[1] = paramsLst[5].toDouble();
+    color[2] = paramsLst[6].toDouble();
+    int font = paramsLst[7].toInt();
+    int bold = paramsLst[8].toInt();
+    int italic = paramsLst[9].toInt();
+    int shadow = paramsLst[10].toInt();
+
+    actor->SetTitleVisibility( isVisible );
+    actor->SetTitle( title.latin1() );
+    vtkTextProperty* txtProp = actor->GetTitleTextProperty();
+    if ( txtProp ) {
+      txtProp->SetColor( color );
+      txtProp->SetFontFamily( font );
+      txtProp->SetBold( bold );
+      txtProp->SetItalic( italic );
+      txtProp->SetShadow( shadow );
+    }
+
+    // retrieve and set lable parameters
+    isVisible = paramsLst[12].toUShort();
+    int labels = paramsLst[13].toInt();
+    int offset = paramsLst[14].toInt();
+    color[0] = paramsLst[15].toDouble();
+    color[1] = paramsLst[16].toDouble();
+    color[2] = paramsLst[17].toDouble();
+    font = paramsLst[18].toInt();
+    bold = paramsLst[19].toInt();
+    italic = paramsLst[20].toInt();
+    shadow = paramsLst[21].toInt();
+
+    actor->SetLabelVisibility( isVisible );
+    actor->SetNumberOfLabels( labels );
+    actor->SetTickOffset( offset );
+    txtProp = actor->GetLabelTextProperty();
+    if ( txtProp ) {
+      txtProp->SetColor( color );
+      txtProp->SetFontFamily( font );
+      txtProp->SetBold( bold );
+      txtProp->SetItalic( italic );
+      txtProp->SetShadow( shadow );
+    }
+
+    // retrieve and set tick marks properties
+    isVisible = paramsLst[23].toUShort();
+    int length = paramsLst[24].toInt();
+
+    actor->SetTickVisibility( isVisible );
+    actor->SetTickLength( length );
+  }
 }
 
 /*! The method returns the visual parameters of this view as a formated string
@@ -605,7 +900,8 @@ SVTK_ViewWindow
 ::getVisualParameters()
 {
   double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
-
+  
+  // save position, focal point, viewUp, scale
   vtkCamera* camera = getRenderer()->GetActiveCamera();
   camera->GetPosition( pos );
   camera->GetFocalPoint( focalPnt );
@@ -613,15 +909,28 @@ SVTK_ViewWindow
   parScale = camera->GetParallelScale();
   GetScale( scale );
 
+  // Parameters are given in the following format:view position (3 digits), focal point position (3 digits)
+  // view up values (3 digits), parallel scale (1 digit), scale (3 digits, 
+  // Graduated axes parameters (X, Y, Z axes parameters)
   QString retStr;
   retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", 
-                 pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], viewUp[0], viewUp[1], 
-                 viewUp[2], parScale, scale[0], scale[1], scale[2] );
+                 pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], 
+                 viewUp[0], viewUp[1], viewUp[2], parScale, scale[0], scale[1], scale[2] );
+
+  // save graduated axes parameters
+  if ( SVTK_CubeAxesActor2D* gradAxesActor = GetCubeAxes() ) {
+    retStr += QString( "*%1" ).arg( getMainWindow()->IsCubeAxesDisplayed() );
+    retStr += ::getGradAxisVisualParams( gradAxesActor->GetXAxisActor2D() );
+    retStr += ::getGradAxisVisualParams( gradAxesActor->GetYAxisActor2D() );
+    retStr += ::getGradAxisVisualParams( gradAxesActor->GetZAxisActor2D() );
+  }
+
   return retStr;
 }
 
-/* The method restores visual parameters of this view or postpones it untill the view is shown
- */
+/*!
+  The method restores visual parameters of this view or postpones it untill the view is shown
+*/
 void
 SVTK_ViewWindow
 ::setVisualParameters( const QString& parameters )
@@ -636,14 +945,15 @@ SVTK_ViewWindow
   }
 }
 
-/* The method restores visual parameters of this view from a formated string
- */
+/*!
+  The method restores visual parameters of this view from a formated string
+*/
 void
 SVTK_ViewWindow
 ::doSetVisualParameters( const QString& parameters )
 {
   QStringList paramsLst = QStringList::split( '*', parameters, true );
-  if ( paramsLst.size() == 13 ) {
+  if ( paramsLst.size() >= nNormalParams ) {
     // 'reading' list of parameters
     double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
     pos[0] = paramsLst[0].toDouble();
@@ -668,20 +978,29 @@ SVTK_ViewWindow
     camera->SetParallelScale( parScale );
     SetScale( scale );
 
-    //    resize( size() );
-
-    //    getRenderer()->ResetCameraClippingRange();
-    //    Repaint();
-    //    getMainWindow()->GetRenderer()->GetTransform()->SetMatrixScale( scale[0], scale[1], scale[2] );
+    // apply graduated axes parameters
+    SVTK_CubeAxesActor2D* gradAxesActor = GetCubeAxes();
+    if ( gradAxesActor && paramsLst.size() == nAllParams ) {
+      
+      int i = nNormalParams+1, j = i + nGradAxisParams - 1;
+      ::setGradAxisVisualParams( gradAxesActor->GetXAxisActor2D(), parameters.section( '*', i, j ) ); 
+      i = j + 1; j += nGradAxisParams;
+      ::setGradAxisVisualParams( gradAxesActor->GetYAxisActor2D(), parameters.section( '*', i, j ) ); 
+      i = j + 1; j += nGradAxisParams;
+      ::setGradAxisVisualParams( gradAxesActor->GetZAxisActor2D(), parameters.section( '*', i, j ) ); 
+
+      if ( paramsLst[13].toUShort() )
+       gradAxesActor->VisibilityOn();
+      else
+       gradAxesActor->VisibilityOff();
+    }
   }
 }
 
 
-//================================================================
-// Function : eventFilter
-/*! Purpose : delayed setVisualParameters
+/*!
+  Delayed setVisualParameters
 */
-//================================================================
 bool SVTK_ViewWindow::eventFilter( QObject* theWatched, QEvent* theEvent )
 {
   if ( theEvent->type() == QEvent::Show && theWatched->inherits( "SVTK_RenderWindowInteractor" ) ) {