Salome HOME
0020997: [CEA 420] Problem with VISU preferences
[modules/visu.git] / src / VISUGUI / VisuGUI_Prs3dDlg.cxx
index 8372ddb2730f046f028cab61541e1caa44d21896..2416f563c546e095ebbb6cdbb0ae40fbe2623b3d 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -19,6 +19,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  VISU VISUGUI : GUI of VISU component
 //  File   : VisuGUI_Prs3dDlg.cxx
 //  Author : Laurent CORNABE & Hubert ROLLAND
@@ -36,6 +37,8 @@
 
 #include "VISUConfig.hh"
 #include "VISU_Convertor.hxx"
+#include "VISU_MeshValue.hxx"
+#include "VISU_Structures_impl.hxx"
 #include "VISU_ScalarMapPL.hxx"
 #include "VISU_ScalarBarActor.hxx"
 #include "VISU_ScalarMapAct.h"
@@ -43,6 +46,8 @@
 #include "VISU_Result_i.hh"
 #include "VISU_Prs3dUtils.hh"
 
+#include <SalomeApp_IntSpinBox.h>
+#include <SalomeApp_DoubleSpinBox.h>
 #include "LightApp_Application.h"
 
 #include "SUIT_Session.h"
 #include <QKeyEvent>
 #include <QGridLayout>
 
-#include "QtxDoubleSpinBox.h"
-
 #include <vtkTextProperty.h>
 
-#include <limits.h>
-
-using namespace std;
+#include <limits>
 
 //-----------------------------------------------------------------------
 // Text Preferences Dialog
@@ -95,7 +96,7 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
   QGroupBox* aTitleGrp = new QGroupBox ( tr("LBL_TITLE"), this);
   QVBoxLayout* aVBLay = new QVBoxLayout( aTitleGrp );
 
-  //   edit line  
+  //   edit line
   myTitleEdt = new QLineEdit (aTitleGrp);
   aVBLay->addWidget( myTitleEdt);
 
@@ -107,6 +108,7 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
   aHBLay->setSpacing(5);
 
   myTitleFont = new SVTK_FontWidget (aHBox);
+  myTitleFont->Initialize();
   aHBLay->addWidget( myTitleFont );
 
   aMainLay->addWidget(aTitleGrp);
@@ -121,8 +123,9 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
 
   aHBLay = new QHBoxLayout( aHBox );
   aHBLay->setSpacing(5);
-  
+
   myLabelFont = new SVTK_FontWidget (aHBox);
+  myLabelFont->Initialize();
   aHBLay->addWidget( myLabelFont );
 
   aMainLay->addWidget(aLabelsGrp);
@@ -195,7 +198,8 @@ void VisuGUI_TextPrefDlg::onHelp()
   else {
     SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
                              QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                             arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser",
+                                                                 "application")).arg(aHelpFileName),
                              QObject::tr("BUT_OK"));
   }
 }
@@ -278,37 +282,41 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent )
   aMainLay->setMargin( 5 );
 
   // dimensions
-  
+
   QGroupBox* aDimGrp = new QGroupBox( this );
   QGridLayout* aDimGrpLay = new QGridLayout( aDimGrp );
   aDimGrpLay->setSpacing( 5 );
   aDimGrpLay->setMargin( 5 );
 
-  myTitleSizeSpin = new QSpinBox( aDimGrp );
+  myTitleSizeSpin = new SalomeApp_IntSpinBox( aDimGrp );
+  myTitleSizeSpin->setAcceptNames( false );
   myTitleSizeSpin->setRange( 0, 100 );
   myTitleSizeSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myTitleSizeSpin->setMinimumWidth( 70 );
   myTitleSizeSpin->setValue( 0 );
   myTitleSizeSpin->setSpecialValueText( tr( "AUTO" ) );
   QLabel* aTitleSizeLbl = new QLabel( tr( "LBL_TITLE_W" ), aDimGrp );
-  
-  myLabelSizeSpin = new QSpinBox( aDimGrp );
+
+  myLabelSizeSpin = new SalomeApp_IntSpinBox( aDimGrp );
+  myLabelSizeSpin->setAcceptNames( false );
   myLabelSizeSpin->setRange( 0, 100 );
   myLabelSizeSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myLabelSizeSpin->setMinimumWidth( 70 );
   myLabelSizeSpin->setValue( 0 );
   myLabelSizeSpin->setSpecialValueText( tr( "AUTO" ) );
   QLabel* aLabelSizeLbl = new QLabel( tr( "LBL_LABEL_W" ), aDimGrp );
