From: dmv Date: Wed, 18 Jun 2008 13:16:23 +0000 (+0000) Subject: IPAL 18208 Scale Factor changes value after Tab or Ok X-Git-Tag: V4_1_0_maintainance_20080620~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bc31b721a1327061ddedd866baf94f29100d7387;p=modules%2Fvisu.git IPAL 18208 Scale Factor changes value after Tab or Ok --- diff --git a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx index 7fc9b209..f66ae75e 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx +++ b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx @@ -94,7 +94,11 @@ VisuGUI_DeformedShapeAndScalarMapDlg::VisuGUI_DeformedShapeAndScalarMapDlg (Salo ScalFact = new QtxDblSpinBox (0.0, 1.0E+38, 0.1, TopGroup); ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - ScalFact->setPrecision(38); + + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ); + + ScalFact->setPrecision( aPrecision*(-1) ); ScalFact->setValue(0.1); TopGroupLayout->addWidget(ScalFact, 0, 1); @@ -273,6 +277,22 @@ void VisuGUI_DeformedShapeAndScalarMapDlg::initFromPrsObject( VISU::ColoredPrs3d myTabBox->setCurrentPage( 0 ); } +void VisuGUI_DeformedShapeAndScalarMapDlg::setFactor(double theFactor) +{ + double i=0.1; + while (1) { // Calculate Step & Precission + if ( int (theFactor/i) > 0) + break; + else { + i = i*0.1; + } + } + + ScalFact->setLineStep(i); + + ScalFact->setValue(theFactor); +} + int VisuGUI_DeformedShapeAndScalarMapDlg ::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) diff --git a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h index c0dcdb9e..81033adf 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h +++ b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h @@ -63,8 +63,7 @@ public: double getFactor() { return ScalFact->value(); } - void setFactor(double theFactor) - { ScalFact->setValue(theFactor); } + void setFactor(double theFactor); virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, bool theInit ); diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx index 5db7ab0d..ae92e5b3 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx @@ -84,7 +84,11 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule) ScalFact = new QtxDblSpinBox (0.0, 1.0E+38, 0.1, TopGroup); ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - ScalFact->setPrecision(38); + + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ); + + ScalFact->setPrecision( aPrecision*(-1) ); ScalFact->setValue(0.1); TopGroupLayout->addWidget(ScalFact, 0, 1); @@ -136,7 +140,7 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule) // signals and slots connections connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(onApply())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(onApply())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); } @@ -162,6 +166,22 @@ void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, myTabBox->setCurrentPage(0); } +void VisuGUI_DeformedShapeDlg::setFactor(double theFactor) +{ + double i=0.1; + while (1) { // Calculate Step & Precission + if ( int (theFactor/i) > 0) + break; + else { + i = i*0.1; + } + } + + ScalFact->setLineStep(i); + + ScalFact->setValue(theFactor); +} + int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) { if( !isValid() ) @@ -171,6 +191,7 @@ int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy ); myPrsCopy->SetScale(getFactor()); + myPrsCopy->ShowColored(isColored()); VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.h b/src/VISUGUI/VisuGUI_DeformedShapeDlg.h index 60b4c272..1e8c3c85 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeDlg.h +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.h @@ -59,8 +59,8 @@ public: double getFactor() { return ScalFact->value(); } - void setFactor(double theFactor) - { ScalFact->setValue(theFactor); } + void setFactor(double theFactor); + // { ScalFact->setValue(theFactor); } bool isColored() { return UseMagn->isChecked(); } diff --git a/src/VISUGUI/VisuGUI_VectorsDlg.cxx b/src/VISUGUI/VisuGUI_VectorsDlg.cxx index 9a92656d..e747a03a 100644 --- a/src/VISUGUI/VisuGUI_VectorsDlg.cxx +++ b/src/VISUGUI/VisuGUI_VectorsDlg.cxx @@ -79,7 +79,11 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule) ScaleLabel = new QLabel (tr("LBL_SCALE_FACTOR"), TopGroup, "ScaleLabel"); ScalFact = new QtxDblSpinBox( 1e-20, 1.0E+38, 0.1, TopGroup ); - ScalFact->setPrecision( 5 ); + + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ); + + ScalFact->setPrecision( aPrecision*(-1) ); ScalFact->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); ScalFact->setValue( 0.1 ); @@ -294,9 +298,20 @@ void VisuGUI_VectorsDlg::setVColor() /*! Sets Scale factor */ -void VisuGUI_VectorsDlg::setScaleFactor( double sf ) +void VisuGUI_VectorsDlg::setScaleFactor( double theFactor ) { - ScalFact->setValue( sf ); + double i=0.1; + while (1) { // Calculate Step & Precission + if ( int (theFactor/i) > 0) + break; + else { + i = i*0.1; + } + } + + ScalFact->setLineStep(i); + + ScalFact->setValue( theFactor ); } /*!