Salome HOME
0022479: EDF 2823 SMESH: Add "multiplier" coefficient for balls
authormpa <mpa@opencascade.com>
Mon, 24 Mar 2014 07:29:24 +0000 (11:29 +0400)
committermpa <mpa@opencascade.com>
Mon, 24 Mar 2014 07:29:24 +0000 (11:29 +0400)
17 files changed:
doc/salome/gui/SMESH/images/colors_size.png
doc/salome/gui/SMESH/images/pref22.png
doc/salome/gui/SMESH/input/colors_size.doc
doc/salome/gui/SMESH/input/mesh_preferences.doc
resources/SalomeApp.xml.in
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_AddMeshElementDlg.cxx
src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx
src/SMESHGUI/SMESHGUI_PropertiesDlg.h
src/SMESHGUI/SMESH_msg_en.ts
src/SMESHGUI/SMESH_msg_fr.ts
src/SMESHGUI/SMESH_msg_ja.ts

index 213652e79922998e425c972ce5a860a7d4f36edd..0b1d3e566458a69b8788f585e26f586549ed5fe2 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/colors_size.png and b/doc/salome/gui/SMESH/images/colors_size.png differ
index f6a7b597853685476c7a4fbbd2394f69a0c9915d..d557d2515bb949022c9ba8a152c94ee3b262ccd7 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/pref22.png and b/doc/salome/gui/SMESH/images/pref22.png differ
index e777e84a186fc4ba9871df3e9d1d241d568acf65..c8be2278ee5db1d39ecf44fb1d3c9e7b07a7b919 100644 (file)
@@ -41,6 +41,7 @@ shown.
 - \b Balls:
   - \b Color - color of discrete ball elements.
   - \b Size - size of discrete ball elements.
+  - \b Scale - scale factor of discrete ball elements.
 - <b>Orientation vectors</b>:
   - \b Color - color of orientation vectors.
   - \b Scale - size of orientation vectors.
index 02574d07dde82aec065a16e08fb006bdb5b1ac2e..e0374fd4c41e9ffba551484034ba199c5e86ea28 100644 (file)
@@ -159,6 +159,8 @@ later sessions with this module.
   - <b>Size of 0D elements</b> - specifies default size of 0D elements.
   - <b>Size of ball elements</b> - specifies default size of discrete
     elements (balls).
+  - <b>Scale factor of ball elements</b> - specifies default scale factor of discrete
+    elements (balls).
   - <b>Line width</b> - allows to define the width of 1D elements (edges).
   - <b>Outline width</b> - allows to define the width of borders of
     2D and 3D elements (shown in the Shading mode).
index aae5691668e37e1afa9cc31480f18bb0eb288e8c..8658334a9426c03964f594e36dcd49a77cb47ab0 100644 (file)
@@ -45,6 +45,7 @@
     <parameter name="marker_scale"                 value="9"  />
     <parameter name="elem0d_size"                  value="5" />
     <parameter name="ball_elem_size"               value="10" />
+    <parameter name="ball_elem_scale"              value="1" />
     <parameter name="element_width"                value="1" />
     <parameter name="outline_width"                value="1" />
     <parameter name="shrink_coeff"                 value="75"/>
index ed1ca8594a94a75fd5aec6b011cebbe7c1f84851..8cc3716b15d715ca539cc3ba5c5ba4c288e2a351 100644 (file)
@@ -143,10 +143,11 @@ SMESH_ActorDef::SMESH_ActorDef()
   if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
     myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
 
-  double aElem0DSize   = SMESH::GetFloat("SMESH:elem0d_size",5);
-  double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10);
-  double aLineWidth    = SMESH::GetFloat("SMESH:element_width",1);
-  double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1);
+  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 aLineWidth     = SMESH::GetFloat("SMESH:element_width",1);
+  double aOutlineWidth  = SMESH::GetFloat("SMESH:outline_width",1);
 
   SMESH::LabelFont aFamilyNd = SMESH::FntTimes;
   bool aBoldNd    = true;
@@ -566,6 +567,7 @@ SMESH_ActorDef::SMESH_ActorDef()
 #endif
 
   SetBallSize(aBallElemSize);
+  SetBallScale(aBallElemScale);
   Set0DSize(aElem0DSize);
 }
 
@@ -2106,6 +2108,16 @@ double SMESH_ActorDef::GetBallSize(){
   return myBallProp->GetPointSize();
 }
 
