Scalar bar ergonomics is updated.
Two Parameters ?Title width (%)? and ?Title height (%)? are replaced with one parameter ?Title size (%)?.
Two Parameters ?Labels width (%)? and ?Labels height (%)? are replaced with one parameter ?Labels size (%)?.
Format of labels is stored as integer value specified format precision instead of string value representing format. This integer value is used by Preferences and ?Bar properties? dialog box. All other internal objects (actors and presentations) uses format as string values. Two auxiliary methods VISU_Prs3dUtils::ToFormat() and VISU_Prs3dUtils::ToPrecision() are created for converting precision to format and vice versa.
Label ?Dimensions? of ?Scalar bar properties? pane is replaced with ?Dimensions (in % of the size of view)?
<parameter name="scalar_bar_horizontal_width" value="0.5" />
<parameter name="scalar_bar_horizontal_x" value="0.01"/>
<parameter name="scalar_bar_horizontal_y" value="0.01"/>
- <parameter name="scalar_bar_horizontal_title_height" value="0"/>
- <parameter name="scalar_bar_horizontal_title_width" value="0"/>
- <parameter name="scalar_bar_horizontal_label_height" value="0"/>
- <parameter name="scalar_bar_horizontal_label_width" value="0"/>
+ <parameter name="scalar_bar_horizontal_title_size" value="0"/>
+ <parameter name="scalar_bar_horizontal_label_size" value="0"/>
<parameter name="scalar_bar_horizontal_bar_height" value="0"/>
<parameter name="scalar_bar_horizontal_bar_width" value="0"/>
<parameter name="scalar_bar_label_color" value="255, 255, 255"/>
<parameter name="scalar_bar_label_font" value="Arial,Bold,Italic,Shadow,12"/>
- <parameter name="scalar_bar_label_format" value="%-#6.3g" />
+ <parameter name="scalar_bar_label_precision" value="3" />
<parameter name="scalar_bar_logarithmic" value="false"/>
<!-- RKV : Begin -->
<!-- Do filter by scalars or don't -->
<translation>Labels format</translation>
</message>
<message>
- <source>VISU_TITLE_WIDTH</source>
- <translation>Title width (%):</translation>
+ <source>VISU_TITLE_SIZE</source>
+ <translation>Title size (%):</translation>
</message>
<message>
<source>VISU_TITLE_HEIGHT</source>
<translation>Title height (%):</translation>
</message>
<message>
- <source>VISU_LABEL_WIDTH</source>
- <translation>Label width (%):</translation>
+ <source>VISU_LABEL_SIZE</source>
+ <translation>Label size (%):</translation>
</message>
<message>
<source>VISU_LABEL_HEIGHT</source>
</context>
<context>
<name>VisuGUI</name>
+ <message>
+ <source>PRECISION</source>
+ <translation>Precision</translation>
+ </message>
<message>
<source>DLG_LINEWIDTH_CMT1</source>
<translation>Set value between</translation>
</message>
<message>
<source>DIMENSIONS_GRP</source>
- <translation>Dimensions</translation>
+ <translation>Dimensions (in % of the size of view)</translation>
</message>
<message>
<source>FIELD_RANGE_BTN</source>
</context>
<context>
<name>VisuGUI_BarPrefDlg</name>
+ <message>
+ <source>DIMENSIONS</source>
+ <translation>Dimensions (in % of the size of widget)</translation>
+ </message>
+ <message>
+ <source>WIDTH</source>
+ <translation>Width</translation>
+ </message>
+ <message>
+ <source>PRECISION</source>
+ <translation>Precision</translation>
+ </message>
<message>
<source>&OK</source>
<translation></translation>
</message>
<message>
<source>LBL_TITLE_W</source>
- <translation>Title width (%)</translation>
- </message>
- <message>
- <source>LBL_TITLE_H</source>
- <translation>Title height (%)</translation>
+ <translation>Title size (%)</translation>
</message>
<message>
<source>LBL_LABEL_W</source>
- <translation>Label width (%)</translation>
+ <translation>Label size (%)</translation>
</message>
<message>
<source>LBL_LABEL_H</source>
</message>
<message>
<source>MSG_BIG_SCALE</source>
- <translation>The common (Title, Label, Bar) width or height should not be greater then 100%.</translation>
+ <translation>The common Label size and Bar width or height should not be greater then 100%.</translation>
+ </message>
+ <message>
+ <source>MSG_BIG_SCALE_TLT</source>
+ <translation>The Title size should not be greater then 100%.</translation>
</message>
<message>
<source>AUTO</source>
setPreferenceProperty( numlab, "min", 2 );
setPreferenceProperty( numlab, "max", 65 );
- addPreference( tr( "VISU_LABELS_FORMAT" ), colorsLabelsGr,
- LightApp_Preferences::String, "VISU", "scalar_bar_label_format" );
+ int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
+ setPreferenceProperty( lPrec, "min", 1 );
+ setPreferenceProperty( lPrec, "max", 100 );
+
int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
setPreferenceProperty( frame, "orientation", "horizontal" );
int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
- int twv = addPreference( tr( "VISU_TITLE_WIDTH" ), posVSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_width" );
- int thv = addPreference( tr( "VISU_TITLE_HEIGHT" ), posVSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_height" );
-
- int lwv = addPreference( tr( "VISU_LABEL_WIDTH" ), posVSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_width" );
- int lhv = addPreference( tr( "VISU_LABEL_HEIGHT" ), posVSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_height" );
-
+ int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
+
+ int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
+
int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
setPreferenceProperty( hv, "min", 0.0 );
setPreferenceProperty( twv, "min", 0 );
setPreferenceProperty( twv, "special", "auto" );
- setPreferenceProperty( thv, "min", 0 );
- setPreferenceProperty( thv, "special", "auto" );
setPreferenceProperty( lwv, "min", 0 );
setPreferenceProperty( lwv, "special", "auto" );
- setPreferenceProperty( lhv, "min", 0 );
- setPreferenceProperty( lhv, "special", "auto" );
setPreferenceProperty( bwv, "min", 0 );
setPreferenceProperty( bwv, "special", "auto" );
setPreferenceProperty( bhv, "min", 0 );
setPreferenceProperty( wv, "max", 1.0 );
setPreferenceProperty( hv, "max", 1.0 );
setPreferenceProperty( twv, "max", 100 );
- setPreferenceProperty( thv, "max", 100 );
setPreferenceProperty( lwv, "max", 100 );
- setPreferenceProperty( lhv, "max", 100 );
setPreferenceProperty( bwv, "max", 100 );
setPreferenceProperty( bhv, "max", 100 );
int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
- int twh = addPreference( tr( "Title width (%)" ), posHSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_width" );
- int thh = addPreference( tr( "Title height (%)" ), posHSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_height" );
-
- int lwh = addPreference( tr( "Label width (%)" ), posHSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_width" );
- int lhh = addPreference( tr( "Label height (%)" ), posHSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_height" );
-
- int bwh = addPreference( tr( "Bar width (%)" ), posHSizeGr,
+ int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
+
+ int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
+
+ int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
- int bhh = addPreference( tr( "Bar height (%)" ), posHSizeGr,
+ int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
setPreferenceProperty( xh, "step", 0.1 );
setPreferenceProperty( hh, "min", 0.0 );
setPreferenceProperty( twh, "min", 0 );
setPreferenceProperty( twh, "special", "auto" );
- setPreferenceProperty( thh, "min", 0 );
- setPreferenceProperty( thh, "special", "auto" );
setPreferenceProperty( lwh, "min", 0 );
setPreferenceProperty( lwh, "special", "auto" );
- setPreferenceProperty( lhh, "min", 0 );
- setPreferenceProperty( lhh, "special", "auto" );
setPreferenceProperty( bwh, "min", 0 );
setPreferenceProperty( bwh, "special", "auto" );
setPreferenceProperty( bhh, "min", 0 );
setPreferenceProperty( wh, "max", 1.0 );
setPreferenceProperty( hh, "max", 1.0 );
setPreferenceProperty( twh, "max", 100 );
- setPreferenceProperty( thh, "max", 100 );
setPreferenceProperty( lwh, "max", 100 );
- setPreferenceProperty( lhh, "max", 100 );
setPreferenceProperty( bwh, "max", 100 );
setPreferenceProperty( bhh, "max", 100 );
float aTol = 1.00000009999999;
QString aWarning;
if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
- sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", sbX1);
- sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", sbW);
+ sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
+ sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
if(sbX1+sbW > aTol){
aWarning = "Origin and Size Vertical: X+Width > 1\n";
sbX1=0.01;
}
}
else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
- sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", sbY1);
- sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",sbH);
+ sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
+ sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
if(sbY1+sbH > aTol){
aWarning = "Origin and Size Vertical: Y+Height > 1\n";
sbY1=0.01;
}
}
else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
- sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", sbX1);
- sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", sbW);
+ sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
+ sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
if(sbX1+sbW > aTol){
aWarning = "Origin and Size Horizontal: X+Width > 1\n";
sbX1=0.2;
}
}
else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
- sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", sbY1);
- sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",sbH);
+ sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
+ sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
if(sbY1+sbH > aTol){
aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
sbY1=0.01;
aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
}
- } else if(b == QString("scalar_bar_label_format")) {
- QString dVal;
- dVal.sprintf(aResourceMgr->stringValue("VISU", "scalar_bar_label_format",dVal).toLatin1().data(), 1.1);
- if(dVal.toDouble() == 0.) {
- aWarning = "Label format is incorrect ";
- aWarning += dVal;
- aWarning += "\n";
- dVal="%-#6.3g";
- aResourceMgr->setValue("VISU", "scalar_bar_label_format", dVal);
- }
- }
+ }
+
if ( !aWarning.isEmpty() ){
aWarning += "The default values are applied instead.";
SUIT_MessageBox::warning(GetDesktop(this),
#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_GaussPoints_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_GaussPointsPL.hxx"
#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "VISU_Convertor.hxx"
{
myVerX = 0.01; myVerY = 0.10; myVerW = 0.10; myVerH = 0.80;
myHorX = 0.20; myHorY = 0.01; myHorW = 0.60; myHorH = 0.12;
- myVerTW = myVerTH = myVerLW = myVerLH = myVerBW = myVerBH = 0;
- myHorTW = myHorTH = myHorLW = myHorLH = myHorBW = myHorBH = 0;
+ myVerTS = myVerLS = myVerBW = myVerBH = 0;
+ myHorTS = myHorLS = myHorBW = myHorBH = 0;
Imin = 0.0; Imax = 0.0;
myRangeMode = -1;
thePrs->GetBarOrientation());
if(RBvert->isChecked()) {
- myVerTW = thePrs->GetTitleWidth();
- myVerTH = thePrs->GetTitleHeight();
- myVerLW = thePrs->GetLabelWidth();
- myVerLH = thePrs->GetLabelHeight();
+ myVerTS = thePrs->GetTitleSize();
+ myVerLS = thePrs->GetLabelSize();
myVerBW = thePrs->GetBarWidth();
myVerBH = thePrs->GetBarHeight();
} else {
- myHorTW = thePrs->GetTitleWidth();
- myHorTH = thePrs->GetTitleHeight();
- myHorLW = thePrs->GetLabelWidth();
- myHorLH = thePrs->GetLabelHeight();
+ myHorTS = thePrs->GetTitleSize();
+ myHorLS = thePrs->GetLabelSize();
myHorBW = thePrs->GetBarWidth();
myHorBH = thePrs->GetBarHeight();
}
- myBarDlg->setLabelsFormat(thePrs->GetLabelsFormat());
+ myBarDlg->setLabelsPrecision( VISU::ToPrecision( thePrs->GetLabelsFormat() ) );
myBarDlg->setUnitsVisible(thePrs->IsUnitsVisible());
SpacingSpin->setValue(thePrs->GetSpacing());
vtkFloatingPointType R, G, B;
thePrs->GetTitleColor(R, G, B);
- myBarDlg->setLabelsFormat(thePrs->GetLabelsFormat());
+ int lp = VISU::ToPrecision( thePrs->GetLabelsFormat() );
+ myBarDlg->setLabelsPrecision( lp );
myBarDlg->setUnitsVisible(thePrs->IsUnitsVisible());
myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
thePrs->SetLabels(LabelSpin->value());
if(RBvert->isChecked()) {
- thePrs->SetRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ thePrs->SetRatios(myVerTS, myVerLS, myVerBW, myVerBH);
} else {
- thePrs->SetRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ thePrs->SetRatios(myHorTS, myHorLS, myHorBW, myHorBH);
}
- thePrs->SetLabelsFormat(myBarDlg->getLabelsFormat().toLatin1().data());
+ std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() );
+ thePrs->SetLabelsFormat( f.c_str() );
thePrs->SetUnitsVisible(myBarDlg->isUnitsVisible());
if (myIsStoreTextProp) {
void VisuGUI_GaussScalarBarPane::onBarPref()
{
if(RBvert->isChecked())
- myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH);
else
- myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH);
if(myBarDlg->exec()) {
if(RBvert->isChecked())
- myBarDlg->getRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->getRatios(myVerTS, myVerLS, myVerBW, myVerBH);
else
- myBarDlg->getRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->getRatios(myHorTS, myHorLS, myHorBW, myHorBH);
}
}
double Imin, Imax;
double myHorX, myHorY, myHorW, myHorH;
double myVerX, myVerY, myVerW, myVerH;
- int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH;
- int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH;
+ int myHorTS, myHorLS, myHorBW, myHorBH;
+ int myVerTS, myVerLS, myVerBW, myVerBH;
int myRangeMode;
bool myIsStoreTextProp;
#include "VISU_ScalarMapAct.h"
#include "VISU_ScalarMap_i.hh"
#include "VISU_Result_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "LightApp_Application.h"
setWindowTitle(tr("TIT_TEXT_PREF"));
setSizeGripEnabled(TRUE);
- QVBoxLayout* TopLayout = new QVBoxLayout(this);
- TopLayout->setSpacing(6);
- TopLayout->setMargin(11);
+ QVBoxLayout* aMainLay = new QVBoxLayout(this);
+ aMainLay->setSpacing(6);
+ aMainLay->setMargin(11);
// "Title" grp
QGroupBox* aTitleGrp = new QGroupBox ( tr("LBL_TITLE"), this);
myTitleFont = new SVTK_FontWidget (aHBox);
aHBLay->addWidget( myTitleFont );
- TopLayout->addWidget(aTitleGrp);
+ aMainLay->addWidget(aTitleGrp);
// "Labels" grp
QGroupBox* aLabelsGrp = new QGroupBox (tr("LBL_LABELS"), this);
myLabelFont = new SVTK_FontWidget (aHBox);
aHBLay->addWidget( myLabelFont );
- TopLayout->addWidget(aLabelsGrp);
+ aMainLay->addWidget(aLabelsGrp);
// Common buttons ===========================================================
QGroupBox* GroupButtons = new QGroupBox( this );
buttonHelp->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonHelp, 0, 3 );
- TopLayout->addWidget( GroupButtons );
+ aMainLay->addWidget( GroupButtons );
connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
Constructor
*/
VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent )
- : QDialog( parent )
+ : QDialog( parent ),
+ myOrientation( 1 )
{
setModal( true );
setWindowTitle( tr( "TIT_BAR_PREF" ) );
QString propertyName = QString( "scalar_bar_vertical_" );
- myTitleWidth = myTitleHeight = myLabelWidth = myLabelHeight = myBarWidth = myBarHeight = 0;
+ myTitleSize = myLabelSize = myBarWidth = myBarHeight = 0;
myUnits = true;
- myUnitsFormat = "%-#6.3g";
+ myPrecision = 3;
- QVBoxLayout* TopLayout = new QVBoxLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
+ QVBoxLayout* aMainLay = new QVBoxLayout( this );
+ aMainLay->setSpacing( 5 );
+ 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->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->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->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->setRange( 0, 100 );
+ myBarHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myBarHeightSpin->setMinimumWidth( 70 );
+ myBarHeightSpin->setValue( 0 );
+ myBarHeightSpin->setSpecialValueText( tr( "AUTO" ) );
+ QLabel* aBarHeightLbl = new QLabel( tr( "LBL_BAR_H" ), aDimGrp );
+
+ // format and units
+
+ QLabel* aPrecLbl = new QLabel( tr( "PRECISION" ), aDimGrp );
+ myPrecisionSpin = new QSpinBox( aDimGrp );
+ myPrecisionSpin->setRange( 1, 100 );
+
+ myUnitsChk = new QCheckBox( tr( "LBL_SHOW_UNITS" ), aDimGrp );
- QGroupBox* WidthHeightGroup = new QGroupBox ( this );
- QGridLayout* WidthHeightGroupLayout = new QGridLayout( WidthHeightGroup );
- WidthHeightGroupLayout->setAlignment( Qt::AlignTop );
- WidthHeightGroupLayout->setSpacing( 6 );
- WidthHeightGroupLayout->setMargin( 11 );
-
- TitleWidthSpin = new QSpinBox( WidthHeightGroup );
- TitleWidthSpin->setRange( 0, 100 );
- TitleWidthSpin->setSingleStep( 1 );
- TitleWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- TitleWidthSpin->setMinimumWidth( 70 );
- TitleWidthSpin->setValue( 0 );
- TitleWidthSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelTitleWidth = new QLabel( tr( "LBL_TITLE_W" ), WidthHeightGroup );
- LabelTitleWidth->setBuddy( TitleWidthSpin );
-
- TitleHeightSpin = new QSpinBox( WidthHeightGroup );
- TitleHeightSpin->setRange( 0, 100 );
- TitleHeightSpin->setSingleStep( 1 );
- TitleHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- TitleHeightSpin->setMinimumWidth( 70 );
- TitleHeightSpin->setValue( 0 );
- TitleHeightSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelTitleHeight = new QLabel( tr( "LBL_TITLE_H" ), WidthHeightGroup );
- LabelTitleHeight->setBuddy( TitleHeightSpin );
-
- CBUnits = new QCheckBox( tr( "LBL_SHOW_UNITS" ), WidthHeightGroup );
- CBUnits->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- LabelWidthSpin = new QSpinBox( WidthHeightGroup );
- LabelWidthSpin->setRange( 0, 100 );
- LabelWidthSpin->setSingleStep( 1 );
- LabelWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- LabelWidthSpin->setMinimumWidth( 70 );
- LabelWidthSpin->setValue( 0 );
- LabelWidthSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelLabelWidth = new QLabel( tr( "LBL_LABEL_W" ), WidthHeightGroup );
- LabelLabelWidth->setBuddy( LabelWidthSpin );
-
- LabelHeightSpin = new QSpinBox( WidthHeightGroup );
- LabelHeightSpin->setRange( 0, 100 );
- LabelHeightSpin->setSingleStep( 1 );
- LabelHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- LabelHeightSpin->setMinimumWidth( 70 );
- LabelHeightSpin->setValue( 0 );
- LabelHeightSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelLabelHeight = new QLabel( tr( "LBL_LABEL_H" ), WidthHeightGroup );
- LabelLabelHeight->setBuddy( LabelHeightSpin );
-
- UnitsEdit = new QLineEdit( WidthHeightGroup );
- UnitsEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- UnitsEdit->setMinimumWidth( 35 );
- UnitsEdit->setText( myUnitsFormat );
- QLabel* UnitsLabel = new QLabel( tr( "LBL_UNITS_FORMAT" ), WidthHeightGroup );
- UnitsLabel->setBuddy( UnitsEdit );
-
- BarWidthSpin = new QSpinBox( WidthHeightGroup );
- BarWidthSpin->setRange( 0, 100 );
- BarWidthSpin->setSingleStep( 1 );
- BarWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- BarWidthSpin->setMinimumWidth( 70 );
- BarWidthSpin->setValue( 0 );
- BarWidthSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelBarWidth = new QLabel( tr( "LBL_BAR_W" ), WidthHeightGroup );
- LabelBarWidth->setBuddy( BarWidthSpin );
-
- BarHeightSpin = new QSpinBox( WidthHeightGroup );
- BarHeightSpin->setRange( 0, 100 );
- BarHeightSpin->setSingleStep( 1 );
- BarHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- BarHeightSpin->setMinimumWidth( 70 );
- BarHeightSpin->setValue( 0 );
- BarHeightSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelBarHeight = new QLabel( tr( "LBL_BAR_H" ), WidthHeightGroup );
- LabelBarHeight->setBuddy( BarHeightSpin );
-
- WidthHeightGroupLayout->addWidget( LabelTitleWidth, 0, 0 );
- WidthHeightGroupLayout->addWidget( TitleWidthSpin, 0, 1 );
- WidthHeightGroupLayout->addWidget( LabelTitleHeight, 0, 2 );
- WidthHeightGroupLayout->addWidget( TitleHeightSpin, 0, 3 );
- WidthHeightGroupLayout->addWidget( CBUnits, 0, 4, 1, 2 );
- WidthHeightGroupLayout->addWidget( LabelLabelWidth, 1, 0 );
- WidthHeightGroupLayout->addWidget( LabelWidthSpin, 1, 1 );
- WidthHeightGroupLayout->addWidget( LabelLabelHeight, 1, 2 );
- WidthHeightGroupLayout->addWidget( LabelHeightSpin, 1, 3 );
- WidthHeightGroupLayout->addWidget( UnitsLabel, 1, 4 );
- WidthHeightGroupLayout->addWidget( UnitsEdit, 1, 5 );
- WidthHeightGroupLayout->addWidget( LabelBarWidth, 2, 0 );
- WidthHeightGroupLayout->addWidget( BarWidthSpin, 2, 1 );
- WidthHeightGroupLayout->addWidget( LabelBarHeight, 2, 2 );
- WidthHeightGroupLayout->addWidget( BarHeightSpin, 2, 3 );
-
- TopLayout->addWidget( WidthHeightGroup );
+ // layout
+
+ aDimGrpLay->addWidget( aTitleSizeLbl, 0, 0 );
+ aDimGrpLay->addWidget( myTitleSizeSpin, 0, 1 );
+ aDimGrpLay->addWidget( aLabelSizeLbl, 0, 2 );
+ aDimGrpLay->addWidget( myLabelSizeSpin, 0, 3 );
+ aDimGrpLay->addWidget( aBarWidthLbl, 1, 0 );
+ aDimGrpLay->addWidget( myBarWidthSpin, 1, 1 );
+ aDimGrpLay->addWidget( aBarHeightLbl, 1, 2 );
+ aDimGrpLay->addWidget( myBarHeightSpin, 1, 3 );
+ aDimGrpLay->addWidget( aPrecLbl, 2, 0 );
+ aDimGrpLay->addWidget( myPrecisionSpin, 2, 1 );
+ aDimGrpLay->addWidget( myUnitsChk, 2, 2, 1, 2 );
+
+ aMainLay->addWidget( aDimGrp );
// Common buttons ===========================================================
+
QGroupBox* GroupButtons = new QGroupBox( this );
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->addWidget( buttonCancel );
GroupButtonsLayout->addWidget( buttonHelp );
- TopLayout->addWidget( GroupButtons );
+ aMainLay->addWidget( GroupButtons );
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
- connect( TitleWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( TitleHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( LabelWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( LabelHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( BarWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( BarHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( CBUnits, SIGNAL( toggled( bool ) ), this, SIGNAL( updatePreview() ) );
- connect( UnitsEdit, SIGNAL( editingFinished() ), this, SIGNAL( updatePreview() ) );
+ connect( myTitleSizeSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
+ connect( myLabelSizeSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
+ connect( myBarWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
+ connect( myBarHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
+ connect( myUnitsChk, SIGNAL( toggled( bool ) ), this, SIGNAL( updatePreview() ) );
+ connect( myPrecisionSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
}
//----------------------------------------------------------------------------
-void VisuGUI_BarPrefDlg::setRatios( int titleRatioWidth, int titleRatioHeight,
- int labelRatioWidth, int labelRatioHeight,
- int barRatioWidth, int barRatioHeight )
+void VisuGUI_BarPrefDlg::setRatios( int titleRatioSize, int labelRatioWidth,
+ int barRatioWidth, int barRatioHeight )
{
- TitleWidthSpin->setValue( myTitleWidth = titleRatioWidth );
- TitleHeightSpin->setValue( myTitleHeight = titleRatioHeight );
- LabelWidthSpin->setValue( myLabelWidth = labelRatioWidth );
- LabelHeightSpin->setValue( myLabelHeight = labelRatioHeight );
- BarWidthSpin->setValue( myBarWidth = barRatioWidth );
- BarHeightSpin->setValue( myBarHeight = barRatioHeight );
+ myTitleSizeSpin->setValue( myTitleSize = titleRatioSize );
+ myLabelSizeSpin->setValue( myLabelSize = labelRatioWidth );
+ myBarWidthSpin->setValue( myBarWidth = barRatioWidth );
+ myBarHeightSpin->setValue( myBarHeight = barRatioHeight );
}
//----------------------------------------------------------------------------
-void VisuGUI_BarPrefDlg::getRatios( int& titleRatioWidth, int& titleRatioHeight,
- int& labelRatioWidth, int& labelRatioHeight,
- int& barRatioWidth, int& barRatioHeight )
+void VisuGUI_BarPrefDlg::getRatios( int& titleRatioSize, int& labelRatioWidth,
+ int& barRatioWidth, int& barRatioHeight )
{
- titleRatioWidth = TitleWidthSpin->value();
- titleRatioHeight = TitleHeightSpin->value();
- labelRatioWidth = LabelWidthSpin->value();
- labelRatioHeight = LabelHeightSpin->value();
- barRatioWidth = BarWidthSpin->value();
- barRatioHeight = BarHeightSpin->value();
+ titleRatioSize = myTitleSizeSpin->value();
+ labelRatioWidth = myLabelSizeSpin->value();
+ barRatioWidth = myBarWidthSpin->value();
+ barRatioHeight = myBarHeightSpin->value();
}
//----------------------------------------------------------------------------
-void VisuGUI_BarPrefDlg::setLabelsFormat( const QString& format )
+void VisuGUI_BarPrefDlg::setLabelsPrecision( const int p )
{
- UnitsEdit->setText( myUnitsFormat = format );
+ myPrecisionSpin->setValue( p );
}
+//----------------------------------------------------------------------------
+int VisuGUI_BarPrefDlg::getLabelsPrecision() const
+{
+ return myPrecisionSpin->value();
+}
//----------------------------------------------------------------------------
-QString VisuGUI_BarPrefDlg::getLabelsFormat()
+void VisuGUI_BarPrefDlg::setOrientation( const int ori )
{
- return UnitsEdit->text();
+ myOrientation = ori;
}
+//----------------------------------------------------------------------------
+
+int VisuGUI_BarPrefDlg::getOrientation() const
+{
+ return myOrientation;
+}
//----------------------------------------------------------------------------
void VisuGUI_BarPrefDlg::onHelp()
//----------------------------------------------------------------------------
void VisuGUI_BarPrefDlg::setUnitsVisible(bool isVisible)
{
- CBUnits->setChecked( myUnits = isVisible );
+ myUnitsChk->setChecked( myUnits = isVisible );
}
//----------------------------------------------------------------------------
bool VisuGUI_BarPrefDlg::isUnitsVisible()
{
- return CBUnits->isChecked();
+ return myUnitsChk->isChecked();
}
*/
void VisuGUI_BarPrefDlg::reject()
{
- TitleWidthSpin->setValue( myTitleWidth );
- TitleHeightSpin->setValue( myTitleHeight );
- LabelWidthSpin->setValue( myLabelWidth );
- LabelHeightSpin->setValue( myLabelHeight );
- BarWidthSpin->setValue( myBarWidth );
- BarHeightSpin->setValue( myBarHeight );
- CBUnits->setChecked( myUnits );
- UnitsEdit->setText( myUnitsFormat );
+ myTitleSizeSpin->setValue( myTitleSize );
+ myLabelSizeSpin->setValue( myLabelSize );
+ myBarWidthSpin->setValue( myBarWidth );
+ myBarHeightSpin->setValue( myBarHeight );
+ myUnitsChk->setChecked( myUnits );
+ myPrecisionSpin->setValue( myPrecision );
QDialog::reject();
}
void VisuGUI_BarPrefDlg::accept()
{
QString dVal;
- dVal.sprintf( UnitsEdit->text().toLatin1().data(), 1.1 );
- if ( dVal.toDouble() == 0. ) {
- SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr ( "MSG_LABEL_FORMAT" ) );
+ int aBWH = myOrientation == 1 ? myBarWidthSpin->value() : myBarHeightSpin->value();
+ if( ( myLabelSizeSpin->value()+ aBWH ) > 100 )
+ {
+ SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE" ) );
+ return;
}
- else {
- if(
- (
- TitleWidthSpin->value()+
- LabelWidthSpin->value()+
- BarWidthSpin->value()
- > 100
- ) ||
- (
- TitleHeightSpin->value()+
- LabelHeightSpin->value()+
- BarHeightSpin->value()
- > 100
- )
- ) {
- SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE" ) );
- }
- else {
- myTitleWidth = TitleWidthSpin->value();
- myTitleHeight = TitleHeightSpin->value();
- myLabelWidth = LabelWidthSpin->value();
- myLabelHeight = LabelHeightSpin->value();
- myBarWidth = BarWidthSpin->value();
- myBarHeight = BarHeightSpin->value();
- myUnits = CBUnits->isChecked();
- myUnitsFormat = UnitsEdit->text();
- QDialog::accept();
- }
+
+ 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();
+ myBarHeight = myBarHeightSpin->value();
+ myUnits = myUnitsChk->isChecked();
+ myPrecision = myPrecisionSpin->value();
+ QDialog::accept();
}
myVerY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
myVerW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
myVerH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
- myVerTW = aResourceMgr->integerValue("VISU", propertyName + "title_width", 0);
- myVerTH = aResourceMgr->integerValue("VISU", propertyName + "title_height",0);
- myVerLW = aResourceMgr->integerValue("VISU", propertyName + "label_width", 0);
- myVerLH = aResourceMgr->integerValue("VISU", propertyName + "label_height",0);
+ myVerTS = aResourceMgr->integerValue("VISU", propertyName + "title_size", 0);
+ myVerLS = aResourceMgr->integerValue("VISU", propertyName + "label_size", 0);
myVerBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0);
myVerBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0);
myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
- myHorTW = aResourceMgr->integerValue("VISU", propertyName + "title_width", 0);
- myHorTH = aResourceMgr->integerValue("VISU", propertyName + "title_height",0);
- myHorLW = aResourceMgr->integerValue("VISU", propertyName + "label_width", 0);
- myHorLH = aResourceMgr->integerValue("VISU", propertyName + "label_height",0);
+ myHorTS = aResourceMgr->integerValue("VISU", propertyName + "title_size", 0);
+ myHorLS = aResourceMgr->integerValue("VISU", propertyName + "label_size", 0);
myHorBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0);
myHorBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0);
}
if(RBvert->isChecked()) {
- myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH);
} else {
- myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH);
}
- myBarDlg->setLabelsFormat(aResourceMgr->stringValue("VISU", propertyName + "label_format", "%-#6.3g"));
+ 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 ===========================================
myScalarMap->GetBarOrientation());
if(RBvert->isChecked()) {
- myVerTW = myScalarMap->GetTitleWidth();
- myVerTH = myScalarMap->GetTitleHeight();
- myVerLW = myScalarMap->GetLabelWidth();
- myVerLH = myScalarMap->GetLabelHeight();
+ myVerTS = myScalarMap->GetTitleSize();
+ myVerLS = myScalarMap->GetLabelSize();
myVerBW = myScalarMap->GetBarWidth();
myVerBH = myScalarMap->GetBarHeight();
- myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH);
} else {
- myHorTW = myScalarMap->GetTitleWidth();
- myHorTH = myScalarMap->GetTitleHeight();
- myHorLW = myScalarMap->GetLabelWidth();
- myHorLH = myScalarMap->GetLabelHeight();
+ myHorTS = myScalarMap->GetTitleSize();
+ myHorLS = myScalarMap->GetLabelSize();
myHorBW = myScalarMap->GetBarWidth();
myHorBH = myScalarMap->GetBarHeight();
- myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH);
}
- myBarDlg->setLabelsFormat(myScalarMap->GetLabelsFormat());
+ myBarDlg->setLabelsPrecision( VISU::ToPrecision( myScalarMap->GetLabelsFormat() ) );
myBarDlg->setUnitsVisible(myScalarMap->IsUnitsVisible());
vtkFloatingPointType R, G, B;
(isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
(isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
- int VerTW, VerTH, VerLW, VerLH, VerBW, VerBH;
- myBarDlg->getRatios(VerTW, VerTH, VerLW, VerLH, VerBW, VerBH);
- aScalarBarActor->SetRatios(VerTW, VerTH, VerLW, VerLH, VerBW, VerBH);
+ int VerTS, VerTH, VerLS, VerBW, VerBH;
+ myBarDlg->getRatios(VerTS, VerLS, VerBW, VerBH);
+ aScalarBarActor->SetRatios(VerTS, VerLS, VerBW, VerBH);
- aScalarBarActor->SetLabelFormat(myBarDlg->getLabelsFormat().toLatin1().data());
+ std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() );
+ aScalarBarActor->SetLabelFormat( f.c_str() );
aScalarBarActor->Modified();
myScalarMap->SetPosition(XSpin->value(), YSpin->value());
myScalarMap->SetSize(WidthSpin->value(), HeightSpin->value());
if(RBvert->isChecked()) {
- myScalarMap->SetRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myScalarMap->SetRatios(myVerTS, myVerLS, myVerBW, myVerBH);
} else {
- myScalarMap->SetRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myScalarMap->SetRatios(myHorTS, myHorLS, myHorBW, myHorBH);
}
- myScalarMap->SetLabelsFormat(myBarDlg->getLabelsFormat().toLatin1().data());
+ std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() );
+ myScalarMap->SetLabelsFormat( f.c_str() );
myScalarMap->SetUnitsVisible(myBarDlg->isUnitsVisible());
myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3dBase::VERTICAL : VISU::ColoredPrs3dBase::HORIZONTAL);
void VisuGUI_ScalarBarPane::onBarPref()
{
if(RBvert->isChecked())
- myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH);
else
- myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH);
+ myBarDlg->setOrientation( getOrientation() );
if(myBarDlg->exec()) {
if(RBvert->isChecked())
- myBarDlg->getRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->getRatios(myVerTS, myVerLS, myVerBW, myVerBH);
else
- myBarDlg->getRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->getRatios(myHorTS, myHorLS, myHorBW, myHorBH);
updatePreview();
}
}
VisuGUI_BarPrefDlg (QWidget* parent);
~VisuGUI_BarPrefDlg() {};
- void setRatios(int titleRatioWidth, int titleRatioHeight,
- int labelRatioWidth, int labelRatioHeight,
+ void setRatios(int titleRatioSize, int labelRatioWidth,
int barRatioWidth, int barRatioHeight);
- void getRatios(int& titleRatioWidth, int& titleRatioHeight,
- int& labelRatioWidth, int& labelRatioHeight,
+ void getRatios(int& titleRatioSize, int& labelRatioWidth,
int& barRatioWidth, int& barRatioHeight);
void setUnitsVisible(bool isVisible);
bool isUnitsVisible();
- void setLabelsFormat( const QString& format);
- QString getLabelsFormat();
+ void setLabelsPrecision( const int p );
+ int getLabelsPrecision() const;
+
+ void setOrientation( const int ori );
+ int getOrientation() const;
+
private:
void keyPressEvent( QKeyEvent* e );
void onHelp();
protected:
- QSpinBox* TitleWidthSpin;
- QSpinBox* TitleHeightSpin;
- QSpinBox* LabelWidthSpin;
- QSpinBox* LabelHeightSpin;
- QSpinBox* BarWidthSpin;
- QSpinBox* BarHeightSpin;
- QCheckBox* CBUnits;
- QLineEdit* UnitsEdit;
-
- int myTitleWidth;
- int myTitleHeight;
- int myLabelWidth;
- int myLabelHeight;
+ QSpinBox* myTitleSizeSpin;
+ QSpinBox* myLabelSizeSpin;
+ QSpinBox* myBarWidthSpin;
+ QSpinBox* myBarHeightSpin;
+ QCheckBox* myUnitsChk;
+ QSpinBox* myPrecisionSpin;
+
+ int myTitleSize;
+ int myLabelSize;
int myBarWidth;
int myBarHeight;
bool myUnits;
- QString myUnitsFormat;
+ int myPrecision;
+ int myOrientation;
};
double myHorX, myHorY, myHorW, myHorH;
double myVerX, myVerY, myVerW, myVerH;
- int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH;
- int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH;
+ int myHorTS, myHorLS, myHorBW, myHorBH;
+ int myVerTS, myVerTH, myVerLS, myVerBW, myVerBH;
bool myIsStoreTextProp;
private slots:
#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_ViewManager_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include <SVTK_ViewWindow.h>
#include <SALOME_Actor.h>
myVerY = aResourceMgr->doubleValue( "VISU", propertyName + "y", 0. );
myVerW = aResourceMgr->doubleValue( "VISU", propertyName + "width", 0. );
myVerH = aResourceMgr->doubleValue( "VISU", propertyName + "height", 0. );
- myVerTW = aResourceMgr->integerValue( "VISU", propertyName + "title_width", 0 );
- myVerTH = aResourceMgr->integerValue( "VISU", propertyName + "title_height", 0 );
- myVerLW = aResourceMgr->integerValue( "VISU", propertyName + "label_width", 0 );
- myVerLH = aResourceMgr->integerValue( "VISU", propertyName + "label_height", 0 );
+ myVerTS = aResourceMgr->integerValue( "VISU", propertyName + "title_size", 0 );
+ myVerLS = aResourceMgr->integerValue( "VISU", propertyName + "label_size", 0 );
myVerBW = aResourceMgr->integerValue( "VISU", propertyName + "bar_width", 0 );
myVerBH = aResourceMgr->integerValue( "VISU", propertyName + "bar_height", 0 );
myHorY = aResourceMgr->doubleValue( "VISU", propertyName + "y", 0. );
myHorW = aResourceMgr->doubleValue( "VISU", propertyName + "width", 0. );
myHorH = aResourceMgr->doubleValue( "VISU", propertyName + "height", 0. );
- myHorTW = aResourceMgr->integerValue( "VISU", propertyName + "title_width", 0 );
- myHorTH = aResourceMgr->integerValue( "VISU", propertyName + "title_height", 0 );
- myHorLW = aResourceMgr->integerValue( "VISU", propertyName + "label_width", 0 );
- myHorLH = aResourceMgr->integerValue( "VISU", propertyName + "label_height", 0 );
+ myHorTS = aResourceMgr->integerValue( "VISU", propertyName + "title_size", 0 );
+ myHorLS = aResourceMgr->integerValue( "VISU", propertyName + "label_size", 0 );
myHorBW = aResourceMgr->integerValue( "VISU", propertyName + "bar_width", 0 );
myHorBH = aResourceMgr->integerValue( "VISU", propertyName + "bar_height", 0 );
myBarDlg = new VisuGUI_BarPrefDlg( this );
if ( RBvert->isChecked() ) {
- myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ myBarDlg->setRatios( myVerTS, myVerLS, myVerBW, myVerBH );
} else {
- myBarDlg->setRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH );
+ myBarDlg->setRatios( myHorTS, myHorLS, myHorBW, myHorBH );
}
- myBarDlg->setLabelsFormat( aResourceMgr->stringValue( "VISU", propertyName + "label_format", "%-#6.3g" ) );
+ 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 ===========================================
void VisuGUI_TableScalarBarPane::onBarPref()
{
if ( RBvert->isChecked() )
- myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ myBarDlg->setRatios( myVerTS, myVerLS, myVerBW, myVerBH );
else
- myBarDlg->setRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH );
+ myBarDlg->setRatios( myHorTS, myHorLS, myHorBW, myHorBH );
if ( myBarDlg->exec() ) {
if ( RBvert->isChecked() )
- myBarDlg->getRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ myBarDlg->getRatios( myVerTS, myVerLS, myVerBW, myVerBH );
else
- myBarDlg->getRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH );
+ myBarDlg->getRatios( myHorTS, myHorLS, myHorBW, myHorBH );
}
}
myBarPrs->GetHeight(),
myBarPrs->GetBarOrientation() );
- myVerTW = myBarPrs->GetTitleWidth();
- myVerTH = myBarPrs->GetTitleHeight();
- myVerLW = myBarPrs->GetLabelWidth();
- myVerLH = myBarPrs->GetLabelHeight();
+ myVerTS = myBarPrs->GetTitleSize();
+ myVerLS = myBarPrs->GetLabelSize();
myVerBW = myBarPrs->GetBarWidth();
myVerBH = myBarPrs->GetBarHeight();
- myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ myBarDlg->setRatios( myVerTS, myVerLS, myVerBW, myVerBH );
- myBarDlg->setLabelsFormat( myBarPrs->GetLabelsFormat() );
+ myBarDlg->setLabelsPrecision( VISU::ToPrecision( myBarPrs->GetLabelsFormat() ) );
myBarDlg->setUnitsVisible( myBarPrs->IsUnitsVisible() );
myTextDlg->myTitleFont->SetData( QColor( (int)(R*255.), (int)(G*255.), (int)(B*255.) ),
myBarPrs->SetPosition( XSpin->value(), YSpin->value() );
myBarPrs->SetSize( WidthSpin->value(), HeightSpin->value() );
- myBarPrs->SetRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ if(RBvert->isChecked()) {
+ myBarPrs->SetRatios(myVerTS, myVerLS, myVerBW, myVerBH);
+ } else {
+ myBarPrs->SetRatios(myHorTS, myHorLS, myHorBW, myHorBH);
+ }
- myBarPrs->SetLabelsFormat( myBarDlg->getLabelsFormat().toLatin1().constData() );
+ std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() );
+ myBarPrs->SetLabelsFormat( f.c_str() );
myBarPrs->SetUnitsVisible( myBarDlg->isUnitsVisible() );
myBarPrs->SetBarOrientation( ( RBvert->isChecked() )? VISU::ColoredPrs3dBase::VERTICAL : VISU::ColoredPrs3dBase::HORIZONTAL );
double myHorX, myHorY, myHorW, myHorH;
double myVerX, myVerY, myVerW, myVerH;
- int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH;
- int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH;
+ int myHorTS, myHorLS, myHorBW, myHorBH;
+ int myVerTS, myVerLS, myVerBW, myVerBH;
bool myIsStoreTextProp;
std::string myTitle;