[vtkusers] vtkgraph and adding properties/fields to a vertex/node

planar3d planar3d at gmail.com
Mon Apr 23 19:56:27 EDT 2012


I can't figure out how to do this. I have a vtkgraph and I need to be able to
get a vertex by its unique identifier (aka vtkIdType) and add
properties/fields like an int or a string to it. I need to be able to modify
these fields as I pass through the graph and perform various transformations
on it like adding and deleting nodes.

As far as I can tell, you can sort of define fields by declaring these
property arrays as seen in the example here:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Graphs/LabelVerticesAndEdges

The problem with this is I see no correlation/synchronization between the
nodes/vertexID and these property arrays. The arrays have to be created up
front and then added to the vtkgraph. So I declare an array of NumVertices,
call it "weights" or "color" and then add it to the graph but what happens
when I call vtkgraph.removeVertex(ID)? A vertex is deleted but that array is
still NumVertices in size. Does the removeVertex function also delete the
corresponding vertex entry in array? I see no enforcement of this in
documentation? Do I have to manually update the property arrays whenever I
remove a vertex?

Also, I see no vtkgraph.getVertex(vtkIdType id) function and I see no way to
modify the properties/attributes of that vertex even if I had a handle to
said vertex. The GetVertexData function returns a vtkDataSetAttributes
array. I don't need a giant attributes array for all the vertices. I just
want the properties/attributes for one vertex so I can change/update some of
the values of those attributes.

--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkgraph-and-adding-properties-fields-to-a-vertex-node-tp5660744p5660744.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list