+int SMESH_ActorDef::GetBallScale()
+{
+  return myBallActor->GetBallScale();
+}
+
+void SMESH_ActorDef::SetBallScale( int theVal )
+{
+  myBallActor->SetBallScale( theVal );
+}
+
 int SMESH_ActorDef::GetObjDimension( const int theObjId )
 {
   return myVisualObj->GetElemDimension( theObjId );
index d07f79c2655ca3ec61a9c5b9f13abdfd519bbe2c..f882abc715f2a52d69d0298569e31643194f0b18 100644 (file)
@@ -101,6 +101,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
   virtual void SetBallSize(double size) = 0;
   virtual double GetBallSize() = 0;
 
+  virtual void SetBallScale(int size) = 0;
+  virtual int GetBallScale() = 0;
+
   enum EReperesent { ePoint, eEdge, eSurface};
   
   enum EEntityMode { e0DElements = 0x01, eEdges = 0x02, eFaces = 0x04, eVolumes = 0x08, eBallElem = 0x10, eAllEntity = 0x1f};
index 4b5cba5c79db0bda1f5a6fbddf1f3a20b2767b42..cb9695c44ed206b4a646b7d6aba6e417c01d71f5 100644 (file)
@@ -144,6 +144,9 @@ class SMESH_ActorDef : public SMESH_Actor
   virtual void SetBallSize(double size);
   virtual double GetBallSize();
 
+  virtual void SetBallScale(int size);
+  virtual int GetBallScale();
+
   virtual int GetNodeObjId(int theVtkID);
   virtual double* GetNodeCoord(int theObjID);
 
index 4785155d80478fffa598fa2f65c66c8da1519838..a1d8edf752d5f87625bfacd09802efac143b308b 100644 (file)
@@ -959,6 +959,16 @@ void SMESH_DeviceActor::SetBallEnabled( bool theBallEnabled ) {
   myMapper->SetBallEnabled( theBallEnabled );
 }
 
+/*!
+ * Set point marker scale factor
+ * \param theBallScale integer value which specifies a scale factor of ball element
+ */
+void SMESH_DeviceActor::SetBallScale( int theBallScale )
+{
+  myMapper->SetBallScale( theBallScale );
+  myMapper->Modified();
+}
+
 /*!
  * Set standard point marker
  * \param theMarkerType type of the marker
@@ -1005,6 +1015,15 @@ int SMESH_DeviceActor::GetMarkerTexture()
   return myMapper->GetMarkerTexture();
 }
 
+/*!
+ * Get scale factor of ball element
+ * \return scale factor of ball element
+ */
+int SMESH_DeviceActor::GetBallScale()
+{
+  return myMapper->GetBallScale();
+}
+
 void SMESH_DeviceActor::SetCoincident3DAllowed(bool theFlag) {
   myGeomFilter->SetAppendCoincident3D(theFlag);
 }
index a85c2555995ba1372760e698249433a700d22d00..d4129d6faa37eaf1a40b236f4aaee1ab163692eb 100644 (file)
@@ -148,11 +148,13 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
 
   void SetMarkerEnabled( bool );
   void SetBallEnabled( bool );
+  void SetBallScale( int );
   void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
   void SetMarkerTexture( int, VTK::MarkerTexture );
   VTK::MarkerType GetMarkerType();
   VTK::MarkerScale GetMarkerScale();
   int GetMarkerTexture();
+  int GetBallScale();
 
  protected:
   void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
index aa09da82aaf5889215c321ecb8f524f4ed592878..9bf90fde22d4ba924b749357c9087be6a7463805 100644 (file)
@@ -1316,6 +1316,7 @@ namespace
         int deltaF = 0, deltaV = 0;
         int elem0dSize   = 1;
         int ballSize     = 1;
+        int ballScale    = 1;
         int edgeWidth    = 1;
         int outlineWidth = 1;
         double shrinkCoef = 0.0;
@@ -1360,6 +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
+            ballScale = qMax( (int)anActor->GetBallScale(), 1 ); // minimum allowed size is 1
             // outlines: color
             anActor->GetOutlineColor( color[0], color[1], color[2] );
             outlineColor.setRgbF( color[0], color[1], color[2] );
@@ -1416,6 +1418,7 @@ namespace
         // balls: color, size
         dlg.setBallColor( ballColor );
         dlg.setBallSize( ballSize );
+        dlg.setBallScale( ballScale );
         // orientation: color, scale, 3d flag
         dlg.setOrientationColor( orientationColor );
         dlg.setOrientationSize( int( orientationScale * 100. ) );
@@ -1442,6 +1445,7 @@ namespace
           elem0dSize       = dlg.elem0dSize();
           ballColor        = dlg.ballColor();
           ballSize         = dlg.ballSize();
+          ballScale        = dlg.ballScale();
           orientationColor = dlg.orientationColor();
           orientationScale = dlg.orientationSize() / 100.;
           orientation3d    = dlg.orientation3d();
@@ -1485,6 +1489,7 @@ namespace
             // balls: color, size
             anActor->SetBallColor( ballColor.redF(), ballColor.greenF(), ballColor.blueF() );
             anActor->SetBallSize( ballSize );
+            anActor->SetBallScale( ballScale );
             // orientation: color, scale, 3d flag
             anActor->SetFacesOrientationColor( orientationColor.redF(), orientationColor.greenF(), orientationColor.blueF() );
             anActor->SetFacesOrientationScale( orientationScale );
@@ -5053,6 +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");
+  int ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup,
+                             LightApp_Preferences::IntSpin, "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,
@@ -5066,6 +5073,9 @@ void SMESHGUI::createPreferences()
   setPreferenceProperty( ballSize, "min", 1 );
   setPreferenceProperty( ballSize, "max", 10 );
 
+  setPreferenceProperty( ballScale, "min", 1 );
+  setPreferenceProperty( ballScale, "max", 10 );
+
   setPreferenceProperty( elemW, "min", 1 );
   setPreferenceProperty( elemW, "max", 5 );
 
@@ -5738,6 +5748,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 << "shrink";
                   sizeStr << QString::number(aSmeshActor->GetShrinkFactor());
                   sizeStr << "orientation";
@@ -6322,6 +6333,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
               int outlineWidth = -1;
               int elem0dSize = -1;
               int ballSize = -1;
+              int ballScale = -1;
               double shrinkSize = -1;
               double orientationSize = -1;
               bool orientation3d = false;
@@ -6349,11 +6361,16 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
                   i++;
                 }
                 else if ( type == "ball" ) {
-                  // ball size is given as single integer value
+                  // 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 v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break;  // format error
-                  ballSize = v;
-                  i++;
+                  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
+                  ballSize = v1;
+                  ballScale = v2;
+                  i += 2;
                 }
                 else if ( type == "shrink" ) {
                   // shrink factor is given as single floating point value
@@ -6389,6 +6406,9 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
               // ball size
               if ( ballSize > 0 )
                 aSmeshActor->SetBallSize( ballSize );
+              // ball scale
+              if ( ballScale > 0 )
+                aSmeshActor->SetBallScale( ballScale );
               // shrink factor
               if ( shrinkSize > 0 )
                 aSmeshActor->SetShrinkFactor( shrinkSize );
index 7c430493d524c6fd0b40abb715d0a95aad225f3a..79588047cb0abfb36b46746cfd9387503fc559e0 100644 (file)
@@ -230,7 +230,7 @@ namespace SMESH
       for (int i = 0, iEnd = theIds.size(); i < iEnd; i++){
         anIds->InsertId(0,theIds[i]);
         vtkIdType anId = myBallPolyData->InsertNextCell(VTK_POLY_VERTEX,anIds);
-        double d = theDiameter;
+        double d = theDiameter * theActor->GetBallScale();
         aScalars->SetTuple(anId,&d);
         anIds->Reset();
       }
index 475c84b2ce61e54d02e58f475253f38945aae87b..ecda71b99a6a00d7bf48c1369411c326fa9e445b 100644 (file)
@@ -157,6 +157,8 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
   myBallColor = new QtxColorButton( myBallGrp );
   QLabel* ballSizeLab = new QLabel( tr( "SIZE" ), myBallGrp );
   myBallSize = new QtxIntSpinBox( myBallGrp );
+  QLabel* ballScaleLab = new QLabel( tr( "SCALE_FACTOR" ), myBallGrp );
+  myBallScale = new QtxIntSpinBox( myBallGrp );
   hl = new QHBoxLayout( myBallGrp );
   hl->setMargin( MARGIN );
   hl->setSpacing( SPACING );
@@ -164,6 +166,8 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
   hl->addWidget( myBallColor );
   hl->addWidget( ballSizeLab );
   hl->addWidget( myBallSize );
+  hl->addWidget( ballScaleLab );
+  hl->addWidget( myBallScale );
   widthLab1 = qMax( widthLab1, ballColorLab->minimumSizeHint().width() );
   widthLab2 = qMax( widthLab2, ballSizeLab->minimumSizeHint().width() );
   
@@ -171,7 +175,7 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
   myOrientationGrp = new QGroupBox( tr( "ORIENTATIONS" ), mainFrame() );
   QLabel* orientationColorLab = new QLabel( tr( "COLOR" ), myOrientationGrp );
   myOrientationColor = new QtxColorButton( myOrientationGrp );
-  QLabel* orientationScaleLab = new QLabel( tr( "ORIENTATION_SCALE" ), myOrientationGrp );
+  QLabel* orientationScaleLab = new QLabel( tr( "SCALE_FACTOR" ), myOrientationGrp );
   myOrientationSize = new QtxIntSpinBox( myOrientationGrp );
   myOrientationSize->setSuffix( "% ");
   myOrientation3d = new QCheckBox( tr("ORIENTATION_3D"), myOrientationGrp );
@@ -236,6 +240,7 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
   myOutlineWidth->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
   myElem0dSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
   myBallSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+  myBallScale->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
   myOrientationSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
   myShrinkSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
 
@@ -243,6 +248,7 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
   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 );
@@ -530,6 +536,24 @@ int SMESHGUI_PropertiesDlg::ballSize() const
   return myBallSize->value();
 }
 
+/*!
+  \brief Set discrete elements (balls) scale factor
+  \param size discrete elements (balls) scale factor
+*/
+void SMESHGUI_PropertiesDlg::setBallScale( int size )
+{
+  myBallScale->setValue( size );
+}
+
+/*!
+  \brief Get discrete elements (balls) scale factor
+  \return current discrete elements (balls) scale factor
+*/
+int SMESHGUI_PropertiesDlg::ballScale() const
+{
+  return myBallScale->value();
+}
+
 /*!
   \brief Set orientation vectors color
   \param color orientation vectors color
index c9d76b14ee6e8a5a3743dcbdbcba14c5568bba26..eb3e551fc71c84670e285f23668759528e16c841 100644 (file)
@@ -83,6 +83,8 @@ public:
   QColor            ballColor() const;
   void              setBallSize( int );
   int               ballSize() const;
+  void              setBallScale( int );
+  int               ballScale() const;
 
   void              setOrientationColor( const QColor& );
   QColor            orientationColor() const;
@@ -132,6 +134,7 @@ private:
   // - balls
   QtxColorButton*         myBallColor;
   QtxIntSpinBox*          myBallSize;
+  QtxIntSpinBox*          myBallScale;
   // - orientation vectors
   QtxColorButton*         myOrientationColor;
   QtxIntSpinBox*          myOrientationSize;
index cf5fa1bf6f96c77fe5284b6d1bab74f00973caa4..9b320f8e487bdf09ab24f5d7d1d048d63d3b68e8 100644 (file)
@@ -4577,6 +4577,10 @@ Please, create VTK viewer and try again</translation>
         <source>PREF_BALL_SIZE</source>
         <translation>Size of ball elements</translation>
     </message>
+    <message>
+        <source>PREF_BALL_SCALE</source>
+        <translation>Scale factor of ball elements</translation>
+    </message>
     <message>
         <source>PREF_WIDTH</source>
         <translation>Line width</translation>
@@ -7776,7 +7780,7 @@ as they are of improper type:
         <translation>Size:</translation>
     </message>
     <message>
-        <source>ORIENTATION_SCALE</source>
+        <source>SCALE_FACTOR</source>
         <translation>Scale:</translation>
     </message>
     <message>
index 5bb4ca1921f3b66107b64088a3dcb8ed499f4cd0..3181afe3f5abfc49025feef11d32903b598bb804 100755 (executable)
@@ -4567,6 +4567,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
         <source>PREF_BALL_SIZE</source>
         <translation>Taille des éléments particulaires</translation>
     </message>
+    <message>
+        <source>PREF_BALL_SCALE</source>
+        <translation>Facteur d&apos;échelle des éléments particulaires</translation>
+    </message>
     <message>
         <source>PREF_WIDTH</source>
         <translation>Epaisseur de ligne</translation>
@@ -7701,7 +7705,7 @@ en raison de leurs types incompatibles:
         <translation>Taille:</translation>
     </message>
     <message>
-        <source>ORIENTATION_SCALE</source>
+        <source>SCALE_FACTOR</source>
         <translation>Echelle:</translation>
     </message>
     <message>
index b9689e56b1194b033bebf1dbb3e6f96157c797cf..8350a23d7d9d3defa090668f8c33145c96b5c66c 100644 (file)
       <translation>サイズ</translation>
     </message>
     <message>
-      <source>ORIENTATION_SCALE</source>
+      <source>SCALE_FACTOR</source>
       <translation>スケール:</translation>
     </message>
     <message>