[vtkusers] How can I highlight a picked cell?

Mike Taverne mtaverne at engits.com
Thu May 7 09:11:30 EDT 2009


Hi,

What is the best way to highlight a picked cell on a surface
(representation of a vtkUnstructuredGrid)?
Do I have to create a new actor or can this be done by coloring just one
cell of the surface?

Here are some excerpts from the current code:

        vtkUnstructuredGrid *grid;

        class vtkEgBoundaryCodesFilter : public vtkEgGridFilter
        class vtkEgGridFilter : public vtkUnstructuredGridAlgorithm,
public EgVtkObject

        bcodes_filter = vtkEgBoundaryCodesFilter::New();
        bcodes_filter->SetInput(grid);

        surface_filter = vtkGeometryFilter::New();
        surface_filter->SetInput(bcodes_filter->GetOutput());

        boundary_pd = vtkPolyData::New();
        boundary_pd->DeepCopy(surface_filter->GetOutput());

        surface_mapper = vtkPolyDataMapper::New();
        surface_mapper->SetInput(boundary_pd);

        surface_actor = vtkActor::New();
        surface_actor->SetBackfaceProperty(backface_property);
        surface_actor->GetProperty()->SetColor(0.5,1,0.5);
        surface_actor->GetBackfaceProperty()->SetColor(1,1,0.5);
        surface_actor->SetMapper(surface_mapper);

Basically, I want to highlight one cell from the grid/surface_actor (and
more than one eventually), while still keeping global colors for the
front and back of the surface.




More information about the vtkusers mailing list