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,
{
arrayComponent = 0;
}
cerr << "Drawing " << values->GetName() << " [" << arrayComponent << "]" << endl;
cerr << "Drawing CELL " << values->GetName() << " [" << arrayComponent << "]" << endl;
if (!byName)
{
painter->SetInputArrayToProcess(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA, arrayIndex);
......@@ -72,7 +72,7 @@ void PrepArray(bool byName, bool drawCell, int arrayIndex, int arrayComponent,
{
arrayComponent = 0;
}
cerr << "Drawing " << values->GetName() << " [" << arrayComponent << "]" << endl;
cerr << "Drawing POINT " << values->GetName() << " [" << arrayComponent << "]" << endl;
if (!byName)
{
painter->SetInputArrayToProcess(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA, arrayIndex);
......@@ -83,6 +83,8 @@ void PrepArray(bool byName, bool drawCell, int arrayIndex, int arrayComponent,
}
minmax = values->GetRange(arrayComponent);
}
painter->SetInputComponentToProcess(arrayComponent);
painter->SetScalarRange(minmax[0], minmax[1]);
}
int TestValuePainter(int argc, char* argv[])
......@@ -117,11 +119,7 @@ int TestValuePainter(int argc, char* argv[])
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<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
dataset->SetPoints(points);
......@@ -238,6 +236,9 @@ int TestValuePainter(int argc, char* argv[])
{
PrepArray(_byName, _drawCell, j, k, dataset, values, painter, minmax);
renderWindow->Render();
//std::string v;
//cin >> v;
}
}
}
......
......@@ -432,7 +432,7 @@ void vtkValuePainter::DrawCells(
if (doingCells)
{
double value = values->GetComponent(count, comp);
double value = values->GetComponent(cellId, comp);
this->ValueToColor(value, minmax[0], scale, color);
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