[vtkusers] Re: vtkSelectVisiblePoints
Simon Bulman
S.D.Bulman at swansea.ac.uk
Wed Apr 4 09:19:38 EDT 2001
Hello all,
My troubles with vtkSelectVisiblePoints continues......
So I have tried to go back to basics, but alas anouther problem occurs. Here is my code.
=============================================================================
void PolyPost_PresentationMeshRegionNumbers::_ComputeNodeNumbersPrs (void)
{
// Get the grid and the node ids from the mesh region.
vtkUnstructuredGrid* grid = _region->GetGrid();
vtkIdList* ids = _region->GetPointIds();
// Convert the regions unstructured mesh to polygonal data.
vtkGeometryFilter* filter = vtkGeometryFilter::New();
filter->SetInput(grid);
// Set the scalar data of the PolyData to the node numbers of the mesh region.
vtkScalars* scalars = vtkScalars::New(VTK_INT);
for (int inode = 0; inode <= grid->GetNumberOfPoints(); ++inode)
{
scalars->InsertScalar(inode,ids->GetId(inode));
}
filter->GetOutput()->GetPointData()->SetScalars(scalars);
// Create a labeled data mapper.
vtkLabeledDataMapper* mapper = vtkLabeledDataMapper::New();
mapper->SetInput(filter->GetOutput());
mapper->SetLabelFormat("%i");
mapper->SetLabelModeToLabelScalars();
// Create an actor.
vtkActor2D* actor = vtkActor2D::New();
actor->SetMapper(mapper);
// Add the actor to the props list.
_props->AddItem(actor);
// Clean up.
filter->Delete();
scalars->Delete();
mapper->Delete();
actor->Delete();
}
=============================================================================
The error:
ERROR: In D:\vtk-daily\vtk\imaging\vtkLabeledDataMapper.cxx, line 240
vtkLabeledDataMapper (01684DB0): Need input data to render labels
Now I would of thought that line
filter->GetOutput()->GetPointData()->SetScalars(scalars);
has set the scalar values. Am I wrong??? is there some funny referencing going on here???
Thanks for any help, once this works I can try to use the vtkSelectVisiblePoints class again.
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010404/f86610d7/attachment.htm>
More information about the vtkusers
mailing list