[vtkusers] Tree Depth First Traversal Animation

Jeff Baumes jeff.baumes at kitware.com
Wed Apr 7 09:42:07 EDT 2010


On Sat, Apr 3, 2010 at 2:45 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> I am trying to make a demo of a depth first traversal of a graph.
> http://www.vtk.org/Wiki/VTK/Examples/Graph/DFSAnimation
> The idea is to start with a tree of red vertices, and color the next vertex
> in the traversal blue every 1 second. It almost works - the vertices change
> color if you interact with the window (i.e. click the mouse). I thought the
> couple of calls to Render() at the end of the timer callback would have
> refreshed the window automatically?

Try adding

this->Tree->Modified();

after your SetValue() call. For efficiency, SetValue() does nothing
other than change the raw array data, so does not mark the array (and
hence the tree) modified, so the pipeline will not update upon
rendering. To render, you should just do

this->GraphLayoutView->Render();

> Also, the vertices all return to red
> after the last vertex is reached?

The colors go back to all red because all vertices have the same
value. The color map automatically scales to the range of the data. To
use the range in the lookup table, do:

theme->ScalePointLookupTableOff();

Jeff



More information about the vtkusers mailing list