diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx
index de3f26559..0b30830c4 100644
--- a/src/SMESHGUI/SMESHGUI.cxx
+++ b/src/SMESHGUI/SMESHGUI.cxx
@@ -1187,7 +1187,7 @@ namespace
}
}
- void ShowDistribution() {
+ void ShowElement(int theCommandID ) {
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if ( aSel )
@@ -1199,7 +1199,12 @@ namespace
SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
SMESH_ScalarBarActor *aScalarBarActor = anActor->GetScalarBarActor();
- aScalarBarActor->SetDistributionVisibility(!aScalarBarActor->GetDistributionVisibility());
+ if ( theCommandID == SMESHOp::OpShowDistribution ) {
+ aScalarBarActor->SetDistributionVisibility(!aScalarBarActor->GetDistributionVisibility());
+ }
+ else if ( theCommandID == SMESHOp::OpShowScalarBar ) {
+ aScalarBarActor->SetVisibility( !aScalarBarActor->GetVisibility());
+ }
}
}
}
@@ -1323,7 +1328,7 @@ namespace
QColor orientationColor, outlineColor, volumeColor;
int deltaF = 0, deltaV = 0;
int elem0dSize = 1;
- int ballSize = 1;
+ //int ballSize = 1;
double ballScale = 1.0;
int edgeWidth = 1;
int outlineWidth = 1;
@@ -1368,7 +1373,7 @@ namespace
// balls: color, size
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
+ //ballSize = qMax( (int)anActor->GetBallSize(), 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] );
@@ -1425,7 +1430,7 @@ namespace
dlg.setElem0dSize( elem0dSize );
// balls: color, size
dlg.setBallColor( ballColor );
- dlg.setBallSize( ballSize );
+ //dlg.setBallSize( ballSize );
dlg.setBallScale( ballScale );
// orientation: color, scale, 3d flag
dlg.setOrientationColor( orientationColor );
@@ -1452,7 +1457,7 @@ namespace
elem0dColor = dlg.elem0dColor();
elem0dSize = dlg.elem0dSize();
ballColor = dlg.ballColor();
- ballSize = dlg.ballSize();
+ // ballSize = dlg.ballSize();
ballScale = dlg.ballScale();
orientationColor = dlg.orientationColor();
orientationScale = dlg.orientationSize() / 100.;
@@ -1496,7 +1501,7 @@ namespace
anActor->Set0DSize( elem0dSize );
// balls: color, size
anActor->SetBallColor( ballColor.redF(), ballColor.greenF(), ballColor.blueF() );
- anActor->SetBallSize( ballSize );
+ // anActor->SetBallSize( ballSize );
anActor->SetBallScale( ballScale );
// orientation: color, scale, 3d flag
anActor->SetFacesOrientationColor( orientationColor.redF(), orientationColor.greenF(), orientationColor.blueF() );
@@ -2482,6 +2487,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( this );
break;
}
+ case SMESHOp::OpShowScalarBar:
+ {
+ // show/hide scalar bar
+ ::ShowElement(theCommandID);
+ break;
+ }
case SMESHOp::OpSaveDistribution:
{
// dump control distribution data to the text file
@@ -2491,8 +2502,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpShowDistribution:
{
- // show/ distribution
- ::ShowDistribution();
+ // show/hide distribution
+ ::ShowElement(theCommandID);
break;
}
@@ -3921,6 +3932,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( SMESHOp::OpReset, "RESET" );
createSMESHAction( SMESHOp::OpScalarBarProperties, "SCALAR_BAR_PROP" );
+ createSMESHAction( SMESHOp::OpShowScalarBar, "SHOW_SCALAR_BAR","",0, true );
createSMESHAction( SMESHOp::OpSaveDistribution, "SAVE_DISTRIBUTION" );
createSMESHAction( SMESHOp::OpShowDistribution, "SHOW_DISTRIBUTION","",0, true );
#ifndef DISABLE_PLOT2DVIEWER
@@ -4639,6 +4651,9 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( separator(), anId, -1 );
+ popupMgr()->insert( action( SMESHOp::OpShowScalarBar ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpShowScalarBar ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpShowScalarBar ), aMeshInVTK + "&& controlMode <> 'eNone' && isScalarBarVisible", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( SMESHOp::OpScalarBarProperties ), anId, -1 );
popupMgr()->setRule( action( SMESHOp::OpScalarBarProperties ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
@@ -4651,7 +4666,7 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( action( SMESHOp::OpShowDistribution ), aSubId, -1 );
popupMgr()->setRule( action( SMESHOp::OpShowDistribution ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
- popupMgr()->setRule( action( SMESHOp::OpShowDistribution ), aMeshInVTK + "&& isNumFunctor && isDistributionVisible", QtxPopupMgr::ToggleRule);
+ popupMgr()->setRule( action( SMESHOp::OpShowDistribution ), aMeshInVTK + "&& isNumFunctor && isScalarBarVisible && isDistributionVisible", QtxPopupMgr::ToggleRule);
#ifndef DISABLE_PLOT2DVIEWER
popupMgr()->insert( action( SMESHOp::OpPlotDistribution ), aSubId, -1 );
@@ -5129,8 +5144,10 @@ void SMESHGUI::createPreferences()
int size0d = addPreference(tr("PREF_SIZE_0D"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
- int ballSize = addPreference(tr("PREF_BALL_SIZE"), elemGroup,
- LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size");
+ /* int ballSize = addPreference(tr("PREF_BALL_SIZE"), elemGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size"); */
+ int ballDiameter = addPreference(tr("PREF_BALL_DIAMETER"), elemGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "ball_elem_diameter");
double ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup,
LightApp_Preferences::DblSpin, "SMESH", "ball_elem_scale");
int elemW = addPreference(tr("PREF_WIDTH"), elemGroup,
@@ -5143,8 +5160,12 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( size0d, "min", 1 );
setPreferenceProperty( size0d, "max", 10 );
- setPreferenceProperty( ballSize, "min", 1 );
- setPreferenceProperty( ballSize, "max", 10 );
+ // setPreferenceProperty( ballSize, "min", 1 );
+ // setPreferenceProperty( ballSize, "max", 10 );
+
+ setPreferenceProperty( ballDiameter, "min", 1e-7 );
+ setPreferenceProperty( ballDiameter, "max", 1e9 );
+ setPreferenceProperty( ballDiameter, "step", 0.1 );
setPreferenceProperty( ballScale, "min", 1e-2 );
setPreferenceProperty( ballScale, "max", 1e7 );
@@ -5821,7 +5842,8 @@ void SMESHGUI::storeVisualParameters (int savePoint)
sizeStr << "elem0d";
sizeStr << QString::number((int)aSmeshActor->Get0DSize());
sizeStr << "ball";
- sizeStr << QString::number((int)aSmeshActor->GetBallSize());
+ //sizeStr << QString::number((int)aSmeshActor->GetBallSize());
+ sizeStr << QString::number((double)aSmeshActor->GetBallSize());
sizeStr << QString::number((double)aSmeshActor->GetBallScale());
sizeStr << "shrink";
sizeStr << QString::number(aSmeshActor->GetShrinkFactor());
@@ -6406,7 +6428,8 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
int lineWidth = -1;
int outlineWidth = -1;
int elem0dSize = -1;
- int ballSize = -1;
+ //int ballSize = -1;
+ double ballDiameter = -1.0;
double ballScale = -1.0;
double shrinkSize = -1;
double orientationSize = -1;
@@ -6439,10 +6462,12 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
// - size - is a integer value specifying size
// - 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
+ //int v1 = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
+ double 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;
+ //ballSize = v1;
+ ballDiameter = v1;
ballScale = v2;
i += 2;
}
@@ -6478,8 +6503,11 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
if ( elem0dSize > 0 )
aSmeshActor->Set0DSize( elem0dSize );
// ball size
- if ( ballSize > 0 )
- aSmeshActor->SetBallSize( ballSize );
+ /*if ( ballSize > 0 )
+ aSmeshActor->SetBallSize( ballSize );*/
+ // ball diameter
+ if ( ballDiameter > 0 )
+ aSmeshActor->SetBallSize( ballDiameter );
// ball scale
if ( ballScale > 0.0 )
aSmeshActor->SetBallScale( ballScale );
diff --git a/src/SMESHGUI/SMESHGUI_Operations.h b/src/SMESHGUI/SMESHGUI_Operations.h
index 576133bcf..c9b3a2f58 100644
--- a/src/SMESHGUI/SMESHGUI_Operations.h
+++ b/src/SMESHGUI/SMESHGUI_Operations.h
@@ -29,6 +29,7 @@ namespace SMESHOp {
OpSelectFiltersLibrary = 1010, // MENU TOOLS - SELECTION FILTERS LIBRARY
OpReset = 1020, // RESET
OpScalarBarProperties = 1021, // SCALAR BAR PROPERTIES
+ OpShowScalarBar = 1022, // SHOW SCALAR BAR
OpSaveDistribution = 1030, // SAVE DISTRIBUTION
OpShowDistribution = 1031, // SHOW DISTRIBUTION
#ifndef DISABLE_PLOT2DVIEWER
diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx
index b40dabd20..1c99de1d8 100644
--- a/src/SMESHGUI/SMESHGUI_Selection.cxx
+++ b/src/SMESHGUI/SMESHGUI_Selection.cxx
@@ -134,6 +134,7 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
else if ( p=="groupType" ) val = QVariant( groupType( ind ) );
else if ( p=="quadratic2DMode") val = QVariant( quadratic2DMode( ind ) );
else if ( p=="isDistributionVisible") val = QVariant( isDistributionVisible( ind ) );
+ else if ( p=="isScalarBarVisible") val = QVariant( isScalarBarVisible( ind ) );
else if ( p=="hasChildren") val = QVariant( hasChildren( ind ) );
else if ( p=="nbChildren") val = QVariant( nbChildren( ind ) );
else if ( p=="isContainer") val = QVariant( isContainer( ind ) );
@@ -257,6 +258,16 @@ bool SMESHGUI_Selection::isDistributionVisible(int ind) const {
return (actor && actor->GetScalarBarActor() && actor->GetScalarBarActor()->GetDistributionVisibility());
}
+//=======================================================================
+//function : isScalarBarVisible
+//purpose : Visible/Invisible Scalar Bar
+//=======================================================================
+
+bool SMESHGUI_Selection::isScalarBarVisible(int ind) const {
+ SMESH_Actor* actor = getActor( ind );
+ return (actor && actor->GetScalarBarActor() && actor->GetScalarBarActor()->GetVisibility());
+}
+
//=======================================================================
//function : shrinkMode
//purpose : return either 'IsSrunk', 'IsNotShrunk' or 'IsNotShrinkable'
diff --git a/src/SMESHGUI/SMESHGUI_Selection.h b/src/SMESHGUI/SMESHGUI_Selection.h
index d06d35e52..f26b9979c 100644
--- a/src/SMESHGUI/SMESHGUI_Selection.h
+++ b/src/SMESHGUI/SMESHGUI_Selection.h
@@ -61,9 +61,10 @@ public:
virtual QVariant hasReference( int ) const;
virtual QVariant isVisible( int ) const;
- virtual QString quadratic2DMode(int ) const;
+ virtual QString quadratic2DMode( int ) const;
- virtual bool isDistributionVisible(int ) const;
+ virtual bool isDistributionVisible( int ) const;
+ virtual bool isScalarBarVisible( int ) const;
virtual bool hasChildren( int ) const;
virtual int nbChildren( int ) const;
virtual bool isContainer( int ) const;
diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts
index 08bb2e205..59e9c9be9 100644
--- a/src/SMESHGUI/SMESH_msg_en.ts
+++ b/src/SMESHGUI/SMESH_msg_en.ts
@@ -932,6 +932,10 @@
MEN_SHADE
Shading
+
+ MEN_SHOW_SCALAR_BAR
+ Show Scalar Bar
+
MEN_QUADRATIC_REPRESENT
2D Quadratic
@@ -2581,6 +2585,10 @@ Check algorithm documentation for supported geometry
SMESH_SEWING
Sewing
+
+ SMESH_SHOW_SCALAR_BAR
+ Show Scalar Bar
+
SMESH_SMOOTHING
Smoothing
@@ -3328,6 +3336,10 @@ Use Display Entity menu command to show them.
STB_SHOW
Show
+
+ STB_SHOW_SCALAR_BAR
+ Show Scalar Bar
+
STB_SHRINK
Shrink
diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts
index 47ef037d8..96922a41a 100755
--- a/src/SMESHGUI/SMESH_msg_fr.ts
+++ b/src/SMESHGUI/SMESH_msg_fr.ts
@@ -932,6 +932,10 @@
MEN_SHADE
Ombrage
+
+ MEN_SHOW_SCALAR_BAR
+ Show Scalar Bar
+
MEN_QUADRATIC_REPRESENT
Quadratique 2D
@@ -2577,6 +2581,10 @@ Référez-vous à la documentation sur l'algorithme et la géométrie suppo
SMESH_SEWING
Couture
+
+ SMESH_SHOW_SCALAR_BAR
+ Show Scalar Bar
+
SMESH_SMOOTHING
Lissage
@@ -3289,6 +3297,10 @@ Utilisez le menu "Visualiser une entité" pour les afficher.
STB_SHOW_DISTRIBUTION
Afficher la distribution
+
+ STB_SHOW_SCALAR_BAR
+ Show Scalar Bar
+
STB_REVOLUTION
Révolution
diff --git a/src/SMESHGUI/SMESH_msg_ja.ts b/src/SMESHGUI/SMESH_msg_ja.ts
index f909eba82..29698eb01 100644
--- a/src/SMESHGUI/SMESH_msg_ja.ts
+++ b/src/SMESHGUI/SMESH_msg_ja.ts
@@ -931,6 +931,10 @@
MEN_SHADE
網かけ
+
+ MEN_SHOW_SCALAR_BAR
+ Show Scalar Bar
+
MEN_QUADRATIC_REPRESENT
二次 2D
@@ -2267,6 +2271,10 @@
SMESH_SHOW_DISTRIBUTION_SCALARBAR
分布を表示します。
+
+ SMESH_SHOW_SCALAR_BAR
+ Show Scalar Bar
+
SMESH_PRECISION
精度
@@ -3247,6 +3255,10 @@
STB_SHOW_DISTRIBUTION
分布を表示します。
+
+ STB_SHOW_SCALAR_BAR
+ Show Scalar Bar
+
STB_REVOLUTION
Revolution