]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
IPAL 18208 Scale Factor changes value after Tab or Ok
authordmv <dmv@opencascade.com>
Wed, 18 Jun 2008 13:16:23 +0000 (13:16 +0000)
committerdmv <dmv@opencascade.com>
Wed, 18 Jun 2008 13:16:23 +0000 (13:16 +0000)
src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx
src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h
src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_DeformedShapeDlg.h
src/VISUGUI/VisuGUI_VectorsDlg.cxx

index 7fc9b209b89a2ab4338b9544f37bbdd55087da36..f66ae75ee84fbcc046b6a4c73b7375ad5638136e 100644 (file)
@@ -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)
index c0dcdb9e99e1e11d84e573915e5008e4c516292b..81033adff86028200b99a08de91435c99786515b 100644 (file)
@@ -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 );
index 5db7ab0dfeefcdfdafc5fcc9c76462dfff406991..ae92e5b3d44bac5cbf3186d75c266faee37569ab 100644 (file)
@@ -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<VISU::TDEFORMEDSHAPE>().Copy(myPrsCopy, thePrs);
index 60b4c272a8cc5fc48338cbaab0a82e9322f77524..1e8c3c85896ffdd3100ba74dc5af95537f22a4e7 100644 (file)
@@ -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(); }
index 9a92656d62fb3579d7dbd32f35187684b869d05b..e747a03a8f356a6115cc8e3089e682f14a50da96 100644 (file)
@@ -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 );
 }
 
 /*!