[vtkusers] Selecting/Updating Vertices and Edges in vtkGraph
Jeff Baumes
jeff.baumes at kitware.com
Tue Feb 3 11:04:04 EST 2009
> The first problem is:When I drag the mouse to make selections, only the edge
> colors change. As a note, the vertices are small spheres. Shouldn't vertex
> colors change as well?
It looks like you are using two vtkSurfaceRepresentation objects in a
vtkRenderView, is this correct? One for the glyphed vertices, and one
for the edges. The vertex sphere glyphs likely won't pick like you
want them to. The default picker is a hardware cell picker. It should
pick some cells on the spheres (try zooming in and selecting part of a
sphere), but won't select the vertex as a whole. You can make sure the
entire vertex sphere is selected by adding pedigree ids to the vertex
and edge data of the original graph (e.g.
g->GetEdgeData()->SetPedigreeIds(arr)), filling these arrays with
unique integer ids. Then you can call
view->SetSelectionType(vtkSelectionNode::PEDIGREEIDS).
> What is the best way of extracting vertices and edges from the
> vtkSelectionLink? I show how I attempt to do this in the following code. Any
> suggestions?
Your code for getting the selection seems reasonable. It should have
two nodes in the selection, one for vertices and the other for edges.
The selection field type of both will be CELL since you converted the
graph to polydata before giving it to the view.
More information about the vtkusers
mailing list