]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Bug 0020075: EDF VISU 905: Impossible to create a deformed shape.
authorjfa <jfa@opencascade.com>
Tue, 16 Dec 2008 08:48:26 +0000 (08:48 +0000)
committerjfa <jfa@opencascade.com>
Tue, 16 Dec 2008 08:48:26 +0000 (08:48 +0000)
src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx

index e1042f3bf8a60e754172546041c0b44e7164244d..5dc0536e23ace608078467b0176f7bf71f39395d 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, degree);
   }
 
-  ScalFact->setLineStep(i);
-
+  ScalFact->setLineStep(step);
   ScalFact->setValue(theFactor);
 }