]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
This commit was generated by cvs2git to create tag 'V4_1_4sp1'. V4_1_4sp1
authoradmin <salome-admin@opencascade.com>
Tue, 16 Dec 2008 09:55:13 +0000 (09:55 +0000)
committeradmin <salome-admin@opencascade.com>
Tue, 16 Dec 2008 09:55:13 +0000 (09:55 +0000)
Sprout from V4_1_0_maintainance 2008-12-01 12:38:14 UTC vsr <vsr@opencascade.com> 'Update copyright information'
Cherrypick from V4_1_0_maintainance 2008-12-16 09:55:12 UTC jfa <jfa@opencascade.com> 'Bug 0020075: EDF VISU 905: Impossible to create a deformed shape.':
    src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx

src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx

index e1042f3bf8a60e754172546041c0b44e7164244d..e110c16e68d4482f2314a5d558634758bc91a7f4 100644 (file)
@@ -47,6 +47,8 @@
 #include <qlayout.h>
 #include <qtabwidget.h>
 
+//#include <math.h>
+
 using namespace std;
 
 /*!
@@ -167,19 +169,18 @@ void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs,
 
 void VisuGUI_DeformedShapeDlg::setFactor(double theFactor)
 {
-  double i=0.1;
-  if(theFactor!=0) {
-    while (1) { // Calculate Step & Precission
-      if ( int (theFactor/i) > 0)
-        break;
-      else {
-        i = i*0.1;
-      }
+  double step = 0.1;
+  if (fabs(theFactor) > numeric_limits<double>::epsilon()) {
+    int degree = int(log10(fabs(theFactor))) - 1;
+    if (fabs(theFactor) < 1) {
+      // as logarithm value is negative in this case
+      // and it is truncated to the bigger integer
+      degree -= 1;
     }
+    step = pow(10., double(degree));
   }
 
-  ScalFact->setLineStep(i);
-
+  ScalFact->setLineStep(step);
   ScalFact->setValue(theFactor);
 }