diff --git a/doc/salome/gui/SMESH/images/scalar_bar_dlg.png b/doc/salome/gui/SMESH/images/scalar_bar_dlg.png
index 59ca53065..564689ad9 100755
Binary files a/doc/salome/gui/SMESH/images/scalar_bar_dlg.png and b/doc/salome/gui/SMESH/images/scalar_bar_dlg.png differ
diff --git a/doc/salome/gui/SMESH/input/scalar_bar.doc b/doc/salome/gui/SMESH/input/scalar_bar.doc
index 146a7fa78..7ef8da51d 100755
--- a/doc/salome/gui/SMESH/input/scalar_bar.doc
+++ b/doc/salome/gui/SMESH/input/scalar_bar.doc
@@ -7,8 +7,12 @@ In this dialog you can specify the properties of the scalar bar
\image html scalar_bar_dlg.png
-Scalar Range in this menu you can specify
-Min value and Max value of the Scalar Bar
+Scalar Range - in this menu you can specify
+Min value and Max value of the Scalar Bar , and
+also you can turn on/off Logarithmic scaling of the scalar bar.
+
+\note Logarithmic scale is not applicable in case of
+negative and zero values in the range. In such cases it is disabled.
Font - in this menu you can set type, face and color for
the font of Title and Labels of the Scalar
@@ -29,7 +33,7 @@ location (X and Y ) and size (Width and
side)
Y : ordinate of the origin (from the bottom)
-Distribution in this menu you can Show/Hide distribution histogram of the values of the Scalar Bar and specify histogram properties
+Distribution - in this menu you can Show/Hide distribution histogram of the values of the Scalar Bar and specify histogram properties
Multicolor the histogram is colored as Scalar Bar
Monocolor the histogram is colored as selected with Distribution color selector
diff --git a/idl/SMESH_Filter.idl b/idl/SMESH_Filter.idl
index 8cc7bc864..2c701fc2b 100644
--- a/idl/SMESH_Filter.idl
+++ b/idl/SMESH_Filter.idl
@@ -115,7 +115,7 @@ module SMESH
{
double GetValue( in long theElementId );
- Histogram GetHistogram( in short nbIntervals );
+ Histogram GetHistogram( in short nbIntervals, in boolean isLogarithmic );
/*!
* Set precision for calculation. It is a position after point which is
diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx
index 2b8d3c695..239aa41e4 100644
--- a/src/Controls/SMESH_Controls.cxx
+++ b/src/Controls/SMESH_Controls.cxx
@@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include "SMESH_ControlsDef.hxx"
@@ -322,12 +321,12 @@ double NumericalFunctor::Round( const double & aVal )
* \param minmax - boundaries of diapason of values to divide into intervals
*/
//================================================================================
-
void NumericalFunctor::GetHistogram(int nbIntervals,
std::vector& nbEvents,
std::vector& funValues,
const vector& elements,
- const double* minmax)
+ const double* minmax,
+ const bool isLogarithmic)
{
if ( nbIntervals < 1 ||
!myMesh ||
@@ -380,8 +379,15 @@ void NumericalFunctor::GetHistogram(int nbIntervals,
for ( int i = 0; i < nbIntervals; ++i )
{
// find end value of i-th interval
- double r = (i+1) / double( nbIntervals );
- funValues[i+1] = funValues.front() * (1-r) + funValues.back() * r;
+ double r = (i+1) / double(nbIntervals);
+ if (isLogarithmic && funValues.front() > 1e-07 && funValues.back() > 1e-07) {
+ double logmin = log10(funValues.front());
+ double lval = logmin + r * (log10(funValues.back()) - logmin);
+ funValues[i+1] = pow(10.0, lval);
+ }
+ else {
+ funValues[i+1] = funValues.front() * (1-r) + funValues.back() * r;
+ }
// count values in the i-th interval if there are any
if ( min != values.end() && *min <= funValues[i+1] )
diff --git a/src/Controls/SMESH_ControlsDef.hxx b/src/Controls/SMESH_ControlsDef.hxx
index a0e984cdd..9b9c26525 100644
--- a/src/Controls/SMESH_ControlsDef.hxx
+++ b/src/Controls/SMESH_ControlsDef.hxx
@@ -125,7 +125,8 @@ namespace SMESH{
std::vector& nbEvents,
std::vector& funValues,
const std::vector& elements,
- const double* minmax=0);
+ const double* minmax=0,
+ const bool isLogarithmic = false);
virtual SMDSAbs_ElementType GetType() const = 0;
virtual double GetBadRate( double Value, int nbNodes ) const = 0;
long GetPrecision() const;
diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx
index 933f34c56..3ae80f7a1 100644
--- a/src/OBJECT/SMESH_Actor.cxx
+++ b/src/OBJECT/SMESH_Actor.cxx
@@ -18,13 +18,12 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// SMESH OBJECT : interactive object for SMESH visualization
// File : SMESH_Actor.cxx
// Author : Nicolas REJNERI
// Module : SMESH
-//
+
#include "SMESH_ActorDef.h"
#include "SMESH_ActorUtils.h"
#include "SMESH_DeviceActor.h"
@@ -99,8 +98,8 @@ SMESH_ActorDef* SMESH_ActorDef::New(){
}
-SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
- const char* theEntry,
+SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
+ const char* theEntry,
const char* theName,
int theIsClear)
{
@@ -120,7 +119,7 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
SMESH_ActorDef::SMESH_ActorDef()
{
- if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<fontValue( "SMESH", "numbering_node_font" );
if ( f.family() == "Arial" ) aFamilyNd = SMESH::FntArial;
else if ( f.family() == "Courier" ) aFamilyNd = SMESH::FntCourier;
- else if ( f.family() == "Times" ) aFamilyNd = SMESH::FntTimes;
- aBoldNd = f.bold();
- anItalicNd = f.italic();
- aShadowNd = f.overline();
+ else if ( f.family() == "Times" ) aFamilyNd = SMESH::FntTimes;
+ aBoldNd = f.bold();
+ anItalicNd = f.italic();
+ aShadowNd = f.overline();
aSizeNd = f.pointSize();
}
vtkFloatingPointType anRGBNd[3] = {1,1,1};
@@ -179,10 +178,10 @@ SMESH_ActorDef::SMESH_ActorDef()
QFont f = mgr->fontValue( "SMESH", "numbering_elem_font" );
if ( f.family() == "Arial" ) aFamilyEl = SMESH::FntArial;
else if ( f.family() == "Courier" ) aFamilyEl = SMESH::FntCourier;
- else if ( f.family() == "Times" ) aFamilyEl = SMESH::FntTimes;
+ else if ( f.family() == "Times" ) aFamilyEl = SMESH::FntTimes;
aBoldEl = f.bold();
anItalicEl = f.italic();
- aShadowEl = f.overline();
+ aShadowEl = f.overline();
aSizeEl = f.pointSize();
}
vtkFloatingPointType anRGBEl[3] = {0,1,0};
@@ -218,7 +217,7 @@ SMESH_ActorDef::SMESH_ActorDef()
my2DActor->SetStoreGemetryMapping(true);
my2DActor->SetUserMatrix(aMatrix);
my2DActor->PickableOff();
- my2DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
+ my2DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
my2DActor->SetProperty(mySurfaceProp);
my2DActor->SetBackfaceProperty(myBackSurfaceProp);
my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
@@ -257,7 +256,7 @@ SMESH_ActorDef::SMESH_ActorDef()
my3DActor->SetStoreGemetryMapping(true);
my3DActor->SetUserMatrix(aMatrix);
my3DActor->PickableOff();
- my3DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
+ my3DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
my3DActor->SetProperty(myNormalVProp);
my3DActor->SetBackfaceProperty(myReversedVProp);
my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
@@ -339,7 +338,7 @@ SMESH_ActorDef::SMESH_ActorDef()
my1DProp->DeepCopy(myEdgeProp);
my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
my1DProp->SetPointSize(aElem0DSize);
-
+
my1DExtProp = vtkProperty::New();
my1DExtProp->DeepCopy(myEdgeProp);
anRGB[0] = 1 - anRGB[0];
@@ -381,7 +380,7 @@ SMESH_ActorDef::SMESH_ActorDef()
//aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aFilter->RegisterCellsWithType(VTK_VERTEX);
-
+
//Definition 0D device of the actor (ball elements)
//-----------------------------------------------
myBallProp = vtkProperty::New();
@@ -393,14 +392,14 @@ SMESH_ActorDef::SMESH_ActorDef()
myBallActor->SetUserMatrix(aMatrix);
myBallActor->SetStoreGemetryMapping(true);
myBallActor->PickableOff();
- myBallActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
+ myBallActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
myBallActor->SetVisibility(false);
myBallActor->SetProperty(myBallProp);
myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
aFilter = myBallActor->GetExtractUnstructuredGrid();
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
-
+
//my0DExtProp = vtkProperty::New();
//my0DExtProp->DeepCopy(my0DProp);
//anRGB[0] = 1 - anRGB[0];
@@ -434,12 +433,12 @@ SMESH_ActorDef::SMESH_ActorDef()
myNodeActor->SetStoreClippingMapping(true);
myNodeActor->PickableOff();
myNodeActor->SetVisibility(false);
- myNodeActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] );
+ myNodeActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] );
myNodeActor->SetProperty(myNodeProp);
myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
aFilter = myNodeActor->GetExtractUnstructuredGrid();
aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
-
+
myNodeExtProp = vtkProperty::New();
myNodeExtProp->DeepCopy(myNodeProp);
anRGB[0] = 1 - anRGB[0];
@@ -466,7 +465,7 @@ SMESH_ActorDef::SMESH_ActorDef()
myBaseActor->SetStoreGemetryMapping(true);
myBaseActor->GetProperty()->SetOpacity(0.0);
myPickableActor = myBaseActor;
-
+
myHighlightProp = vtkProperty::New();
myHighlightProp->SetAmbient(1.0);
myHighlightProp->SetDiffuse(0.0);
@@ -480,7 +479,7 @@ SMESH_ActorDef::SMESH_ActorDef()
myBallHighlightProp = vtkProperty::New();
myBallHighlightProp->DeepCopy(myHighlightProp);
myBallHighlightProp->SetPointSize(aBallElemSize);
-
+
myOutLineProp = vtkProperty::New();
myOutLineProp->SetAmbient(1.0);
@@ -522,7 +521,7 @@ SMESH_ActorDef::SMESH_ActorDef()
//Definition of myScalarBarActor
//------------------------------
myLookupTable = vtkLookupTable::New();
- //Fix for Bug PAL5195 - SMESH764:
+ //Fix for Bug PAL5195 - SMESH764:
//Controls - Aspect Ratio: incorrect colors of the best and worst values
myLookupTable->SetHueRange(0.667,0.0);
@@ -541,11 +540,11 @@ SMESH_ActorDef::SMESH_ActorDef()
myEntityMode = eAllEntity;
myEntityModeCache = eAllEntity;
-
+
// Clipping planes
myImplicitBoolean = vtkImplicitBoolean::New();
myImplicitBoolean->SetOperationTypeToIntersection();
-
+
//Quadratic 2D elements representation
//-----------------------------------------------------------------------------
int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0);
@@ -559,11 +558,11 @@ SMESH_ActorDef::SMESH_ActorDef()
my2DActor->SetQuadraticArcMode(true);
my1DActor->SetQuadraticArcMode(true);
}
-
+
int aQuadraticAngle = mgr->integerValue( "SMESH", "max_angle", 2);
myHighlitableActor->SetQuadraticArcAngle(aQuadraticAngle);
my2DActor->SetQuadraticArcAngle(aQuadraticAngle);
-
+
// Set colors of the name actor
SMESH::GetColor( "SMESH", "default_grp_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
@@ -619,8 +618,8 @@ SMESH_ActorDef::~SMESH_ActorDef()
// myControlActor->Delete(); myControlActor == my2DActor
myNodeExtProp->Delete();
- myNodeExtActor->Delete();
-
+ myNodeExtActor->Delete();
+
my1DProp->Delete();
my1DActor->Delete();
my1DExtProp->Delete();
@@ -632,8 +631,8 @@ SMESH_ActorDef::~SMESH_ActorDef()
myBallActor->Delete();
//my0DExtProp->Delete();
//my0DExtActor->Delete();
-
- myImplicitBoolean->Delete();
+
+ myImplicitBoolean->Delete();
#ifndef DISABLE_PLOT2DVIEWER
if(my2dHistogram) {
@@ -656,7 +655,7 @@ void SMESH_ActorDef::Delete()
}
void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
-{
+{
if(myNodeActor) {
myNodeActor->SetPointsLabeled(theIsPointsLabeled);
SetRepresentation(GetRepresentation());
@@ -667,7 +666,7 @@ void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
void SMESH_ActorDef::SetPointsFontProperties( SMESH::LabelFont theFamily, int theSize,
bool theBold, bool theItalic, bool theShadow,
vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b )
-{
+{
if(myNodeActor) {
myNodeActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
SetRepresentation( GetRepresentation() );
@@ -678,7 +677,7 @@ void SMESH_ActorDef::SetPointsFontProperties( SMESH::LabelFont theFamily, int th
void SMESH_ActorDef::SetCellsFontProperties( SMESH::LabelFont theFamily, int theSize,
bool theBold, bool theItalic, bool theShadow,
vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b )
-{
+{
if(my3DActor) {
my3DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
SetRepresentation( GetRepresentation() );
@@ -723,10 +722,10 @@ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
if(my0DActor)
my0DActor->SetCellsLabeled(theIsCellsLabeled);
-
+
if(myBallActor)
myBallActor->SetCellsLabeled(theIsCellsLabeled);
-
+
myTimeStamp->Modified();
}
@@ -801,7 +800,7 @@ bool SMESH_ActorDef::GetFacesOrientation3DVectors()
}
-void
+void
SMESH_ActorDef::
SetControlMode(eControl theMode)
{
@@ -809,12 +808,16 @@ SetControlMode(eControl theMode)
}
-void
+void
SMESH_ActorDef::
SetControlMode(eControl theMode,
bool theCheckEntityMode)
{
- SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+ vtkLookupTable* lookupTable = static_cast(myScalarBarActor->GetLookupTable());
+ bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
+ lookupTable->SetScale(VTK_SCALE_LINEAR);
+
+ SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
if( !mgr )
return;
@@ -1036,7 +1039,7 @@ SetControlMode(eControl theMode,
if (!myIsEntityModeCache){
myEntityModeCache = GetEntityMode();
myIsEntityModeCache=true;
- }
+ }
SetEntityMode(eEdges);
}
else if(myControlActor == my2DActor) {
@@ -1048,7 +1051,7 @@ SetControlMode(eControl theMode,
if (!myIsEntityModeCache){
myEntityModeCache = GetEntityMode();
myIsEntityModeCache=true;
- }
+ }
SetEntityMode(eFaces);
break;
default:
@@ -1062,7 +1065,7 @@ SetControlMode(eControl theMode,
if (!myIsEntityModeCache){
myEntityModeCache = GetEntityMode();
myIsEntityModeCache=true;
- }
+ }
SetEntityMode(eVolumes);
}
}
@@ -1080,15 +1083,22 @@ SetControlMode(eControl theMode,
myTimeStamp->Modified();
Modified();
+
+ lookupTable = static_cast(myScalarBarActor->GetLookupTable());
+ double * range = lookupTable->GetRange();
+
+ if (isLogarithmic && range[0] > 1e-07 && range[1] > 1e-07)
+ lookupTable->SetScale(VTK_SCALE_LOG10);
+
Update();
}
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
-
+
//myHighlightActor->AddToRender(theRenderer);
- theRenderer->AddActor(myBaseActor);
+ theRenderer->AddActor(myBaseActor);
theRenderer->AddActor(myNodeExtActor);
theRenderer->AddActor(my1DExtActor);
@@ -1103,7 +1113,7 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
//theRenderer->AddActor(my0DExtActor);
theRenderer->AddActor(myHighlitableActor);
-
+
theRenderer->AddActor2D(myScalarBarActor);
// the superclass' method should be called at the end
@@ -1137,8 +1147,8 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
}
-bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
- const char* theEntry,
+bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
+ const char* theEntry,
const char* theName,
int theIsClear)
{
@@ -1155,23 +1165,23 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
-
+
my0DActor->Init(myVisualObj,myImplicitBoolean);
myBallActor->Init(myVisualObj,myImplicitBoolean);
//my0DExtActor->Init(myVisualObj,myImplicitBoolean);
-
+
my1DActor->Init(myVisualObj,myImplicitBoolean);
my1DExtActor->Init(myVisualObj,myImplicitBoolean);
-
+
my2DActor->Init(myVisualObj,myImplicitBoolean);
my2DExtActor->Init(myVisualObj,myImplicitBoolean);
my3DActor->Init(myVisualObj,myImplicitBoolean);
my3DExtActor->Init(myVisualObj,myImplicitBoolean);
-
+
my0DActor->GetMapper()->SetLookupTable(myLookupTable);
myBallActor->GetMapper()->SetLookupTable(myLookupTable);
//my0DExtActor->GetMapper()->SetLookupTable(myLookupTable);
-
+
my1DActor->GetMapper()->SetLookupTable(myLookupTable);
my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
@@ -1179,7 +1189,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
my2DExtActor->GetMapper()->SetLookupTable(myLookupTable);
my3DActor->GetMapper()->SetLookupTable(myLookupTable);
my3DExtActor->GetMapper()->SetLookupTable(myLookupTable);
-
+
vtkFloatingPointType aFactor, aUnits;
my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
@@ -1197,7 +1207,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
int aMode = mgr->integerValue( "SMESH", "display_mode" );
SetRepresentation(-1);
-
+
if(aMode == 0){
SetRepresentation(eEdge);
}else if(aMode == 1){
@@ -1205,7 +1215,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
}else if(aMode == 2){
SetRepresentation(ePoint);
}
-
+
if(aMode == 3){
SetShrink();
}
@@ -1238,7 +1248,7 @@ void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
myNodeActor->SetTransform(theTransform);
myBaseActor->SetTransform(theTransform);
-
+
myHighlitableActor->SetTransform(theTransform);
myNodeExtActor->SetTransform(theTransform);
@@ -1274,7 +1284,7 @@ vtkMapper* SMESH_ActorDef::GetMapper(){
}
-vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){
+vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){
return myVisualObj->GetUnstructuredGrid();
}
@@ -1283,7 +1293,7 @@ bool SMESH_ActorDef::IsInfinitive(){
vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
aDataSet->Update();
myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
- ( aDataSet->GetNumberOfCells() == 1 &&
+ ( aDataSet->GetNumberOfCells() == 1 &&
aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX );
return SALOME_Actor::IsInfinitive();
}
@@ -1381,7 +1391,7 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
myNodeActor->VisibilityOff();
myBaseActor->VisibilityOff();
-
+
myNodeExtActor->VisibilityOff();
my0DActor->VisibilityOff();
@@ -1390,18 +1400,18 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
my1DActor->VisibilityOff();
my1DExtActor->VisibilityOff();
-
+
my2DActor->VisibilityOff();
my2DExtActor->VisibilityOff();
my3DActor->VisibilityOff();
my3DExtActor->VisibilityOff();
-
+
myScalarBarActor->VisibilityOff();
-
+
if(GetVisibility()){
if(theIsUpdateRepersentation)
SetRepresentation(GetRepresentation());
-
+
if(myControlMode != eNone){
switch(myControlMode){
case eFreeNodes:
@@ -1449,34 +1459,34 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
if(myEntityMode & eEdges && GetRepresentation() != ePoint){
my1DActor->VisibilityOn();
}
-
+
if(myEntityMode & eFaces && GetRepresentation() != ePoint){
my2DActor->VisibilityOn();
}
-
+
if(myEntityMode & eVolumes && GetRepresentation() != ePoint){
my3DActor->VisibilityOn();
}
-
- if(myNodeActor->GetPointsLabeled()){
+
+ if(myNodeActor->GetPointsLabeled()){
myNodeActor->VisibilityOn();
}
if(my0DActor)
my0DActor->UpdateLabels();
-
+
if(myBallActor)
myBallActor->UpdateLabels();
-
+
if(my1DActor)
my1DActor->UpdateLabels();
-
+
if(my2DActor)
my2DActor->UpdateLabels();
-
+
if(my3DActor)
- my3DActor->UpdateLabels();
- }
+ my3DActor->UpdateLabels();
+ }
#ifndef DISABLE_PLOT2DVIEWER
else
SMESH::ProcessIn2DViewers(this,SMESH::RemoveFrom2dViewer);
@@ -1597,7 +1607,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
//#ifdef VTK_HAVE_POLYHEDRON
aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
//#endif
-
+
aHightFilter->RegisterCellsWithType(VTK_TETRA);
aHightFilter->RegisterCellsWithType(VTK_VOXEL);
aHightFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
@@ -1620,7 +1630,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
}
void SMESH_ActorDef::SetRepresentation (int theMode)
-{
+{
int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
@@ -1642,7 +1652,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
case eSurface:
if (!aNbFaces && !aNbVolumes && !aNb0Ds && !aNbBalls) return;
break;
- }
+ }
myRepresentation = theMode;
}
@@ -1655,7 +1665,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
myIsShrunk = true;
} else {
SetShrink();
- }
+ }
}
myPickableActor = myBaseActor;
@@ -1696,7 +1706,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
my2DActor->SetQuadraticArcMode(true);
my2DExtActor->SetRepresentation(aReperesent);
-
+
my3DActor->SetProperty(aPropVN);
my3DActor->SetBackfaceProperty(aPropVR);
my3DActor->SetRepresentation(aReperesent);
@@ -1721,7 +1731,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
aReperesent = SMESH_DeviceActor::eInsideframe;
break;
}
-
+
if(aQuadraticMode == SMESH_Actor::eLines)
my1DActor->SetQuadraticArcMode(false);
else if(aQuadraticMode == SMESH_Actor::eArcs)
@@ -1753,7 +1763,7 @@ void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
SetRepresentation(GetRepresentation());
}
-bool SMESH_ActorDef::GetPointRepresentation(){
+bool SMESH_ActorDef::GetPointRepresentation(){
return myIsPointsVisible || myNodeActor->GetPointsLabeled();
}
@@ -1776,7 +1786,7 @@ void SMESH_ActorDef::UpdateHighlight(){
myBallActor->SetProperty(myBallPreselectProp);
} else if(anIsVisible){
myBallActor->SetProperty(myBallProp);
- (myRepresentation == eSurface) ?
+ (myRepresentation == eSurface) ?
myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp);
}
if(GetUnstructuredGrid()->GetNumberOfCells()) {
@@ -1813,10 +1823,10 @@ void SMESH_ActorDef::highlight(bool theHighlight){
}
-void SMESH_ActorDef::SetPreSelected(bool thePreselect){
+void SMESH_ActorDef::SetPreSelected(bool thePreselect){
if ( myIsPreselected == thePreselect )
return;
- myIsPreselected = thePreselect;
+ myIsPreselected = thePreselect;
UpdateHighlight();
}
@@ -1870,30 +1880,30 @@ void SMESH_ActorDef::Update(){
if(my0DActor)
my0DActor->UpdateLabels();
-
+
if(myBallActor)
myBallActor->UpdateLabels();
-
+
if(my1DActor)
my1DActor->UpdateLabels();
-
+
if(my2DActor)
my2DActor->UpdateLabels();
if(my3DActor)
my3DActor->UpdateLabels();
-
+
if(myIsFacesOriented){
SetFacesOriented(myIsFacesOriented);
}
-
+
if(myVisualObj->GetEntitiesFlag()) {
myEntityMode |= myVisualObj->GetEntitiesState();
}
-
+
SetEntityMode(GetEntityMode());
SetVisibility(GetVisibility());
-
+
myTimeStamp->Modified();
Modified();
}
@@ -1940,7 +1950,7 @@ void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType
if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) )
if( aGroupObj->GetElementType() == SMDSAbs_Face )
myNameActor->SetBackgroundColor(r,g,b);
-
+
myDeltaBrightness = delta;
QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
@@ -1958,7 +1968,7 @@ void SMESH_ActorDef::SetVolumeColor(vtkFloatingPointType r,vtkFloatingPointType
if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) )
if( aGroupObj->GetElementType() == SMDSAbs_Volume )
myNameActor->SetBackgroundColor(r,g,b);
-
+
myDeltaVBrightness = delta;
QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
@@ -1994,7 +2004,7 @@ void SMESH_ActorDef::GetOutlineColor(vtkFloatingPointType& r,vtkFloatingPointTyp
}
-void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
+void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myNodeProp->SetColor(r,g,b);
myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b);
if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) )
@@ -2003,11 +2013,11 @@ void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,
Modified();
}
-void SMESH_ActorDef::GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
+void SMESH_ActorDef::GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
::GetColor(myNodeProp,r,g,b);
}
-void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
+void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
my0DProp->SetColor(r,g,b);
if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) )
if( aGroupObj->GetElementType() == SMDSAbs_0DElement )
@@ -2015,11 +2025,11 @@ void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vt
Modified();
}
-void SMESH_ActorDef::Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
+void SMESH_ActorDef::Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
::GetColor(my0DProp,r,g,b);
}
-void SMESH_ActorDef::SetBallColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
+void SMESH_ActorDef::SetBallColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myBallProp->SetColor(r,g,b);
if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) )
if( aGroupObj->GetElementType() == SMDSAbs_Ball )
@@ -2027,27 +2037,27 @@ void SMESH_ActorDef::SetBallColor(vtkFloatingPointType r,vtkFloatingPointType g,
Modified();
}
-void SMESH_ActorDef::GetBallColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
+void SMESH_ActorDef::GetBallColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
::GetColor(myBallProp,r,g,b);
}
-void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
+void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myHighlightProp->SetColor(r,g,b);
myBallHighlightProp->SetColor(r,g,b);
Modified();
}
-void SMESH_ActorDef::GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
+void SMESH_ActorDef::GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
::GetColor(myHighlightProp,r,g,b);
}
-void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
+void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myPreselectProp->SetColor(r,g,b);
myBallPreselectProp->SetColor(r,g,b);
Modified();
}
-void SMESH_ActorDef::GetPreHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
+void SMESH_ActorDef::GetPreHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
::GetColor(myPreselectProp,r,g,b);
}
@@ -2061,7 +2071,7 @@ void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
myEdgeProp->SetLineWidth(theVal);
my1DProp->SetLineWidth(theVal + aLineWidthInc);
- my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
+ my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
my2DExtProp->SetLineWidth(theVal + aLineWidthInc);
my3DExtProp->SetLineWidth(theVal + aLineWidthInc);
myOutLineProp->SetLineWidth(theVal);
@@ -2153,7 +2163,7 @@ SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
my3DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
}
-vtkIdType
+vtkIdType
SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane)
{
if(thePlane){
@@ -2184,7 +2194,7 @@ GetNumberOfClippingPlanes()
return myCippingPlaneCont.size();
}
-vtkPlane*
+vtkPlane*
SMESH_ActorDef::
GetClippingPlane(vtkIdType theID)
{
@@ -2312,7 +2322,7 @@ void SMESH_ActorDef::UpdateScalarBar()
int coloringType = mgr->integerValue("SMESH", "distribution_coloring_type", 0);
myScalarBarActor->SetDistributionColoringType(coloringType);
-
+
QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
QColor(255, 255, 255));
double rgb[3];
@@ -2321,7 +2331,7 @@ void SMESH_ActorDef::UpdateScalarBar()
rgb[2]= distributionColor.blue()/255.;
myScalarBarActor->SetDistributionColor(rgb);
-
+
}
void SMESH_ActorDef::UpdateDistribution()
@@ -2340,7 +2350,8 @@ void SMESH_ActorDef::UpdateDistribution()
elemIds.push_back( (*e)->GetID());
vtkLookupTable* lookupTable = static_cast(myScalarBarActor->GetLookupTable());
double * range = lookupTable->GetRange();
- fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range);
+ bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
+ fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
myScalarBarActor->SetDistribution(nbEvents);
}
}
@@ -2394,17 +2405,17 @@ SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() {
if(my2dHistogram)
my2dHistogram->clearAllPoints();
-
+
if(SMESH::Controls::NumericalFunctor* fun =
dynamic_cast(myFunctor.get()))
{
-
+
if(!my2dHistogram) {
my2dHistogram = new SPlot2d_Histogram();
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(getIO()->getEntry(),"SMESH",getName());
my2dHistogram->setIO(anIO);
}
-
+
int nbIntervals = myScalarBarActor->GetMaximumNumberOfColors();
std::vector nbEvents;
std::vector funValues;
@@ -2412,22 +2423,23 @@ SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() {
if ( ! dynamic_cast(myVisualObj.get()))
dynamic_cast(myVisualObj.get())->GetEntities( fun->GetType(), elems );
std::vector elemIds;
-
+
for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
elemIds.push_back( (*e)->GetID());
vtkLookupTable* lookupTable = static_cast(myScalarBarActor->GetLookupTable());
double * range = lookupTable->GetRange();
- fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range);
+ bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
+ fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
- for ( int i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
+ for ( int i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
my2dHistogram->addPoint(funValues[i] + (funValues[i+1] - funValues[i])/2.0, static_cast(nbEvents[i]));
if(funValues.size() >= 2)
my2dHistogram->setWidth((funValues[1] - funValues[0]) * 0.8) ;
}
-
+
//Color of the histogram
if(myScalarBarActor->GetDistributionColoringType() == SMESH_MULTICOLOR_TYPE)
my2dHistogram->setAutoAssign(true);
@@ -2438,7 +2450,7 @@ SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() {
my2dHistogram->setColor(aColor);
}
-
+
return my2dHistogram;
}
#endif
diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx
index b509f6ac1..5c87d1c2c 100644
--- a/src/SMESHGUI/SMESHGUI.cxx
+++ b/src/SMESHGUI/SMESHGUI.cxx
@@ -1108,9 +1108,10 @@
vtkLookupTable* lookupTable =
static_cast(aScalarBarActor->GetLookupTable());
double * minmax = lookupTable->GetRange();
+ bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
std::vector nbEvents;
std::vector funValues;
- aNumFun->GetHistogram( nbIntervals, nbEvents, funValues, elements, minmax );
+ aNumFun->GetHistogram( nbIntervals, nbEvents, funValues, elements, minmax, isLogarithmic );
QString anInitialPath = "";
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
anInitialPath = QDir::currentPath();
@@ -1603,7 +1604,7 @@
aControl = SMESH_Actor::eCoincidentElems3D;
break;
}
-
+
anActor->SetControlMode(aControl);
anActor->GetScalarBarActor()->SetTitle( functorToString( anActor->GetFunctor() ).toLatin1().constData() );
SMESH::RepaintCurrentView();
diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx
index 7f0a861ae..4e3f3d5b5 100644
--- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx
+++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx
@@ -18,13 +18,12 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_Preferences_ScalarBarDlg.cxx
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
// SMESH includes
-//
+
#include "SMESHGUI_Preferences_ScalarBarDlg.h"
#include "SMESHGUI.h"
@@ -130,22 +129,28 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
/******************************************************************************/
// Scalar range
myRangeGrp = new QGroupBox ( tr( "SMESH_RANGE_SCALARBAR" ), this );
- QHBoxLayout* myRangeGrpLayout = new QHBoxLayout( myRangeGrp );
+ //QHBoxLayout* myRangeGrpLayout = new QHBoxLayout( myRangeGrp );
+ QGridLayout* myRangeGrpLayout = new QGridLayout( myRangeGrp );
myRangeGrpLayout->setSpacing( SPACING_SIZE ); myRangeGrpLayout->setMargin( MARGIN_SIZE );
-
+
myMinEdit = new QLineEdit( myRangeGrp );
myMinEdit->setMinimumWidth( MINIMUM_WIDTH );
myMinEdit->setValidator( new QDoubleValidator( this ) );
-
+
myMaxEdit = new QLineEdit( myRangeGrp );
myMaxEdit->setMinimumWidth( MINIMUM_WIDTH );
myMaxEdit->setValidator( new QDoubleValidator( this ) );
-
- myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MIN" ), myRangeGrp ) );
- myRangeGrpLayout->addWidget( myMinEdit );
- myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MAX" ), myRangeGrp ) );
- myRangeGrpLayout->addWidget( myMaxEdit );
-
+
+ myLogarithmicCheck = new QCheckBox (myRangeGrp);
+ myLogarithmicCheck->setText(tr("SMESH_LOGARITHMIC_SCALARBAR"));
+ myLogarithmicCheck->setChecked(false);
+
+ myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MIN" ), myRangeGrp ), 0, 0, 1, 1 );
+ myRangeGrpLayout->addWidget( myMinEdit, 0, 1, 1, 1 );
+ myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MAX" ), myRangeGrp ), 0, 2, 1, 1 );
+ myRangeGrpLayout->addWidget( myMaxEdit, 0, 3, 1, 1 );
+ myRangeGrpLayout->addWidget( myLogarithmicCheck, 1, 0, 1, 4 );
+
aTopLayout->addWidget( myRangeGrp );
/******************************************************************************/
@@ -255,19 +260,19 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
myYSpin = new SMESHGUI_SpinBox(myOriginDimGrp);
myYSpin->setAcceptNames( false );
- myYSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
+ myYSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
myYSpin->setMinimumWidth( MINIMUM_WIDTH );
myYSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myWidthSpin = new SMESHGUI_SpinBox(myOriginDimGrp);
myWidthSpin->setAcceptNames( false );
- myWidthSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
+ myWidthSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
myWidthSpin->setMinimumWidth( MINIMUM_WIDTH );
myWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myHeightSpin = new SMESHGUI_SpinBox(myOriginDimGrp);
myHeightSpin->setAcceptNames( false );
- myHeightSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
+ myHeightSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
myHeightSpin->setMinimumWidth( MINIMUM_WIDTH );
myHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
@@ -297,18 +302,18 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
myDistribColorGrp->addButton(myDMonoColor);myDistribColorGrp->setId(myDMonoColor,1);
myDistribColorGrp->addButton(myDMultiColor);myDistribColorGrp->setId(myDMultiColor,2);
-
+
aDistributionGrpLayout->addWidget( myDMultiColor );
aDistributionGrpLayout->addWidget( myDMonoColor );
-
+
//Color of the Distribution in monocolor case:
myDistributionColorLbl = new QLabel( tr( "SMESH_DISTRIBUTION_COLOR" ), myDistributionGrp );
aDistributionGrpLayout->addWidget( myDistributionColorLbl );
myMonoColorBtn = new QtxColorButton( myDistributionGrp );
aDistributionGrpLayout->addWidget(myMonoColorBtn);
-
+
aTopLayout->addWidget(myDistributionGrp);
-
+
/******************************************************************************/
// Common buttons
myButtonGrp = new QGroupBox( this );
@@ -351,13 +356,13 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
myTitleFontCombo->setCurrentIndex(1);
if( f.family()=="Times")
myTitleFontCombo->setCurrentIndex(2);
-
+
myTitleBoldCheck->setChecked ( f.bold() );
myTitleItalicCheck->setChecked( f.italic() );
myTitleShadowCheck->setChecked( f.overline() );
}
-
- QColor labelColor = mgr->colorValue("SMESH", "scalar_bar_label_color",
+
+ QColor labelColor = mgr->colorValue("SMESH", "scalar_bar_label_color",
QColor(255, 255, 255));
myLabelsColorBtn->setColor(labelColor);
myLabelsFontCombo->setCurrentIndex(0);
@@ -369,7 +374,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
myLabelsFontCombo->setCurrentIndex(1);
if (f.family() == "Times")
myLabelsFontCombo->setCurrentIndex(2);
-
+
myLabelsBoldCheck ->setChecked( f.bold() );
myLabelsItalicCheck->setChecked( f.italic() );
myLabelsShadowCheck->setChecked( f.overline() );
@@ -391,7 +396,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
QString name = isHoriz ? "scalar_bar_horizontal_%1" : "scalar_bar_vertical_%1";
- myIniX = mgr->doubleValue("SMESH", name.arg( "x" ),
+ myIniX = mgr->doubleValue("SMESH", name.arg( "x" ),
myHorizRadioBtn->isChecked() ? DEF_HOR_X : DEF_VER_X);
myIniY = mgr->doubleValue("SMESH", name.arg( "y" ),
@@ -412,18 +417,16 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
int coloringType = mgr->integerValue("SMESH", "distribution_coloring_type", 0);
if( coloringType == SMESH_MONOCOLOR_TYPE ) {
myDMonoColor->setChecked(true);
- onDistributionChanged(myDistribColorGrp->id(myDMonoColor));
+ onDistributionChanged(myDistribColorGrp->id(myDMonoColor));
} else {
myDMultiColor->setChecked(true);
onDistributionChanged(myDistribColorGrp->id(myDMultiColor));
}
-
+
QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
QColor(255, 255, 255));
myMonoColorBtn->setColor(distributionColor);
-
-
// --> then init from selection if necessary
onSelectionChanged();
@@ -434,6 +437,8 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
connect( myApplyBtn, SIGNAL( clicked() ), this, SLOT( onApply() ) );
connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( onCancel() ) );
connect( myHelpBtn, SIGNAL(clicked()), this, SLOT( onHelp() ) );
+ connect( myMinEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( onMinMaxChanged() ) );
+ connect( myMaxEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( onMinMaxChanged() ) );
connect( myXSpin, SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
connect( myYSpin, SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
connect( aOrientationGrp, SIGNAL( buttonClicked( int ) ), this, SLOT( onOrientationChanged() ) );
@@ -528,9 +533,9 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
if( myDistributionGrp->isChecked() ) {
int ColoringType = myDMultiColor->isChecked() ? SMESH_MULTICOLOR_TYPE : SMESH_MONOCOLOR_TYPE;
distributionTypeChanged = (ColoringType != myScalarBarActor->GetDistributionColoringType());
- if(distributionTypeChanged)
+ if (distributionTypeChanged)
myScalarBarActor->SetDistributionColoringType(ColoringType);
-
+
if( !myDMultiColor->isChecked() ) {
QColor aTColor = myMonoColorBtn->color();
double rgb[3], oldRgb[3];;
@@ -551,29 +556,31 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
double oldMinMax[2] = { myLookupTable->GetRange()[0], myLookupTable->GetRange()[1] };
bool rangeChanges = ( fabs( oldMinMax[0] - aMin ) + fabs( oldMinMax[1] - aMax ) >
0.001 * ( aMax-aMin + oldMinMax[1]-oldMinMax[0] ));
-
+
bool nbColorsChanged = (myColorsSpin->value() != myScalarBarActor->GetMaximumNumberOfColors());
if(nbColorsChanged)
myScalarBarActor->SetMaximumNumberOfColors(myColorsSpin->value());
-
myLookupTable->SetRange( aMin, aMax );
myLookupTable->SetNumberOfTableValues(myColorsSpin->value());
+
+ bool scaleChanged = (myLogarithmicCheck->isChecked() != (myLookupTable->GetScale() == VTK_SCALE_LOG10));
+ if (scaleChanged)
+ myLookupTable->SetScale(myLogarithmicCheck->isChecked() ? VTK_SCALE_LOG10 : VTK_SCALE_LINEAR);
+
myLookupTable->Build();
- if( nbColorsChanged || rangeChanges)
+ if (nbColorsChanged || rangeChanges || scaleChanged)
myActor->UpdateDistribution();
-
+
#ifndef DISABLE_PLOT2DVIEWER
- if( myActor->GetPlot2Histogram() &&
- (nbColorsChanged ||
+ if( myActor->GetPlot2Histogram() &&
+ (nbColorsChanged ||
rangeChanges ||
- distributionTypeChanged ||
+ distributionTypeChanged ||
colorChanged ))
SMESH::ProcessIn2DViewers(myActor);
#endif
-
-
SMESH::RepaintCurrentView();
return true;
@@ -601,7 +608,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onCancel()
void SMESHGUI_Preferences_ScalarBarDlg::onHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
- if (app)
+ if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
QString platform;
@@ -612,7 +619,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onHelp()
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
platform)).
arg(myHelpFileName));
}
@@ -639,9 +646,13 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
SMESH_ScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
if ( myScalarBarActor->GetLookupTable() ) {
- vtkFloatingPointType *range = myScalarBarActor->GetLookupTable()->GetRange();
+ vtkLookupTable* aLookupTable = static_cast(myScalarBarActor->GetLookupTable());
+
+ vtkFloatingPointType *range = aLookupTable->GetRange();
myMinEdit->setText( QString::number( range[0],'g',12 ) );
myMaxEdit->setText( QString::number( range[1],'g',12 ) );
+ myLogarithmicCheck->setChecked(aLookupTable->GetScale() == VTK_SCALE_LOG10);
+ myLogarithmicCheck->setEnabled(range[0] > 1e-07 && range[1] > 1e-07);
}
vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty();
@@ -682,15 +693,14 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
myMonoColorBtn->setColor( QColor( (int)( aTColor[0]*255 ), (int)( aTColor[1]*255 ), (int)( aTColor[2]*255 ) ) );
if ( coloringType == SMESH_MONOCOLOR_TYPE ) {
myDMonoColor->setChecked(true);
- onDistributionChanged(myDistribColorGrp->id(myDMonoColor));
+ onDistributionChanged(myDistribColorGrp->id(myDMonoColor));
} else {
myDMultiColor->setChecked(true);
onDistributionChanged(myDistribColorGrp->id(myDMultiColor));
}
myDistributionGrp->setChecked((bool)myScalarBarActor->GetDistributionVisibility());
onDistributionActivated(myScalarBarActor->GetDistributionVisibility());
-
-
+
myRangeGrp->setEnabled( true );
myFontGrp->setEnabled( true );
myLabColorGrp->setEnabled( true );
@@ -727,6 +737,22 @@ void SMESHGUI_Preferences_ScalarBarDlg::closeEvent( QCloseEvent* e )
QDialog::closeEvent( e );
}
+//=================================================================================================
+/*!
+ * SMESHGUI_Preferences_ScalarBarDlg::onMinMaxChanged
+ *
+ * Called when Scalar Range values are changed
+ */
+//=================================================================================================
+void SMESHGUI_Preferences_ScalarBarDlg::onMinMaxChanged()
+{
+ double aMin = myMinEdit->text().toDouble();
+ double aMax = myMaxEdit->text().toDouble();
+ bool isLogarithmicEnabled = (aMin > 1e-07 && aMax > 1e-07);
+ myLogarithmicCheck->setChecked(isLogarithmicEnabled);
+ myLogarithmicCheck->setEnabled(isLogarithmicEnabled);
+}
+
//=================================================================================================
/*!
* SMESHGUI_Preferences_ScalarBarDlg::onXYChanged
@@ -833,7 +859,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::initScalarBarFromResources()
QString name;
if (mgr){
// initialize from resoources
-
+
// horizontal
name = QString("scalar_bar_horizontal_%1");
if (mgr->hasValue("SMESH", name.arg( "x" )))
diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h
index 804b4aa6a..05dea0f59 100644
--- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h
+++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h
@@ -23,7 +23,7 @@
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_Preferences_ScalarBarDlg.h
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
-//
+
#ifndef SMESHGUI_PREFERENCES_SCALARBARDLG_H
#define SMESHGUI_PREFERENCES_SCALARBARDLG_H
@@ -78,6 +78,7 @@ protected slots:
void onHelp();
void onSelectionChanged();
void onXYChanged();
+ void onMinMaxChanged();
void onOrientationChanged();
void onDistributionChanged( int );
void onDistributionActivated( bool );
@@ -94,6 +95,7 @@ private:
QGroupBox* myRangeGrp;
QLineEdit* myMinEdit;
QLineEdit* myMaxEdit;
+ QCheckBox* myLogarithmicCheck;
QGroupBox* myFontGrp;
QtxColorButton* myTitleColorBtn;
diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts
index aa1c2add0..5e82b9bb1 100644
--- a/src/SMESHGUI/SMESH_msg_en.ts
+++ b/src/SMESHGUI/SMESH_msg_en.ts
@@ -1828,6 +1828,10 @@ Check algorithm documentation for supported geometry
SMESH_LENGTH
Length
+
+ SMESH_LOGARITHMIC_SCALARBAR
+ Logarithmic
+
SMESH_MAKE_GROUPS
Generate groups
diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts
index 5345d612b..b322da2b2 100755
--- a/src/SMESHGUI/SMESH_msg_fr.ts
+++ b/src/SMESHGUI/SMESH_msg_fr.ts
@@ -1800,6 +1800,10 @@ Référez-vous à la documentation sur l'algorithme et la géométrie suppo
SMESH_LENGTH
Longueur
+
+ SMESH_LOGARITHMIC_SCALARBAR
+ Logarithmic
+
SMESH_MAKE_GROUPS
Générer les groupes
diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx
index 523bf4677..f7040c5ab 100644
--- a/src/SMESH_I/SMESH_Filter_i.cxx
+++ b/src/SMESH_I/SMESH_Filter_i.cxx
@@ -18,13 +18,12 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : SMESH_Filter_i.cxx
// Author : Alexey Petrov, OCC
// Module : SMESH
-//
+
#include "SMESH_Filter_i.hxx"
#include "SMDS_ElemIterator.hxx"
@@ -580,12 +579,12 @@ CORBA::Double NumericalFunctor_i::GetValue( CORBA::Long theId )
return myNumericalFunctorPtr->GetValue( theId );
}
-SMESH::Histogram* NumericalFunctor_i::GetHistogram(CORBA::Short nbIntervals)
+SMESH::Histogram* NumericalFunctor_i::GetHistogram(CORBA::Short nbIntervals, CORBA::Boolean isLogarithmic)
{
std::vector nbEvents;
std::vector funValues;
std::vector elements;
- myNumericalFunctorPtr->GetHistogram(nbIntervals,nbEvents,funValues,elements);
+ myNumericalFunctorPtr->GetHistogram(nbIntervals,nbEvents,funValues,elements,0,isLogarithmic);
#ifdef WIN32
nbIntervals = CORBA::Short( min( nbEvents.size(), funValues.size() - 1));
diff --git a/src/SMESH_I/SMESH_Filter_i.hxx b/src/SMESH_I/SMESH_Filter_i.hxx
index cb82aa6d5..d874819a8 100644
--- a/src/SMESH_I/SMESH_Filter_i.hxx
+++ b/src/SMESH_I/SMESH_Filter_i.hxx
@@ -18,13 +18,12 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : SMESH_Filter_i.hxx
// Author : Alexey Petrov, OCC
// Module : SMESH
-//
+
#ifndef _SMESH_FILTER_I_HXX_
#define _SMESH_FILTER_I_HXX_
@@ -162,7 +161,7 @@ namespace SMESH
{
public:
CORBA::Double GetValue( CORBA::Long theElementId );
- SMESH::Histogram* GetHistogram(CORBA::Short nbIntervals);
+ SMESH::Histogram* GetHistogram(CORBA::Short nbIntervals, CORBA::Boolean isLogarithmic);
void SetPrecision( CORBA::Long thePrecision );
CORBA::Long GetPrecision();
Controls::NumericalFunctorPtr GetNumericalFunctor();