-  
-  myBarWidthSpin = new QSpinBox( aDimGrp );
+
+  myBarWidthSpin = new SalomeApp_IntSpinBox( aDimGrp );
+  myBarWidthSpin->setAcceptNames( false );
   myBarWidthSpin->setRange( 0, 100 );
   myBarWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myBarWidthSpin->setMinimumWidth( 70 );
   myBarWidthSpin->setValue( 0 );
   myBarWidthSpin->setSpecialValueText( tr( "AUTO" ) );
   QLabel* aBarWidthLbl = new QLabel( tr( "LBL_BAR_W" ), aDimGrp );
-  
-  myBarHeightSpin = new QSpinBox( aDimGrp );
+
+  myBarHeightSpin = new SalomeApp_IntSpinBox( aDimGrp );
+  myBarHeightSpin->setAcceptNames( false );
   myBarHeightSpin->setRange( 0, 100 );
   myBarHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myBarHeightSpin->setMinimumWidth( 70 );
@@ -319,13 +327,14 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent )
   // format and units
 
   QLabel* aPrecLbl = new QLabel( tr( "PRECISION" ), aDimGrp );
-  myPrecisionSpin = new QSpinBox( aDimGrp );
+  myPrecisionSpin = new SalomeApp_IntSpinBox( aDimGrp );
+  myPrecisionSpin->setAcceptNames( false );
   myPrecisionSpin->setRange( 1, 100 );
-  
+
   myUnitsChk = new QCheckBox( tr( "LBL_SHOW_UNITS" ), aDimGrp );
-  
+
   // layout
-  
+
   aDimGrpLay->addWidget( aTitleSizeLbl,  0, 0 );
   aDimGrpLay->addWidget( myTitleSizeSpin,   0, 1 );
   aDimGrpLay->addWidget( aLabelSizeLbl,  0, 2 );
@@ -337,7 +346,7 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent )
   aDimGrpLay->addWidget( aPrecLbl, 2, 0 );
   aDimGrpLay->addWidget( myPrecisionSpin, 2, 1 );
   aDimGrpLay->addWidget( myUnitsChk, 2, 2, 1, 2 );
-  
+
   aMainLay->addWidget( aDimGrp );
 
   // Common buttons ===========================================================
@@ -380,7 +389,7 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent )
 
 //----------------------------------------------------------------------------
 void VisuGUI_BarPrefDlg::setRatios( int titleRatioSize, int labelRatioWidth,
-                                   int barRatioWidth, int barRatioHeight )
+                                    int barRatioWidth, int barRatioHeight )
 {
   myTitleSizeSpin->setValue( myTitleSize = titleRatioSize );
   myLabelSizeSpin->setValue( myLabelSize = labelRatioWidth );
@@ -391,7 +400,7 @@ void VisuGUI_BarPrefDlg::setRatios( int titleRatioSize, int labelRatioWidth,
 
 //----------------------------------------------------------------------------
 void VisuGUI_BarPrefDlg::getRatios( int& titleRatioSize, int& labelRatioWidth,
-                                   int& barRatioWidth, int& barRatioHeight )
+                                    int& barRatioWidth, int& barRatioHeight )
 {
   titleRatioSize  = myTitleSizeSpin->value();
   labelRatioWidth  = myLabelSizeSpin->value();
@@ -436,10 +445,10 @@ void VisuGUI_BarPrefDlg::onHelp()
   }
   else {
     SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ),
-                             tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
-                             arg( app->resourceMgr()->stringValue( "ExternalBrowser", 
-                                                                   "application" ) ).
-                             arg( aHelpFileName ) );
+                              tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
+                              arg( app->resourceMgr()->stringValue( "ExternalBrowser",
+                                                                    "application" ) ).
+                              arg( aHelpFileName ) );
   }
 }
 
@@ -482,18 +491,18 @@ void VisuGUI_BarPrefDlg::accept()
 {
   QString dVal;
   int aBWH = myOrientation == 1 ? myBarWidthSpin->value() : myBarHeightSpin->value();
-  if( ( myLabelSizeSpin->value()+ aBWH ) > 100 ) 
+  if( ( myLabelSizeSpin->value()+ aBWH ) > 100 )
   {
     SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE" ) );
     return;
-  } 
-  
+  }
+
   if ( myTitleSizeSpin->value() > 100 )
   {
     SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE_TLT" ) );
     return;
   }
-  
+
   myTitleSize = myTitleSizeSpin->value();
   myLabelSize = myLabelSizeSpin->value();
   myBarWidth = myBarWidthSpin->value();
@@ -528,11 +537,12 @@ void VisuGUI_BarPrefDlg::keyPressEvent( QKeyEvent* e )
 /*!
   Constructor
 */
-VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
-  : QWidget( parent ), 
+VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplayGaussMetric, bool thePreview )
+  : QWidget( parent ),
     myPreviewActor( 0 ),
     myScalarMap( 0 ),
