[vtkusers] vtkSelectVisiblePoints (last one honest)!

Simon Bulman S.D.Bulman at swansea.ac.uk
Wed Apr 4 12:39:10 EDT 2001


Ok, I am now happily displaying my point ids using the vtkSelectVisiblePoints class. :-)
Now I want to do the same for the cell ids. This is part of my code

------------------------------------------------------------------------------------------------------------------------------------------------------------------

    vtkUnstructuredGrid* grid = _region->GetGrid();
    vtkIdList*           ids  = _region->GetCellIds();

    // Set the cell scalar data of the grid to the element numbers of the mesh region.

    vtkScalars*  scalars = vtkScalars::New(VTK_INT);

    for (int icell = 0; icell <= grid->GetNumberOfCells(); ++icell)
    {
      scalars->InsertScalar(icell,ids->GetId(icell));
    }

    grid->GetCellData()->SetScalars(scalars);

    vtkCellCenters* cellCentres = vtkCellCenters::New();
    cellCentres->SetInput(grid);

    vtkSelectVisiblePoints* visCells = vtkSelectVisiblePoints::New();
    visCells->SetInput(cellCentres->GetOutput());
    visCells->SetRenderer(canvas->GetRenderer());
    visCells->SelectionWindowOn();
    visCells->SetSelection(minx,maxx,miny,maxy);

    // Create a labeled data mapper.

    vtkLabeledDataMapper* mapper = vtkLabeledDataMapper::New();
    mapper->SetInput(visCells->GetOutput());
    mapper->SetLabelFormat("%g");
    mapper->SetLabelModeToLabelScalars();
    mapper->SetFontSize(14);

    // Create an actor.

    vtkActor2D* actor = vtkActor2D::New();
    actor->SetMapper(mapper);
    actor->GetProperty()->SetColor(_elementNumberColor.r,_elementNumberColor.g,_elementNumberColor.b);

------------------------------------------------------------------------------------------------------------------------------------------------------------------

If I omit the vtkSelectVisiblePoints class and set the input for the mapper with the output from vtkCellCenters
then I see the cell numbers displayed as expected. However when I include the vtkSelectVisiblePoints I do not
see any numbers.

Any ideas???

Sorry to be a nuisance.
Simon

================================
S.D.Bulman.
Senior Research Officer.
University of Wales Swansea.

S.D.Bulman at swansea.ac.uk

(W) +44 (0)1792 513179
(H)  +44 (0)1792 511144
================================

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010404/010c883b/attachment.htm>


More information about the vtkusers mailing list