Salome HOME
Correction of mistakes: 0022479: EDF 2823 SMESH: Add "multiplier" coefficient for...
authormpa <mpa@opencascade.com>
Wed, 2 Apr 2014 06:09:25 +0000 (10:09 +0400)
committermpa <mpa@opencascade.com>
Wed, 2 Apr 2014 06:09:25 +0000 (10:09 +0400)
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_ActorDef.h
src/OBJECT/SMESH_DeviceActor.cxx
src/OBJECT/SMESH_DeviceActor.h
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx
src/SMESHGUI/SMESHGUI_PropertiesDlg.h

index 8cc3716b15d715ca539cc3ba5c5ba4c288e2a351..20582c7b15e86b08b563136643caef13ca732414 100644 (file)
@@ -145,7 +145,7 @@ SMESH_ActorDef::SMESH_ActorDef()
 
   double aElem0DSize    = SMESH::GetFloat("SMESH:elem0d_size",5);
   double aBallElemSize  = SMESH::GetFloat("SMESH:ball_elem_size",10);
 
   double aElem0DSize    = SMESH::GetFloat("SMESH:elem0d_size",5);
   double aBallElemSize  = SMESH::GetFloat("SMESH:ball_elem_size",10);
-  double aBallElemScale = SMESH::GetFloat("SMESH:ball_elem_scale",1);
+  double aBallElemScale = SMESH::GetFloat("SMESH:ball_elem_scale",1.0);
   double aLineWidth     = SMESH::GetFloat("SMESH:element_width",1);
   double aOutlineWidth  = SMESH::GetFloat("SMESH:outline_width",1);
 
   double aLineWidth     = SMESH::GetFloat("SMESH:element_width",1);
   double aOutlineWidth  = SMESH::GetFloat("SMESH:outline_width",1);
 
@@ -2108,12 +2108,12 @@ double SMESH_ActorDef::GetBallSize(){
   return myBallProp->GetPointSize();
 }
 
   return myBallProp->GetPointSize();
 }
 
-int SMESH_ActorDef::GetBallScale()
+double SMESH_ActorDef::GetBallScale()
 {
   return myBallActor->GetBallScale();
 }
 
 {
   return myBallActor->GetBallScale();
 }
 
-void SMESH_ActorDef::SetBallScale( int theVal )
+void SMESH_ActorDef::SetBallScale( double theVal )
 {
   myBallActor->SetBallScale( theVal );
 }
 {
   myBallActor->SetBallScale( theVal );
 }
index f882abc715f2a52d69d0298569e31643194f0b18..2688e99a60358ebf295a48a9f14df8d985a0d851 100644 (file)
@@ -101,8 +101,8 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
   virtual void SetBallSize(double size) = 0;
   virtual double GetBallSize() = 0;
 
   virtual void SetBallSize(double size) = 0;
   virtual double GetBallSize() = 0;
 
-  virtual void SetBallScale(int size) = 0;
-  virtual int GetBallScale() = 0;
+  virtual void SetBallScale(double size) = 0;
+  virtual double GetBallScale() = 0;
 
   enum EReperesent { ePoint, eEdge, eSurface};
   
 
   enum EReperesent { ePoint, eEdge, eSurface};
   
index cb9695c44ed206b4a646b7d6aba6e417c01d71f5..add4fb6bee5d1a9706d5c14541710ae304c52863 100644 (file)
@@ -144,8 +144,8 @@ class SMESH_ActorDef : public SMESH_Actor
   virtual void SetBallSize(double size);
   virtual double GetBallSize();
 
   virtual void SetBallSize(double size);
   virtual double GetBallSize();
 
-  virtual void SetBallScale(int size);
-  virtual int GetBallScale();
+  virtual void SetBallScale(double size);
+  virtual double GetBallScale();
 
   virtual int GetNodeObjId(int theVtkID);
   virtual double* GetNodeCoord(int theObjID);
 
   virtual int GetNodeObjId(int theVtkID);
   virtual double* GetNodeCoord(int theObjID);