-    myScalarMapPL( 0 )
+    myScalarMapPL( 0 ),
+    myIsDisplayGaussMetric( theIsDisplayGaussMetric )
 {
   QVBoxLayout* aMainLayout = new QVBoxLayout( this );
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
@@ -546,7 +556,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   myVerLS = aResourceMgr->integerValue("VISU", propertyName + "label_size", 0);
   myVerBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0);
   myVerBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0);
-  
+
   propertyName = QString("scalar_bar_horizontal_");
   myHorX  = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
   myHorY  = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
@@ -575,16 +585,32 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   CBLog = new QCheckBox (tr("LOGARITHMIC_SCALING"), aGB);
   CBLog->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
+  myGaussMetricLabel = new QLabel( tr("VISU_GAUSS_METRIC"), aGB );
+  myGaussMetric = new QComboBox( aGB );
+  myGaussMetric->addItem( tr("VISU_GAUSS_METRIC_AVERAGE") );
+  myGaussMetric->addItem( tr("VISU_GAUSS_METRIC_MINIMUM") );
+  myGaussMetric->addItem( tr("VISU_GAUSS_METRIC_MAXIMUM") );
+  myGaussMetric->setToolTip( tr("VISU_GAUSS_METRIC_TOOLTIP") );
+
+  if( !myIsDisplayGaussMetric ) {
+    myGaussMetricLabel->hide();
+    myGaussMetric->hide();
+  }
+
   RBFrange = new QRadioButton (tr("FIELD_RANGE_BTN"), aGB);
   RBIrange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), aGB);
   RangeGroup->addButton( RBFrange, 0 );
   RangeGroup->addButton( RBIrange, 1 );
   RBFrange->setChecked( true );
 
+  int aPrecision = qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) );
+  QDoubleValidator* dv = new QDoubleValidator(this);
+  dv->setDecimals(aPrecision);
+
   MinEdit = new QLineEdit( aGB );
   MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //MinEdit->setMinimumWidth( 70 );
-  MinEdit->setValidator( new QDoubleValidator(this) );
+  MinEdit->setValidator( dv );
   MinEdit->setText( "0.0" );
   QLabel* MinLabel = new QLabel (tr("LBL_MIN"), aGB);
   MinLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
@@ -593,7 +619,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   MaxEdit = new QLineEdit( aGB );
   MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //MaxEdit->setMinimumWidth( 70 );
-  MaxEdit->setValidator( new QDoubleValidator(this) );
+  MaxEdit->setValidator( dv );
   MaxEdit->setText( "0.0" );
   QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), aGB);
   MaxLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
@@ -602,12 +628,14 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   RangeGroupLayout->addWidget( myModeLbl, 0, 0, 1, 1 );
   RangeGroupLayout->addWidget( myModeCombo, 0, 1, 1, 2);
   RangeGroupLayout->addWidget( CBLog, 0, 3, 1, 1);
-  RangeGroupLayout->addWidget( RBFrange, 1, 0, 1, 2);
-  RangeGroupLayout->addWidget( RBIrange, 1, 2, 1, 2);
-  RangeGroupLayout->addWidget( MinLabel, 2, 0 );
-  RangeGroupLayout->addWidget( MinEdit,  2, 1 );
-  RangeGroupLayout->addWidget( MaxLabel, 2, 2 );
-  RangeGroupLayout->addWidget( MaxEdit,  2, 3 );
+  RangeGroupLayout->addWidget( myGaussMetricLabel, 1, 0, 1, 1);
+  RangeGroupLayout->addWidget( myGaussMetric, 1, 1, 1, 3);
+  RangeGroupLayout->addWidget( RBFrange, 2, 0, 1, 2);
+  RangeGroupLayout->addWidget( RBIrange, 2, 2, 1, 2);
+  RangeGroupLayout->addWidget( MinLabel, 3, 0 );
+  RangeGroupLayout->addWidget( MinEdit,  3, 1 );
+  RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
+  RangeGroupLayout->addWidget( MaxEdit,  3, 3 );
 
   // Colors and Labels ========================================================
   QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this);
@@ -618,7 +646,8 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   //ColLabGroupLayout->setMargin( 11 );
 
   QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup);
-  ColorSpin = new QSpinBox( ColLabGroup );
+  ColorSpin = new SalomeApp_IntSpinBox( ColLabGroup );
+  ColorSpin->setAcceptNames( false );
   ColorSpin->setMinimum( 2 );
   ColorSpin->setMaximum( 256 );
   ColorSpin->setSingleStep( 1 );
@@ -627,11 +656,12 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   ColorSpin->setValue( 64 );
 
   QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup);
