edu.mines.jtk.sgl
Class DrawList

java.lang.Object
  extended by edu.mines.jtk.sgl.DrawList

public class DrawList
extends java.lang.Object

A list of arrays of nodes (and their parents) to be drawn.

Each leaf node to be drawn is represented in this list by an array of nodes. The last node in each array is the leaf node to be drawn, the next to last node is that leaf node's parent, and so on. The first node in each array is the root node of the scene graph.

Conceptually, this list draws each array of nodes as follows. Starting with the first (top) node, and working from top to bottom, this list calls Node.drawBegin(DrawContext) for each node in the array. It then calls Node.draw(DrawContext) for the last (bottom) node. Finally, starting with that last node, and working from bottom to top, it calls Node.drawEnd(DrawContext) for each node in the array.

In practice, at least some parent nodes are likely to be the same from one array to the next. For example, the first (top) node is likely to be the same in all arrays of nodes. Therefore, during drawing, this list avoids any redundant calls to Node.drawEnd(DrawContext) and Node.drawBegin(DrawContext).

Version:
2005.05.26
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
DrawList()
           
 
Method Summary
 void append(Node[] nodes)
          Appends the specified array of nodes to this draw list.
 void draw(DrawContext dc)
          Draws all nodes in this list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawList

public DrawList()
Method Detail

append

public void append(Node[] nodes)
Appends the specified array of nodes to this draw list.

Parameters:
nodes - the array of nodes; referenced, not copied.

draw

public void draw(DrawContext dc)
Draws all nodes in this list.

Parameters:
dc - the draw context.