vtkBandedPolyDataContourFilter : VTK_SCALAR_MODE_VALUE is not honoured for verts & lines
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
vtkBandedPolyDataContourFilter
- VTK_SCALAR_MODE_VALUE is not honoured for verts & lines.
- outScalars not deleted if polydata contains only lines.
The following edits have been tested on version 4.2.
vtkBandedPolyDataContourFilter.cxx
At about line 300, after
outPD->SetScalars(outScalars);
insert
outScalars->Delete();
At about line 330, replace
for (i=0; i<npts; i++)
{
newVerts->InsertNextCell(1,pts+i);
idx = this->ComputeScalarIndex(inScalars->GetTuple1(pts[i]));
newScalars->InsertTuple1(cellId++,idx);
}
by
for (i=0; i<npts; i++)
{
cellId = this->InsertCell( newVerts, 1, pts+i, cellId, inScalars->GetTuple1( pts[i] ), newScalars );
}
At about line 400, replace
for (i=0; i<(npts-1); i++)
{
v = pts[i];
vR = pts[i+1];
newLines->InsertNextCell(2);
newScalars->InsertTuple1(cellId++,
this->ComputeScalarIndex(outScalars->GetTuple1(v)));
newLines->InsertCellPoint(v);
if ( (intLoc=edgeTable->IsEdge(v,vR)) != -1 )
{
intList->GetCell(intLoc,numIntPts,intPts);
if ( v < vR ) {intsIdx = 0; intsInc=1;} //order of the edge
else {intsIdx=numIntPts-1; intsInc=(-1);}
for ( ; intsIdx >= 0 && intsIdx < numIntPts; intsIdx += intsInc )
{
newLines->InsertCellPoint(intPts[intsIdx]);
newLines->InsertNextCell(2);
newScalars->InsertTuple1(cellId++, this->ComputeScalarIndex(
outScalars->GetTuple1(intPts[intsIdx])));
newLines->InsertCellPoint(intPts[intsIdx]);
}
}
newLines->InsertCellPoint(vR);
}
}
by
for (i=0; i<(npts-1); i++)
{
v = pts[i];
vR = pts[i+1];
vtkIdType newLineIds[2];
newLineIds[0] = v;
if ( (intLoc=edgeTable->IsEdge(v,vR)) != -1 )
{
intList->GetCell(intLoc,numIntPts,intPts);
if ( v < vR ) {intsIdx = 0; intsInc=1;} //order of the edge
else {intsIdx=numIntPts-1; intsInc=(-1);}
for ( ; intsIdx >= 0 && intsIdx < numIntPts; intsIdx += intsInc )
{
newLineIds[1] = intPts[ intsIdx ];
cellId = this->InsertCell( newLines, 2, newLineIds, cellId,
outScalars->GetTuple1( newLineIds[0] ), newScalars );
newLineIds[0] = newLineIds[1];
}
}
newLineIds[1] = vR;
cellId = this->InsertCell( newLines, 2, newLineIds, cellId,
outScalars->GetTuple1( newLineIds[0] ), newScalars );
}
At about line 800, delete
outScalars->Delete();