-  LabelSpin = new QSpinBox( ColLabGroup );
+  LabelSpin = new SalomeApp_IntSpinBox( ColLabGroup );
+  LabelSpin->setAcceptNames( false );
   LabelSpin->setMinimum( 2 );
   LabelSpin->setMaximum( 65 );
   LabelSpin->setSingleStep( 1 );
-  
+
   LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //LabelSpin->setMinimumWidth( 70 );
   LabelSpin->setValue( 5 );
@@ -667,15 +697,15 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   //OriginGroupLayout->setMargin( 11 );
 
   QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup);
-  XSpin = new QtxDoubleSpinBox( OriginGroup );
-  VISU::initSpinBox(XSpin, 0.0, +1.0);
+  XSpin = new SalomeApp_DoubleSpinBox( OriginGroup );
+  VISU::initSpinBox( XSpin, 0.0, +1.0, .1, "parametric_precision" );
   XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //XSpin->setMinimumWidth( 70 );
   XSpin->setValue( 0.01 );
 
   QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup);
-  YSpin = new QtxDoubleSpinBox( OriginGroup );
-  VISU::initSpinBox(YSpin, 0.0, +1.0);
+  YSpin = new SalomeApp_DoubleSpinBox( OriginGroup );
+  VISU::initSpinBox( YSpin, 0.0, +1.0, .1, "parametric_precision" );  
   YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //YSpin->setMinimumWidth( 70 );
   YSpin->setValue( 0.1 );
@@ -694,15 +724,15 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   //DimGroupLayout->setMargin( 11 );
 
   QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup);
-  WidthSpin = new QtxDoubleSpinBox( DimGroup );
-  VISU::initSpinBox(WidthSpin, 0.0, +1.0);
+  WidthSpin = new SalomeApp_DoubleSpinBox( DimGroup );
+  VISU::initSpinBox( WidthSpin, 0.0, +1.0, .1, "parametric_precision" );    
   WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //WidthSpin->setMinimumWidth( 70 );
   WidthSpin->setValue( 0.1 );
 
   QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup);
-  HeightSpin = new QtxDoubleSpinBox( DimGroup );
-  VISU::initSpinBox(HeightSpin, 0.0, +1.0);
+  HeightSpin = new SalomeApp_DoubleSpinBox( DimGroup );
+  VISU::initSpinBox( HeightSpin, 0.0, +1.0, .1, "parametric_precision" );
   HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //HeightSpin->setMinimumWidth( 70 );
   HeightSpin->setValue( 0.8 );
@@ -718,7 +748,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   QHBoxLayout* aVBLay = new QHBoxLayout( aSaveBox );
   aVBLay->addWidget( myTextBtn = new QPushButton("Text properties...", aSaveBox) );
   aVBLay->addWidget( myBarBtn  = new QPushButton("Bar properties...",  aSaveBox) );
-  
+
   aMainLayout->addWidget( myTextDlg = new VisuGUI_TextPrefDlg(this) );
   myTextDlg->setTitleVisible(!thePreview);
   myBarDlg = new VisuGUI_BarPrefDlg(this);
@@ -727,11 +757,11 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   aMainLayout->addWidget( CheckGroup );
   //QHBoxLayout* CheckGroupLayout = new QHBoxLayout( CheckGroup );
   QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup );
-  
+
   myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), CheckGroup);
   myPreviewCheck->setChecked(false);
   CheckGroupLayout->addWidget(myPreviewCheck, 0, 0);
-  
+
   myHideBar = new QCheckBox(tr("HIDE_SCALAR_BAR"), CheckGroup);
   myHideBar->setChecked(false);
   CheckGroupLayout->addWidget(myHideBar, 0, 1);
@@ -758,7 +788,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
 
   int lp = aResourceMgr->integerValue( "VISU", propertyName + "scalar_bar_label_precision", 3 );
   myBarDlg->setLabelsPrecision( lp );
-  
+
   myBarDlg->setUnitsVisible(aResourceMgr->booleanValue("VISU", propertyName + "display_units", true));
 
   // signals and slots connections ===========================================
@@ -766,15 +796,16 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview )
   connect( RBIrange,   SIGNAL( toggled( bool ) ), this, SLOT( onImposedRange( bool ) ) );
 
   connect( myModeCombo,    SIGNAL( activated( int ) ),       this, SLOT( changeScalarMode( int ) ) );
