Salome HOME
Merge branch V7_3_1_BR
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index 9bf90fde22d4ba924b749357c9087be6a7463805..336363ecbc9e3f52393352a1d2f9df01d8c32f21 100644 (file)
 // of auto-color picking up
 #define SIMPLE_AUTOCOLOR
 
-// REMOVE the code about MPLMathText_Disabler if it does not complite at porting to ParaView-4.1
-#include <vtkMatplotlibMathTextUtilities.h>
-namespace
-{
-  // Creation of this class disables vtkMatplotlibMathTextUtilities
-  struct MPLMathText_Disabler : protected vtkMatplotlibMathTextUtilities
-  {
-    MPLMathText_Disabler()
-    {
-      vtkMatplotlibMathTextUtilities::MPLMathTextAvailable =
-        vtkMatplotlibMathTextUtilities::UNAVAILABLE;
-    }
-  };
-} 
-
 namespace
 {
   // Declarations
@@ -1316,7 +1301,7 @@ namespace
         int deltaF = 0, deltaV = 0;
         int elem0dSize   = 1;
         int ballSize     = 1;
-        int ballScale    = 1;
+        double ballScale = 1.0;
         int edgeWidth    = 1;
         int outlineWidth = 1;
         double shrinkCoef = 0.0;
@@ -1361,7 +1346,7 @@ namespace
             anActor->GetBallColor( color[0], color[1], color[2] );
             ballColor.setRgbF( color[0], color[1], color[2] );
             ballSize = qMax( (int)anActor->GetBallSize(), 1 ); // minimum allowed size is 1
-            ballScale = qMax( (int)anActor->GetBallScale(), 1 ); // minimum allowed size is 1
+            ballScale = qMax( (double)anActor->GetBallScale(), 1e-2 ); // minimum allowed scale is 1e-2
             // outlines: color
             anActor->GetOutlineColor( color[0], color[1], color[2] );
             outlineColor.setRgbF( color[0], color[1], color[2] );
@@ -1979,8 +1964,6 @@ SalomeApp_Module( "SMESH" )
 
   /* load resources for all available meshers */
   SMESH::InitAvailableHypotheses();
-
-  MPLMathText_Disabler d; // disable vtkMatplotlibMathTextUtilities
 }
 
 //=============================================================================
@@ -5058,8 +5041,8 @@ void SMESHGUI::createPreferences()
                              LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
   int ballSize = addPreference(tr("PREF_BALL_SIZE"), elemGroup,
                              LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size");
-  int ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup,
-                             LightApp_Preferences::IntSpin, "SMESH", "ball_elem_scale");
+  double ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup,
+                             LightApp_Preferences::DblSpin, "SMESH", "ball_elem_scale");
   int elemW  = addPreference(tr("PREF_WIDTH"), elemGroup,
                              LightApp_Preferences::IntSpin, "SMESH", "element_width");
   int outW  = addPreference(tr("PREF_OUTLINE_WIDTH"), elemGroup,
@@ -5073,8 +5056,9 @@ void SMESHGUI::createPreferences()
   setPreferenceProperty( ballSize, "min", 1 );
   setPreferenceProperty( ballSize, "max", 10 );
 
-  setPreferenceProperty( ballScale, "min", 1 );
-  setPreferenceProperty( ballScale, "max", 10 );
+  setPreferenceProperty( ballScale, "min", 1e-2 );
+  setPreferenceProperty( ballScale, "max", 1e7 );
+  setPreferenceProperty( ballScale, "step", 0.5 );
 
   setPreferenceProperty( elemW, "min", 1 );
   setPreferenceProperty( elemW, "max", 5 );
@@ -5748,7 +5732,7 @@ void SMESHGUI::storeVisualParameters (int savePoint)
                   sizeStr << QString::number((int)aSmeshActor->Get0DSize());
                   sizeStr << "ball";
                   sizeStr << QString::number((int)aSmeshActor->GetBallSize());
-                  sizeStr << QString::number((int)aSmeshActor->GetBallScale());
+                  sizeStr << QString::number((double)aSmeshActor->GetBallScale());
                   sizeStr << "shrink";
                   sizeStr << QString::number(aSmeshActor->GetShrinkFactor());
                   sizeStr << "orientation";
@@ -6333,7 +6317,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
               int outlineWidth = -1;
               int elem0dSize = -1;
               int ballSize = -1;
-              int ballScale = -1;
+              double ballScale = -1.0;
               double shrinkSize = -1;
               double orientationSize = -1;
               bool orientation3d = false;
@@ -6363,11 +6347,11 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
                 else if ( type == "ball" ) {
                   // balls are specified by two values: size:scale, where
                   // - size - is a integer value specifying size
-                  // - scale - is a integer value specifying scale factor
-                  if ( i+1 >= sizes.count() ) break;                    // format error
-                  int v1 = sizes[i+1].toInt( &bOk ); if ( !bOk ) break;  // format error
-                  if ( i+2 >= sizes.count() ) break;                          // format error
-                  int v2 = sizes[i+2].toInt( &bOk ); if ( !bOk ) break;       // format error
+                  // - scale - is a double value specifying scale factor
+                  if ( i+1 >= sizes.count() ) break;                       // format error
+                  int v1 = sizes[i+1].toInt( &bOk ); if ( !bOk ) break;    // format error
+                  if ( i+2 >= sizes.count() ) break;                       // format error
+                  double v2 = sizes[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
                   ballSize = v1;
                   ballScale = v2;
                   i += 2;
@@ -6407,7 +6391,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
               if ( ballSize > 0 )
                 aSmeshActor->SetBallSize( ballSize );
               // ball scale
-              if ( ballScale > 0 )
+              if ( ballScale > 0.0 )
                 aSmeshActor->SetBallScale( ballScale );
               // shrink factor
               if ( shrinkSize > 0 )