::UpdateScalars()
{
vtkPointSet* aScalars = GetScalars();
- vtkCellData *aInCellData = GetInput()->GetCellData();
-
- if(aScalars->GetPointData()->GetScalars())
- myExtractorScalars->SetInput(aScalars);
- else if(aScalars->GetCellData()->GetScalars() &&
- !aInCellData->GetAttribute(vtkDataSetAttributes::VECTORS)){
- //Approximate cell data values to point data by VISU_CellDataToPointData filter.
- VISU_CellDataToPointData* aCellDataToPointData = VISU_CellDataToPointData::New();
- aCellDataToPointData->SetInput(aScalars);
- aCellDataToPointData->Update();
- myExtractorScalars->SetInput(aCellDataToPointData->GetUnstructuredGridOutput());
- aCellDataToPointData->Delete();
- } else {
- myExtractorScalars->SetInput(aScalars);
- }
+ myExtractorScalars->SetInput(aScalars);
+
+ if(VISU::IsDataOnCells(aScalars))
+ myMapper->SetScalarModeToUseCellData();
+ else
+ myMapper->SetScalarModeToUsePointData();
}
::GetSourceRange(vtkFloatingPointType theRange[2])
{
myExtractorScalars->Update();
- myExtractorScalars->GetUnstructuredGridOutput()->GetScalarRange(theRange);
+ myExtractorScalars->GetOutput()->GetScalarRange(theRange);
}