+  connect( myGaussMetric,  SIGNAL( activated( int ) ),       this, SLOT( changeGaussMetric( int ) ) );
   connect( OrientGroup,    SIGNAL( buttonClicked( int ) ),   this, SLOT( changeDefaults( int ) ) );
   connect( XSpin,          SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
   connect( YSpin,          SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
   connect( myTextBtn,      SIGNAL( clicked() ),              this, SLOT( onTextPref() ) );
   connect( myBarBtn,       SIGNAL( clicked() ),              this, SLOT( onBarPref() ) );
   connect( myPreviewCheck, SIGNAL( toggled( bool )),         this, SLOT( onPreviewCheck( bool ) ) );
-  
+
   connect( CBDistr,        SIGNAL( toggled( bool ) ),        this, SLOT( onShowDistribution( bool ) )); // RKV
-  
+
   connect( ColorSpin,      SIGNAL( valueChanged( int ) ),    this, SLOT( updatePreview() ));
   connect( LabelSpin,      SIGNAL( valueChanged( int ) ),    this, SLOT( updatePreview() ));
   connect( WidthSpin,      SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
@@ -843,10 +874,10 @@ void VisuGUI_ScalarBarPane::storeToResources() {
     }
   else
     aResourceMgr->setValue("VISU", "scalar_range_type", 0);
-  
+
   aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
   aResourceMgr->setValue("VISU", "scalar_bar_show_distribution", isShowDistribution()); // RKV
+
   ////
 
   if (myIsStoreTextProp) {
@@ -861,11 +892,11 @@ void VisuGUI_ScalarBarPane::storeToResources() {
                                     isTitleBold, isTitleItalic, isTitleShadow);
 
     QFont aTitleFont;
-    
+
     aTitleFont.setBold(isTitleBold);
     aTitleFont.setItalic(isTitleItalic);
     aTitleFont.setOverline(isTitleShadow);
-    
+
     QString titleFontFamily;
     switch (aTitleFontFamily) {
     case VTK_ARIAL:
@@ -879,11 +910,11 @@ void VisuGUI_ScalarBarPane::storeToResources() {
       break;
     }
     aTitleFont.setFamily(titleFontFamily);
-    
+
     aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont);
-    
+
     aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor);
-    
+
     // "Label"
     QColor aLabelColor (255, 255, 255);
     int aLabelFontFamily = VTK_ARIAL;
@@ -896,7 +927,7 @@ void VisuGUI_ScalarBarPane::storeToResources() {
 
 
     QFont aLabelFont;
-    
+
     aLabelFont.setBold(isLabelBold);
     aLabelFont.setItalic(isLabelItalic);
     aLabelFont.setOverline(isLabelShadow);
@@ -915,7 +946,7 @@ void VisuGUI_ScalarBarPane::storeToResources() {
     }
 
     aLabelFont.setFamily(labelFontFamily);
-    
+
     aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
 
     aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
@@ -967,7 +998,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
     QString anUnit = QString(aUnitNames[i].c_str()).simplified();
     if(anUnit.isNull() || anUnit == "")
       anUnit = "-";
-    
+
     aComponent = aComponent + ", " + anUnit;
 
     myModeCombo->addItem(aComponent);
@@ -980,6 +1011,24 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
   myModeLbl->setEnabled(isScalarMode);
   myModeCombo->setEnabled(isScalarMode);
 
+  // Gauss Metric option should be visible only if at least one
+  // of mesh values on geometry is based on multiple gauss points
+  bool isEnableGaussMetric = false;
+  if( myIsDisplayGaussMetric ) {
+    const VISU::TValField& aValField = aField->myValField;
+    VISU::TValField::const_iterator anIter = aValField.find(myScalarMap->GetScalarTimeStampNumber());
+    if ( anIter != aValField.end() ) {
+      VISU::PValForTime aValForTime = anIter->second;
+      if( aValForTime && aValForTime->GetMaxNbGauss() > 1 )
+        isEnableGaussMetric = true;
+    }
+  }
+
+  myGaussMetricLabel->setEnabled(isEnableGaussMetric);
+  myGaussMetric->setEnabled(isEnableGaussMetric);
+  if( isEnableGaussMetric )
+    myGaussMetric->setCurrentIndex((int)myScalarMap->GetGaussMetric());
+
   setRange( myScalarMap->GetMin(), myScalarMap->GetMax(), myScalarMap->IsRangeFixed() );
 
   setScalarBarData( myScalarMap->GetNbColors(), myScalarMap->GetLabels() );
@@ -991,10 +1040,10 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
   myTitle = aTitle.in();
 
   setPosAndSize( myScalarMap->GetPosX(),
-                myScalarMap->GetPosY(),
-                myScalarMap->GetWidth(),
-                myScalarMap->GetHeight(),
-                myScalarMap->GetBarOrientation());
+                 myScalarMap->GetPosY(),
+                 myScalarMap->GetWidth(),
+                 myScalarMap->GetHeight(),
+                 myScalarMap->GetBarOrientation());
 
   if(RBvert->isChecked()) {
     myVerTS = myScalarMap->GetTitleSize();
@@ -1073,7 +1122,7 @@ void VisuGUI_ScalarBarPane::createScalarBar()
   myScalarMapPL = VISU_ScalarMapPL::New();
   if(myScalarMap->GetSpecificPL())
     myScalarMapPL->ShallowCopy(myScalarMap->GetSpecificPL(), true);
-  
+
   if ( myBusy ) return;
 
   myBusy = true;
@@ -1090,13 +1139,16 @@ void VisuGUI_ScalarBarPane::createScalarBar()
   myPreviewActor->GetScalarBar()->VisibilityOn();
   myPreviewActor->PickableOff();
   //myPreviewActor->SetBarVisibility(!myHideBar->isChecked());
-  
+
   myScalarMapPL->SetScalarMode(myModeCombo->currentIndex());
   if(isLogarithmic())
     myScalarMapPL->SetScaling(VISU::LOGARITHMIC);
   else
     myScalarMapPL->SetScaling(VISU::LINEAR);
 
+  if( myGaussMetric->isVisible() )
+    myScalarMapPL->SetGaussMetric((VISU::TGaussMetric)myGaussMetric->currentIndex());
+
   if ( RBFrange->isChecked() ) {
     myScalarMapPL->SetSourceRange();
   } else {
@@ -1106,13 +1158,13 @@ void VisuGUI_ScalarBarPane::createScalarBar()
     myScalarMapPL->SetScalarRange( aRange );
   }
 
-  myScalarMapPL->SetNbColors(sbCol);  
+  myScalarMapPL->SetNbColors(sbCol);
   myScalarMapPL->Update();
-  
+
   aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable());
   aScalarBarActor->SetDistribution( myScalarMapPL->GetDistribution() );
   aScalarBarActor->SetDistributionVisibility( isShowDistribution() );
-  
+
   if (!myTextDlg->getTitleText().isEmpty()) {
     VISU::PValForTime aValForTime;
     const VISU::PField& aField = myScalarMap->GetScalarField();
@@ -1122,15 +1174,15 @@ void VisuGUI_ScalarBarPane::createScalarBar()
       aValForTime = anIter->second;
 
     if (aValForTime) {
-      std::strstream aStream;
+      std::stringstream aStream;
       const VISU::TTime& aTime = aValForTime->myTime;
       aStream<< myTextDlg->getTitleText().toLatin1().data() <<" ";
-      if(myBarDlg->isUnitsVisible()) 
-       aStream<<VISU_Convertor::GenerateName(aTime)<<std::ends;
+      if(myBarDlg->isUnitsVisible())
+        aStream<<VISU_Convertor::GenerateName(aTime)<<std::ends;
       else {
-       QString aName;
-       aName.sprintf("%g", aTime.first);
-       aStream << aName.toLatin1().data() << std::ends;
+        QString aName;
+        aName.sprintf("%g", aTime.first);
+        aStream << aName.toLatin1().data() << std::ends;
       }
       std::string aScalarBarTitle = aStream.str();
       aScalarBarActor->SetTitle(aScalarBarTitle.c_str());
@@ -1155,16 +1207,16 @@ void VisuGUI_ScalarBarPane::createScalarBar()
   bool isTitleItalic;
   bool isTitleShadow;
   myTextDlg->myTitleFont->GetData(aTitleColor,aTitleFontFamily,
-                                 isTitleBold,isTitleItalic,isTitleShadow);
+                                  isTitleBold,isTitleItalic,isTitleShadow);
   vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty();
   aTitleProp->SetFontFamily(aTitleFontFamily);
   aTitleProp->SetColor(vtkFloatingPointType(aTitleColor.red())/255.,
-                      vtkFloatingPointType(aTitleColor.green())/255.,
-                      vtkFloatingPointType(aTitleColor.blue())/255.);
+                       vtkFloatingPointType(aTitleColor.green())/255.,
+                       vtkFloatingPointType(aTitleColor.blue())/255.);
   (isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
   (isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
   (isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
-  
+
   // label text property
   QColor aLabelColor;
   int aLabelFontFamily;
@@ -1172,17 +1224,17 @@ void VisuGUI_ScalarBarPane::createScalarBar()
   bool isLabelItalic;
   bool isLabelShadow;
   myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
-                                 isLabelBold, isLabelItalic, isLabelShadow);
+                                  isLabelBold, isLabelItalic, isLabelShadow);
   vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty();
   aLabelProp->SetFontFamily(aLabelFontFamily);
   aLabelProp->SetColor(vtkFloatingPointType(aLabelColor.red())/255.,
-                      vtkFloatingPointType(aLabelColor.green())/255.,
-                      vtkFloatingPointType(aLabelColor.blue())/255.);
+                       vtkFloatingPointType(aLabelColor.green())/255.,
+                       vtkFloatingPointType(aLabelColor.blue())/255.);
   (isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
   (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
   (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
 
-  int VerTS, VerTH, VerLS, VerBW, VerBH;
+  int VerTS, VerLS, VerBW, VerBH;
   myBarDlg->getRatios(VerTS, VerLS, VerBW, VerBH);
   aScalarBarActor->SetRatios(VerTS, VerLS, VerBW, VerBH);
 
@@ -1203,7 +1255,7 @@ void VisuGUI_ScalarBarPane::createScalarBar()
 void VisuGUI_ScalarBarPane::deleteScalarBar()
 {
   if ( myBusy ) return;
-  
+
   if (myPreviewActor == 0) return;
   vtkRenderer* aRend       = myPreviewActor->GetRenderer();
   vtkRenderWindow* aWnd = aRend->GetRenderWindow();
@@ -1229,6 +1281,8 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
     return 0;
 
   myScalarMap->SetScalarMode(myModeCombo->currentIndex());
+  if( myGaussMetric->isVisible() )
+    myScalarMap->SetGaussMetric((VISU::GaussMetric)myGaussMetric->currentIndex());
   myScalarMap->SetPosition(XSpin->value(), YSpin->value());
   myScalarMap->SetSize(WidthSpin->value(), HeightSpin->value());
   if(RBvert->isChecked()) {
@@ -1278,8 +1332,8 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
     myScalarMap->SetShadowTitle(isTitleShadow);
     myScalarMap->SetTitFontType(aTitleFontFamily);
     myScalarMap->SetTitleColor(aTitColor.red()/255.,
-                         aTitColor.green()/255.,
-                         aTitColor.blue()/255.);
+                          aTitColor.green()/255.,
+                          aTitColor.blue()/255.);
 
     // "Label"
     QColor aLblColor (255, 255, 255);
@@ -1296,8 +1350,8 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
     myScalarMap->SetShadowLabel(isLabelShadow);
     myScalarMap->SetLblFontType(aLabelFontFamily);
     myScalarMap->SetLabelColor(aLblColor.red()/255.,
-                              aLblColor.green()/255.,
-                              aLblColor.blue()/255.);
+                               aLblColor.green()/255.,
+                               aLblColor.blue()/255.);
     myIsStoreTextProp = false;
   }
 
@@ -1379,7 +1433,7 @@ void VisuGUI_ScalarBarPane::changeRange( int )
 */
 void VisuGUI_ScalarBarPane::XYChanged( double )
 {
-  QtxDoubleSpinBox* snd = (QtxDoubleSpinBox*)sender();
+  SalomeApp_DoubleSpinBox* snd = (SalomeApp_DoubleSpinBox*)sender();
   if ( snd == XSpin ) {
     WidthSpin->setMaximum( 1.0 - XSpin->value() );
   }
@@ -1399,8 +1453,31 @@ void VisuGUI_ScalarBarPane::changeScalarMode( int theMode )
   myScalarMap->SetScalarMode(theMode);
 
   if ( RBFrange->isChecked() ) {
-    MinEdit->setText( QString::number( myScalarMap->GetSourceMin() ) );
-    MaxEdit->setText( QString::number( myScalarMap->GetSourceMax() ) );
+    SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+    int aPrecision = qAbs( aResourceMgr->integerValue("VISU", "visual_data_precision", 0) );
+
+    MinEdit->setText(QString::number(myScalarMap->GetSourceMin(), 'g', aPrecision));
+    MaxEdit->setText(QString::number(myScalarMap->GetSourceMax(), 'g', aPrecision));
+  }
+
+  updatePreview();
+}
+
+
+//----------------------------------------------------------------------------
+/*!
+  Called when scalar mode is changed
+*/
+void VisuGUI_ScalarBarPane::changeGaussMetric( int theGaussMetric )
+{
+  myScalarMap->SetGaussMetric((VISU::GaussMetric)theGaussMetric);
+
+  if ( RBFrange->isChecked() ) {
+    SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+    int aPrecision = qAbs( aResourceMgr->integerValue("VISU", "visual_data_precision", 0) );
+
+    MinEdit->setText(QString::number(myScalarMap->GetSourceMin(), 'g', aPrecision));
+    MaxEdit->setText(QString::number(myScalarMap->GetSourceMax(), 'g', aPrecision));
   }
 
   updatePreview();
@@ -1413,8 +1490,12 @@ void VisuGUI_ScalarBarPane::changeScalarMode( int theMode )
 */
 void VisuGUI_ScalarBarPane::setRange( double imin, double imax, bool sbRange )
 {
-  MinEdit->setText( QString::number( imin ) );
-  MaxEdit->setText( QString::number( imax ) );
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+  int aPrecision = qAbs( aResourceMgr->integerValue("VISU", "visual_data_precision", 0) );
+
+  MinEdit->setText(QString::number(imin, 'g', aPrecision+1)); // VSR +1 is for 'g' format
+  MaxEdit->setText(QString::number(imax, 'g', aPrecision+1)); // VSR +1 is for 'g' format
+
   if( sbRange )
     RBIrange->setChecked( true );
   else
@@ -1568,8 +1649,8 @@ bool VisuGUI_ScalarBarPane::check()
   if ( RBIrange->isChecked() ) {
     if (minVal >= maxVal) {
       SUIT_MessageBox::warning( this,tr("WRN_VISU"),
-                            tr("MSG_MINMAX_VALUES"),
-                            tr("BUT_OK"));
+                             tr("MSG_MINMAX_VALUES"),
+                             tr("BUT_OK"));
       return false;
     }
   }
@@ -1578,23 +1659,23 @@ bool VisuGUI_ScalarBarPane::check()
   if ( CBLog->isChecked() ) {
     if ( minVal <= 0.0 || maxVal <= 0.0 ) {
       if ( RBIrange->isChecked() ) {
-       SUIT_MessageBox::warning( this,
+        SUIT_MessageBox::warning( this,
                                   tr("WRN_VISU"),
                                   tr("WRN_LOGARITHMIC_RANGE"),
                                   tr("BUT_OK"));
       } else {
-       if ( minVal == 0 || maxVal == 0 )
-         SUIT_MessageBox::warning( this,
-                                 tr("WRN_VISU"),
-                                 tr("WRN_LOGARITHMIC_RANGE"),
-                                 tr("BUT_OK"));
-       else
-         SUIT_MessageBox::warning( this,
-                                   tr("WRN_VISU"),
-                                   tr("WRN_LOGARITHMIC_FIELD_RANGE"),
-                                   tr("BUT_OK"));
-       RBIrange->setChecked(true);
-       changeRange(1);
+        if ( minVal == 0 || maxVal == 0 )
+          SUIT_MessageBox::warning( this,
+                                  tr("WRN_VISU"),
+                                  tr("WRN_LOGARITHMIC_RANGE"),
+                                  tr("BUT_OK"));
+        else
+          SUIT_MessageBox::warning( this,
+                                    tr("WRN_VISU"),
+                                    tr("WRN_LOGARITHMIC_FIELD_RANGE"),
+                                    tr("BUT_OK"));
+        RBIrange->setChecked(true);
+        changeRange(1);
       }
       return false;
     }
@@ -1662,10 +1743,10 @@ void VisuGUI_Prs3dDlg::onHelp()
   }
   else {
     SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ),
-                             tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
-                             arg( app->resourceMgr()->stringValue( "ExternalBrowser", 
-                                                                  "application" ) ).
-                             arg( aHelpFileName ) );
+                              tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
+                              arg( app->resourceMgr()->stringValue( "ExternalBrowser",
+                                                                   "application" ) ).
+                              arg( aHelpFileName ) );
   }
 }
 
@@ -1676,7 +1757,7 @@ void VisuGUI_Prs3dDlg::keyPressEvent( QKeyEvent* e )
   QDialog::keyPressEvent( e );
   if ( e->isAccepted() )
     return;
-  
+
   if ( e->key() == Qt::Key_F1 ) {
     e->accept();
     onHelp();
@@ -1684,10 +1765,10 @@ void VisuGUI_Prs3dDlg::keyPressEvent( QKeyEvent* e )
 }
 
 //----------------------------------------------------------------------------
-VisuGUI_ScalarBarBaseDlg::VisuGUI_ScalarBarBaseDlg( SalomeApp_Module* theModule, bool thePreview ) :
+VisuGUI_ScalarBarBaseDlg::VisuGUI_ScalarBarBaseDlg( SalomeApp_Module* theModule, bool theIsDisplayGaussMetric, bool thePreview ) :
   VisuGUI_Prs3dDlg( theModule )
 {
-  myScalarPane = new VisuGUI_ScalarBarPane(this, thePreview);
+  myScalarPane = new VisuGUI_ScalarBarPane(this, theIsDisplayGaussMetric, thePreview);
   myScalarPane->layout()->setMargin( 5 );
 }
 
@@ -1699,7 +1780,7 @@ VisuGUI_ScalarBarBaseDlg::~VisuGUI_ScalarBarBaseDlg()
 
 //----------------------------------------------------------------------------
 void VisuGUI_ScalarBarBaseDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
-                                                 bool theInit )
+                                                  bool theInit )
 {
   myScalarPane->initFromPrsObject( thePrs );
 }