-// 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
//
// 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
#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"
#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
QGroupBox* aTitleGrp = new QGroupBox ( tr("LBL_TITLE"), this);
QVBoxLayout* aVBLay = new QVBoxLayout( aTitleGrp );
- // edit line
+ // edit line
myTitleEdt = new QLineEdit (aTitleGrp);
aVBLay->addWidget( myTitleEdt);
aHBLay->setSpacing(5);
myTitleFont = new SVTK_FontWidget (aHBox);
+ myTitleFont->Initialize();
aHBLay->addWidget( myTitleFont );
aMainLay->addWidget(aTitleGrp);
aHBLay = new QHBoxLayout( aHBox );
aHBLay->setSpacing(5);
-
+
myLabelFont = new SVTK_FontWidget (aHBox);
+ myLabelFont->Initialize();
aHBLay->addWidget( myLabelFont );
aMainLay->addWidget(aLabelsGrp);
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"));
}
}
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 );
// 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 );
aDimGrpLay->addWidget( aPrecLbl, 2, 0 );
aDimGrpLay->addWidget( myPrecisionSpin, 2, 1 );
aDimGrpLay->addWidget( myUnitsChk, 2, 2, 1, 2 );
-
+
aMainLay->addWidget( aDimGrp );
// Common buttons ===========================================================
//----------------------------------------------------------------------------
void VisuGUI_BarPrefDlg::setRatios( int titleRatioSize, int labelRatioWidth,
- int barRatioWidth, int barRatioHeight )
+ int barRatioWidth, int barRatioHeight )
{
myTitleSizeSpin->setValue( myTitleSize = titleRatioSize );
myLabelSizeSpin->setValue( myLabelSize = labelRatioWidth );
//----------------------------------------------------------------------------
void VisuGUI_BarPrefDlg::getRatios( int& titleRatioSize, int& labelRatioWidth,
- int& barRatioWidth, int& barRatioHeight )
+ int& barRatioWidth, int& barRatioHeight )
{
titleRatioSize = myTitleSizeSpin->value();
labelRatioWidth = myLabelSizeSpin->value();
}
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 ) );
}
}
{
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();
/*!
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();
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.);
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 ) );
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 ) );
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);
//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 );
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 );
//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 );
//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 );
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);
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);
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 ===========================================
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() ));
}
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) {
isTitleBold, isTitleItalic, isTitleShadow);
QFont aTitleFont;
-
+
aTitleFont.setBold(isTitleBold);
aTitleFont.setItalic(isTitleItalic);
aTitleFont.setOverline(isTitleShadow);
-
+
QString titleFontFamily;
switch (aTitleFontFamily) {
case VTK_ARIAL:
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;
QFont aLabelFont;
-
+
aLabelFont.setBold(isLabelBold);
aLabelFont.setItalic(isLabelItalic);
aLabelFont.setOverline(isLabelShadow);
}
aLabelFont.setFamily(labelFontFamily);
-
+
aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
QString anUnit = QString(aUnitNames[i].c_str()).simplified();
if(anUnit.isNull() || anUnit == "")
anUnit = "-";
-
+
aComponent = aComponent + ", " + anUnit;
myModeCombo->addItem(aComponent);
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() );
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();
myScalarMapPL = VISU_ScalarMapPL::New();
if(myScalarMap->GetSpecificPL())
myScalarMapPL->ShallowCopy(myScalarMap->GetSpecificPL(), true);
-
+
if ( myBusy ) return;
myBusy = true;
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 {
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();
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());
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;
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);
void VisuGUI_ScalarBarPane::deleteScalarBar()
{
if ( myBusy ) return;
-
+
if (myPreviewActor == 0) return;
vtkRenderer* aRend = myPreviewActor->GetRenderer();
vtkRenderWindow* aWnd = aRend->GetRenderWindow();
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()) {
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);
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;
}
*/
void VisuGUI_ScalarBarPane::XYChanged( double )
{
- QtxDoubleSpinBox* snd = (QtxDoubleSpinBox*)sender();
+ SalomeApp_DoubleSpinBox* snd = (SalomeApp_DoubleSpinBox*)sender();
if ( snd == XSpin ) {
WidthSpin->setMaximum( 1.0 - XSpin->value() );
}
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();
*/
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
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;
}
}
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;
}
}
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 ) );
}
}
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
-
+
if ( e->key() == Qt::Key_F1 ) {
e->accept();
onHelp();
}
//----------------------------------------------------------------------------
-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 );
}
//----------------------------------------------------------------------------
void VisuGUI_ScalarBarBaseDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
- bool theInit )
+ bool theInit )
{
myScalarPane->initFromPrsObject( thePrs );
}