mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-14 21:30:33 +05:00
0020948]: EDF 1468 SMESH: Histogram of the quality controls
Take into account the range of values of histogram
This commit is contained in:
parent
938bc72f7a
commit
576f56ddf8
@ -2036,7 +2036,9 @@ void SMESH_ActorDef::UpdateDistribution()
|
|||||||
std::vector<int> elemIds;
|
std::vector<int> elemIds;
|
||||||
for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
|
for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
|
||||||
elemIds.push_back( (*e)->GetID());
|
elemIds.push_back( (*e)->GetID());
|
||||||
fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds);
|
vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
|
||||||
|
double * range = lookupTable->GetRange();
|
||||||
|
fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range);
|
||||||
myScalarBarActor->SetDistribution(nbEvents);
|
myScalarBarActor->SetDistribution(nbEvents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,6 +140,7 @@
|
|||||||
#include <vtkRenderer.h>
|
#include <vtkRenderer.h>
|
||||||
#include <vtkPlane.h>
|
#include <vtkPlane.h>
|
||||||
#include <vtkCallbackCommand.h>
|
#include <vtkCallbackCommand.h>
|
||||||
|
#include <vtkLookupTable.h>
|
||||||
|
|
||||||
// SALOME KERNEL includes
|
// SALOME KERNEL includes
|
||||||
#include <SALOMEDS_Study.hxx>
|
#include <SALOMEDS_Study.hxx>
|
||||||
@ -799,10 +800,13 @@
|
|||||||
elements[i] = ids[i];
|
elements[i] = ids[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int nbRanges = aScalarBarActor->GetMaximumNumberOfColors();
|
int nbIntervals = aScalarBarActor->GetMaximumNumberOfColors();
|
||||||
|
vtkLookupTable* lookupTable =
|
||||||
|
static_cast<vtkLookupTable*>(aScalarBarActor->GetLookupTable());
|
||||||
|
double * minmax = lookupTable->GetRange();
|
||||||
std::vector<int> nbEvents;
|
std::vector<int> nbEvents;
|
||||||
std::vector<double> funValues;
|
std::vector<double> funValues;
|
||||||
aNumFun->GetHistogram( nbRanges, nbEvents, funValues, elements );
|
aNumFun->GetHistogram( nbIntervals, nbEvents, funValues, elements, minmax );
|
||||||
QString anInitialPath = "";
|
QString anInitialPath = "";
|
||||||
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
|
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
|
||||||
anInitialPath = QDir::currentPath();
|
anInitialPath = QDir::currentPath();
|
||||||
|
@ -509,8 +509,6 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
|
|||||||
myScalarBarActor->SetLabelTextProperty( aLabelsTextPrp );
|
myScalarBarActor->SetLabelTextProperty( aLabelsTextPrp );
|
||||||
|
|
||||||
myScalarBarActor->SetNumberOfLabels( myLabelsSpin->value() );
|
myScalarBarActor->SetNumberOfLabels( myLabelsSpin->value() );
|
||||||
if( myColorsSpin->value() != myScalarBarActor->GetMaximumNumberOfColors() )
|
|
||||||
myActor->UpdateDistribution();
|
|
||||||
|
|
||||||
if ( myHorizRadioBtn->isChecked() )
|
if ( myHorizRadioBtn->isChecked() )
|
||||||
myScalarBarActor->SetOrientationToHorizontal();
|
myScalarBarActor->SetOrientationToHorizontal();
|
||||||
@ -540,9 +538,16 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
|
|||||||
double aMax = myMaxEdit->text().toDouble();
|
double aMax = myMaxEdit->text().toDouble();
|
||||||
vtkLookupTable* myLookupTable =
|
vtkLookupTable* myLookupTable =
|
||||||
static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
|
static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
|
||||||
|
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] ));
|
||||||
myLookupTable->SetRange( aMin, aMax );
|
myLookupTable->SetRange( aMin, aMax );
|
||||||
myLookupTable->SetNumberOfTableValues(myColorsSpin->value());
|
myLookupTable->SetNumberOfTableValues(myColorsSpin->value());
|
||||||
myLookupTable->Build();
|
myLookupTable->Build();
|
||||||
|
|
||||||
|
if( myColorsSpin->value() != myScalarBarActor->GetMaximumNumberOfColors() || rangeChanges)
|
||||||
|
myActor->UpdateDistribution();
|
||||||
|
|
||||||
SMESH::RepaintCurrentView();
|
SMESH::RepaintCurrentView();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user