mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-05 13:34:17 +05:00
The fix to show all element with the same color when all values are almost equal.
This commit is contained in:
parent
b3cac3834a
commit
36ba432b4b
@ -295,30 +295,42 @@ SMESH_DeviceActor
|
||||
vtkIdType aNbCells = aGrid->GetNumberOfCells();
|
||||
aScalars->SetNumberOfComponents(1);
|
||||
aScalars->SetNumberOfTuples(aNbCells);
|
||||
double* range;// = aScalars->GetRange();
|
||||
|
||||
myVisualObj->UpdateFunctor(theFunctor);
|
||||
|
||||
using namespace SMESH::Controls;
|
||||
if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get())){
|
||||
if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get()))
|
||||
{
|
||||
for(vtkIdType i = 0; i < aNbCells; i++){
|
||||
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
|
||||
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
|
||||
double aValue = aNumericalFunctor->GetValue(anObjId);
|
||||
aScalars->SetValue(i,aValue);
|
||||
}
|
||||
}else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get())){
|
||||
range = aScalars->GetRange();
|
||||
if ( range[1] - range[0] < ( qMax(qAbs(range[0]),qAbs(range[1])) + 1e-100 ) * 1e-6 )
|
||||
{
|
||||
range[1] = range[0];
|
||||
for(vtkIdType i = 0; i < aNbCells; i++)
|
||||
aScalars->SetValue(i,range[0]);
|
||||
}
|
||||
}
|
||||
else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get()))
|
||||
{
|
||||
for(vtkIdType i = 0; i < aNbCells; i++){
|
||||
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
|
||||
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
|
||||
bool aValue = aPredicate->IsSatisfy(anObjId);
|
||||
aScalars->SetValue(i,aValue);
|
||||
}
|
||||
range = aScalars->GetRange();
|
||||
}
|
||||
|
||||
aDataSet->GetCellData()->SetScalars(aScalars);
|
||||
aScalars->Delete();
|
||||
|
||||
theLookupTable->SetRange(aScalars->GetRange());
|
||||
|
||||
theLookupTable->SetRange( range );
|
||||
theLookupTable->SetNumberOfTableValues(theScalarBarActor->GetMaximumNumberOfColors());
|
||||
theLookupTable->Build();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user