// Sets geometry for merge filter
myMergeFilter->SetGeometry(myDeformVectors->GetOutput());
+ myMergeFilter->SetScalars(myExtractorScalars->GetOutput());
// Sets data to mapper
myMapper->SetInput(myMergeFilter->GetOutput());
}
VISU_ScalarMapOnDeformedShapePL
::UpdateScalars()
{
- if(myScalars->GetCellData()->GetVectors() != NULL ||
- myScalars->GetPointData()->GetVectors() != NULL)
- myMergeFilter->SetScalars(myExtractorScalars->GetOutput());
- else
- myMergeFilter->SetScalars(GetScalars());
+ myExtractorScalars->Update();
}
/*!
{
myScalars = theScalars;
vtkUnstructuredGrid* aScalars = GetScalars();
- myExtractorScalars->SetInput(aScalars);
+
+ if(aScalars->GetPointData()->GetScalars())
+ myExtractorScalars->SetInput(aScalars);
+ else if(aScalars->GetCellData()->GetScalars()){
+ //Approximate cell data values to point data by vtkCellDataToPointData filter.
+ vtkCellDataToPointData* aCellDataToPointData = vtkCellDataToPointData::New();
+ aCellDataToPointData->SetInput(aScalars);
+ aCellDataToPointData->Update();
+ myExtractorScalars->SetInput(aCellDataToPointData->GetUnstructuredGridOutput());
+ aCellDataToPointData->Delete();
+ } else {
+ myExtractorScalars->SetInput(aScalars);
+ }
Modified();
}