index a1d8edf752d5f87625bfacd09802efac143b308b..dd7c3480b7968332244c586e04e135ef0fd9a6a2 100644 (file)
@@ -961,9 +961,9 @@ void SMESH_DeviceActor::SetBallEnabled( bool theBallEnabled ) {
 
 /*!
  * Set point marker scale factor
 
 /*!
  * Set point marker scale factor
- * \param theBallScale integer value which specifies a scale factor of ball element
+ * \param theBallScale double value which specifies a scale factor of ball element
  */
  */
-void SMESH_DeviceActor::SetBallScale( int theBallScale )
+void SMESH_DeviceActor::SetBallScale( double theBallScale )
 {
   myMapper->SetBallScale( theBallScale );
   myMapper->Modified();
 {
   myMapper->SetBallScale( theBallScale );
   myMapper->Modified();
@@ -1019,7 +1019,7 @@ int SMESH_DeviceActor::GetMarkerTexture()
  * Get scale factor of ball element
  * \return scale factor of ball element
  */
  * Get scale factor of ball element
  * \return scale factor of ball element
  */
-int SMESH_DeviceActor::GetBallScale()
+double SMESH_DeviceActor::GetBallScale()
 {
   return myMapper->GetBallScale();
 }
 {
   return myMapper->GetBallScale();
 }
index d4129d6faa37eaf1a40b236f4aaee1ab163692eb..ce8f74362c1a17957474d13229c0760476324b0d 100644 (file)
@@ -148,13 +148,13 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
 
   void SetMarkerEnabled( bool );
   void SetBallEnabled( bool );
 
   void SetMarkerEnabled( bool );
   void SetBallEnabled( bool );
-  void SetBallScale( int );
+  void SetBallScale( double );
   void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
   void SetMarkerTexture( int, VTK::MarkerTexture );
   VTK::MarkerType GetMarkerType();
   VTK::MarkerScale GetMarkerScale();
   int GetMarkerTexture();
   void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
   void SetMarkerTexture( int, VTK::MarkerTexture );
   VTK::MarkerType GetMarkerType();
   VTK::MarkerScale GetMarkerScale();
   int GetMarkerTexture();
-  int GetBallScale();
+  double GetBallScale();
 
  protected:
   void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
 
  protected:
   void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
index 9bf90fde22d4ba924b749357c9087be6a7463805..c90cb0fa9efe48868146d72afef3b6b371624d3d 100644 (file)
@@ -1316,7 +1316,7 @@ namespace
         int deltaF = 0, deltaV = 0;
         int elem0dSize   = 1;
         int ballSize     = 1;
         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;
         int edgeWidth    = 1;
         int outlineWidth = 1;
         double shrinkCoef = 0.0;
@@ -1361,7 +1361,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
             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] );
             // outlines: color
             anActor->GetOutlineColor( color[0], color[1], color[2] );
             outlineColor.setRgbF( color[0], color[1], color[2] );
@@ -5058,8 +5058,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");
                              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,
   int elemW  = addPreference(tr("PREF_WIDTH"), elemGroup,
                              LightApp_Preferences::IntSpin, "SMESH", "element_width");
   int outW  = addPreference(tr("PREF_OUTLINE_WIDTH"), elemGroup,
@@ -5073,8 +5073,9 @@ void SMESHGUI::createPreferences()
   setPreferenceProperty( ballSize, "min", 1 );
   setPreferenceProperty( ballSize, "max", 10 );
 
   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 );
 
   setPreferenceProperty( elemW, "min", 1 );
   setPreferenceProperty( elemW, "max", 5 );
@@ -5748,7 +5749,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->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";
                   sizeStr << "shrink";
                   sizeStr << QString::number(aSmeshActor->GetShrinkFactor());
                   sizeStr << "orientation";
@@ -6333,7 +6334,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
               int outlineWidth = -1;
               int elem0dSize = -1;
               int ballSize = -1;
               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;
               double shrinkSize = -1;
               double orientationSize = -1;
               bool orientation3d = false;
@@ -6363,11 +6364,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
                 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;
                   ballSize = v1;
                   ballScale = v2;
                   i += 2;
@@ -6407,7 +6408,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
               if ( ballSize > 0 )
                 aSmeshActor->SetBallSize( ballSize );
               // ball scale
               if ( ballSize > 0 )
                 aSmeshActor->SetBallSize( ballSize );
               // ball scale
-              if ( ballScale > 0 )
+              if ( ballScale > 0.0 )
                 aSmeshActor->SetBallScale( ballScale );
               // shrink factor
               if ( shrinkSize > 0 )
                 aSmeshActor->SetBallScale( ballScale );
               // shrink factor
               if ( shrinkSize > 0 )
index ecda71b99a6a00d7bf48c1369411c326fa9e445b..400a02532f77e09d797a6bbdb724343d35509910 100644 (file)
@@ -34,6 +34,7 @@
 #include <QtxBiColorTool.h>
 #include <QtxColorButton.h>
 #include <QtxIntSpinBox.h>
 #include <QtxBiColorTool.h>
 #include <QtxColorButton.h>
 #include <QtxIntSpinBox.h>
+#include <QtxDoubleSpinBox.h>
 #include <VTKViewer_MarkerWidget.h>
 #include <SUIT_Session.h>
 #include <LightApp_Application.h>
 #include <VTKViewer_MarkerWidget.h>
 #include <SUIT_Session.h>
 #include <LightApp_Application.h>
@@ -158,7 +159,7 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
   QLabel* ballSizeLab = new QLabel( tr( "SIZE" ), myBallGrp );
   myBallSize = new QtxIntSpinBox( myBallGrp );
   QLabel* ballScaleLab = new QLabel( tr( "SCALE_FACTOR" ), myBallGrp );
   QLabel* ballSizeLab = new QLabel( tr( "SIZE" ), myBallGrp );
   myBallSize = new QtxIntSpinBox( myBallGrp );
   QLabel* ballScaleLab = new QLabel( tr( "SCALE_FACTOR" ), myBallGrp );
-  myBallScale = new QtxIntSpinBox( myBallGrp );
+  myBallScale = new QtxDoubleSpinBox( 1e-2, 1e7, 0.5, myBallGrp );
   hl = new QHBoxLayout( myBallGrp );
   hl->setMargin( MARGIN );
   hl->setSpacing( SPACING );
   hl = new QHBoxLayout( myBallGrp );
   hl->setMargin( MARGIN );
   hl->setSpacing( SPACING );
@@ -248,7 +249,6 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
   myNodeMarker->setCustomMarkers( customMarkers );
   myElem0dSize->setRange( 1, 10 );
   myBallSize->setRange( 1, 10 );
   myNodeMarker->setCustomMarkers( customMarkers );
   myElem0dSize->setRange( 1, 10 );
   myBallSize->setRange( 1, 10 );
-  myBallScale->setRange( 1, 10 );
   myEdgeWidth->setRange( 1, 5 );
   myOutlineWidth->setRange( 1, 5 );
   myShrinkSize->setRange( 20, 100 );
   myEdgeWidth->setRange( 1, 5 );
   myOutlineWidth->setRange( 1, 5 );
   myShrinkSize->setRange( 20, 100 );
@@ -540,7 +540,7 @@ int SMESHGUI_PropertiesDlg::ballSize() const
   \brief Set discrete elements (balls) scale factor
   \param size discrete elements (balls) scale factor
 */
   \brief Set discrete elements (balls) scale factor
   \param size discrete elements (balls) scale factor
 */
-void SMESHGUI_PropertiesDlg::setBallScale( int size )
+void SMESHGUI_PropertiesDlg::setBallScale( double size )
 {
   myBallScale->setValue( size );
 }
 {
   myBallScale->setValue( size );
 }
@@ -549,7 +549,7 @@ void SMESHGUI_PropertiesDlg::setBallScale( int size )
   \brief Get discrete elements (balls) scale factor
   \return current discrete elements (balls) scale factor
 */
   \brief Get discrete elements (balls) scale factor
   \return current discrete elements (balls) scale factor
 */
-int SMESHGUI_PropertiesDlg::ballScale() const
+double SMESHGUI_PropertiesDlg::ballScale() const
 {
   return myBallScale->value();
 }
 {
   return myBallScale->value();
 }
index eb3e551fc71c84670e285f23668759528e16c841..5ec3ce6200065554c3d89e53dd4ebe5c40106223 100644 (file)
@@ -38,6 +38,7 @@ class QGroupBox;
 class QtxColorButton;
 class QtxBiColorTool;
 class QtxIntSpinBox;
 class QtxColorButton;
 class QtxBiColorTool;
 class QtxIntSpinBox;
+class QtxDoubleSpinBox;
 class VTKViewer_MarkerWidget;
 
 class SMESHGUI_EXPORT SMESHGUI_PropertiesDlg : public SMESHGUI_Dialog
 class VTKViewer_MarkerWidget;
 
 class SMESHGUI_EXPORT SMESHGUI_PropertiesDlg : public SMESHGUI_Dialog
@@ -83,8 +84,8 @@ public:
   QColor            ballColor() const;
   void              setBallSize( int );
   int               ballSize() const;
   QColor            ballColor() const;
   void              setBallSize( int );
   int               ballSize() const;
-  void              setBallScale( int );
-  int               ballScale() const;
+  void              setBallScale( double );
+  double            ballScale() const;
 
   void              setOrientationColor( const QColor& );
   QColor            orientationColor() const;
 
   void              setOrientationColor( const QColor& );
   QColor            orientationColor() const;
@@ -134,7 +135,7 @@ private:
   // - balls
   QtxColorButton*         myBallColor;
   QtxIntSpinBox*          myBallSize;
   // - balls
   QtxColorButton*         myBallColor;
   QtxIntSpinBox*          myBallSize;
-  QtxIntSpinBox*          myBallScale;
+  QtxDoubleSpinBox*       myBallScale;
   // - orientation vectors
   QtxColorButton*         myOrientationColor;
   QtxIntSpinBox*          myOrientationSize;
   // - orientation vectors
   QtxColorButton*         myOrientationColor;
   QtxIntSpinBox*          myOrientationSize;