Commit 78108633 authored by Dave DeMarle's avatar Dave DeMarle
Browse files

fix a bug in value painting for cell arrays

I wasn't rendering the correct values because I didn't have the right
ids. With small data the cellarray and polydata indices happened to
be the same. In general they won't be.

Change-Id: Id1186c8fab3b0ba0ff2e640a6fd3d6075f690516
parent 51ebea64
...@@ -50,7 +50,7 @@ void PrepArray(bool byName, bool drawCell, int arrayIndex, int arrayComponent, ...@@ -50,7 +50,7 @@ void PrepArray(bool byName, bool drawCell, int arrayIndex, int arrayComponent,
{ {
arrayComponent = 0; arrayComponent = 0;
} }
cerr << "Drawing " << values->GetName() << " [" << arrayComponent << "]" << endl; cerr << "Drawing CELL " << values->GetName() << " [" << arrayComponent << "]" << endl;
if (!byName) if (!byName)
{ {
painter->SetInputArrayToProcess(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA, arrayIndex); painter->SetInputArrayToProcess(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA, arrayIndex);
...@@ -72,7 +72,7 @@ void PrepArray(bool byName, bool drawCell, int arrayIndex, int arrayComponent, ...@@ -72,7 +72,7 @@ void PrepArray(bool byName, bool drawCell, int arrayIndex, int arrayComponent,
{ {
arrayComponent = 0; arrayComponent = 0;
} }
cerr << "Drawing " << values->GetName() << " [" << arrayComponent << "]" << endl; cerr << "Drawing POINT " << values->GetName() << " [" << arrayComponent << "]" << endl;
if (!byName) if (!byName)
{ {
painter->SetInputArrayToProcess(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA, arrayIndex); painter->SetInputArrayToProcess(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA, arrayIndex);
...@@ -83,6 +83,8 @@ void PrepArray(bool byName, bool drawCell, int arrayIndex, int arrayComponent, ...@@ -83,6 +83,8 @@ void PrepArray(bool byName, bool drawCell, int arrayIndex, int arrayComponent,
} }
minmax = values->GetRange(arrayComponent); minmax = values->GetRange(arrayComponent);
} }
painter->SetInputComponentToProcess(arrayComponent);
painter->SetScalarRange(minmax[0], minmax[1]);
} }
int TestValuePainter(int argc, char* argv[]) int TestValuePainter(int argc, char* argv[])
...@@ -117,11 +119,7 @@ int TestValuePainter(int argc, char* argv[]) ...@@ -117,11 +119,7 @@ int TestValuePainter(int argc, char* argv[])
interactive = true; interactive = true;
} }
} }
/*
vtkSmartPointer<vtkXMLPolyDataReader> reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
reader->SetFileName("/Source/CINEMA/value-painter/vtkexample/data/test.vtp");
reader->Update();
*/
vtkSmartPointer<vtkPolyData> dataset = vtkSmartPointer<vtkPolyData>::New(); vtkSmartPointer<vtkPolyData> dataset = vtkSmartPointer<vtkPolyData>::New();
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New(); vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
dataset->SetPoints(points); dataset->SetPoints(points);
...@@ -238,6 +236,9 @@ int TestValuePainter(int argc, char* argv[]) ...@@ -238,6 +236,9 @@ int TestValuePainter(int argc, char* argv[])
{ {
PrepArray(_byName, _drawCell, j, k, dataset, values, painter, minmax); PrepArray(_byName, _drawCell, j, k, dataset, values, painter, minmax);
renderWindow->Render(); renderWindow->Render();
//std::string v;
//cin >> v;
} }
} }
} }
......
...@@ -432,7 +432,7 @@ void vtkValuePainter::DrawCells( ...@@ -432,7 +432,7 @@ void vtkValuePainter::DrawCells(
if (doingCells) if (doingCells)
{ {
double value = values->GetComponent(count, comp); double value = values->GetComponent(cellId, comp);
this->ValueToColor(value, minmax[0], scale, color); this->ValueToColor(value, minmax[0], scale, color);
renderer->GetRenderWindow()->GetPainterDeviceAdapter() renderer->GetRenderWindow()->GetPainterDeviceAdapter()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment