anl.aida.viz3d
Class StackRenderer

java.lang.Object
  extended by anl.aida.viz3d.StackRenderer
All Implemented Interfaces:
java.util.EventListener, javax.media.opengl.GLEventListener

public class StackRenderer
extends java.lang.Object
implements javax.media.opengl.GLEventListener

Renders a 3D stack of stack items. Items can be rotated on and off the display.


Field Summary
private  boolean addKeyListener
           
private  boolean atBottom
           
private  boolean atTop
           
private  java.awt.Color background
           
private  javax.media.opengl.GLCanvas canvas
           
private static java.lang.String DEBUG_KEY
           
private  javax.media.opengl.glu.GLU glu
           
private  boolean initialized
           
private  java.util.List<StackItem> items
           
private  MouseRotate rotator
           
private  int stackIndex
           
private  com.sun.opengl.util.j2d.TextRenderer textRenderer
           
private  MouseTranslate translator
           
private  MouseWheelZoom wheelZoomer
           
private static float X_INTERVAL
           
private static float Z_INTERVAL
           
private  MouseZoom zoomer
           
 
Constructor Summary
StackRenderer(javax.media.opengl.GLCanvas canvas, java.awt.Color background)
          Creates a StackRenderer that will render to the specified canvas.
StackRenderer(javax.media.opengl.GLCanvas canvas, java.awt.Color background, boolean addKeyListener)
          Creates a StackRenderer that will render to the specified canvas.
 
Method Summary
 void addStackItem(StackItem item)
          Adds a StackItem to this StackRenderer.
 void display(javax.media.opengl.GLAutoDrawable drawable)
           
 void displayChanged(javax.media.opengl.GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged)
           
 void dispose()
          Disposes of any resources this StackRenderer or its items may be holding.
(package private)  javax.media.opengl.GLCanvas getCanvas()
          Gets the canvas associated with this drawable.
 java.lang.String getInfo()
          Gets a formatted descriptive string about this StackRenderer.
private  void glInit(javax.media.opengl.GL gl)
           
 void init(javax.media.opengl.GLAutoDrawable drawable)
           
 void jumpTo(int index, boolean updateDisplay)
          Jumps the top of the stack to the specified index.
 void jumpTo(StackItem item, boolean updateDisplay)
          Jumps the top of the stack to the StackItem
private  void listenerInit(javax.media.opengl.GLAutoDrawable drawable)
           
 void moveOff()
          Moves the current stack item incrementaly off the stack.
 void moveOn()
          Moves the current stack item incrementaly on to the stack.
 void next()
          Pops the current stack item completely off the stack and make the current stack item the next one.
 void prev()
          If the current stack item is current moving onto / off the stack, then this pushes it completely onto the stack.
 void reset()
          Resets this StackRenderer such that all the items are on the stack and visual position of the stack returns to its default.
private  void resetItems()
           
 void reshape(javax.media.opengl.GLAutoDrawable drawable, int x, int y, int width, int height)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_KEY

private static final java.lang.String DEBUG_KEY
See Also:
Constant Field Values

Z_INTERVAL

private static float Z_INTERVAL

X_INTERVAL

private static float X_INTERVAL

glu

private javax.media.opengl.glu.GLU glu

background

private java.awt.Color background

canvas

private javax.media.opengl.GLCanvas canvas

rotator

private MouseRotate rotator

translator

private MouseTranslate translator

wheelZoomer

private MouseWheelZoom wheelZoomer

zoomer

private MouseZoom zoomer

addKeyListener

private boolean addKeyListener

initialized

private boolean initialized

textRenderer

private com.sun.opengl.util.j2d.TextRenderer textRenderer

items

private java.util.List<StackItem> items

stackIndex

private int stackIndex

atTop

private boolean atTop

atBottom

private boolean atBottom
Constructor Detail

StackRenderer

public StackRenderer(javax.media.opengl.GLCanvas canvas,
                     java.awt.Color background)
Creates a StackRenderer that will render to the specified canvas.

Parameters:
canvas - the canvas to render to

StackRenderer

public StackRenderer(javax.media.opengl.GLCanvas canvas,
                     java.awt.Color background,
                     boolean addKeyListener)
Creates a StackRenderer that will render to the specified canvas.

Parameters:
canvas - the canvas to render to
Method Detail

getCanvas

javax.media.opengl.GLCanvas getCanvas()
Gets the canvas associated with this drawable.

Returns:
the canvas associated with this drawable.

addStackItem

public void addStackItem(StackItem item)
Adds a StackItem to this StackRenderer.

Parameters:
item - the item to add

glInit

private void glInit(javax.media.opengl.GL gl)

listenerInit

private void listenerInit(javax.media.opengl.GLAutoDrawable drawable)

init

public void init(javax.media.opengl.GLAutoDrawable drawable)
Specified by:
init in interface javax.media.opengl.GLEventListener

reshape

public void reshape(javax.media.opengl.GLAutoDrawable drawable,
                    int x,
                    int y,
                    int width,
                    int height)
Specified by:
reshape in interface javax.media.opengl.GLEventListener

displayChanged

public void displayChanged(javax.media.opengl.GLAutoDrawable drawable,
                           boolean modeChanged,
                           boolean deviceChanged)
Specified by:
displayChanged in interface javax.media.opengl.GLEventListener

display

public void display(javax.media.opengl.GLAutoDrawable drawable)
Specified by:
display in interface javax.media.opengl.GLEventListener

resetItems

private void resetItems()

reset

public void reset()
Resets this StackRenderer such that all the items are on the stack and visual position of the stack returns to its default.


next

public void next()
Pops the current stack item completely off the stack and make the current stack item the next one.


prev

public void prev()
If the current stack item is current moving onto / off the stack, then this pushes it completely onto the stack. If it is not moving, then the previous item is pushed onto the stack.


moveOff

public void moveOff()
Moves the current stack item incrementaly off the stack. If the movement takes the item completely off the stack then this increments the stack index.


moveOn

public void moveOn()
Moves the current stack item incrementaly on to the stack. If the movement takes the item completely on to the stack then this decrements the stack index.


jumpTo

public void jumpTo(StackItem item,
                   boolean updateDisplay)
Jumps the top of the stack to the StackItem

Parameters:
item - the item to jump to
updateDisplay - whether or not to update the display as the stack pops / pushes to the specified index

dispose

public void dispose()
Disposes of any resources this StackRenderer or its items may be holding.


jumpTo

public void jumpTo(int index,
                   boolean updateDisplay)
Jumps the top of the stack to the specified index.

Parameters:
index - the index to jump to.
updateDisplay - whether or not to update the display as the stack pops / pushes to the specified index

getInfo

public java.lang.String getInfo()
Gets a formatted descriptive string about this StackRenderer.

Returns:
a descriptive string about this StackRenderer.