]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug PAL12693
authorenk <enk@opencascade.com>
Mon, 26 Jun 2006 12:27:29 +0000 (12:27 +0000)
committerenk <enk@opencascade.com>
Mon, 26 Jun 2006 12:27:29 +0000 (12:27 +0000)
EDF : VISU : ScalarMap on Deformed Shape doesn't work

src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx

index 14412af80da28366683e390e0d53cb47f92bf96f..b8c9f864be6ada36311026a50d621df06bcd5200 100644 (file)
@@ -120,6 +120,7 @@ VISU_ScalarMapOnDeformedShapePL
   
   // Sets geometry for merge filter
   myMergeFilter->SetGeometry(myDeformVectors->GetOutput());
+  myMergeFilter->SetScalars(myExtractorScalars->GetOutput());
   // Sets data to mapper
   myMapper->SetInput(myMergeFilter->GetOutput());
 }
@@ -158,11 +159,7 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::UpdateScalars()
 {
-  if(myScalars->GetCellData()->GetVectors() != NULL ||
-     myScalars->GetPointData()->GetVectors() != NULL)
-    myMergeFilter->SetScalars(myExtractorScalars->GetOutput());
-  else
-    myMergeFilter->SetScalars(GetScalars());
+  myExtractorScalars->Update();
 }
 
 /*!
@@ -194,7 +191,19 @@ VISU_ScalarMapOnDeformedShapePL
 {
   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();
 }