org.samcrow
Class DrawQueue

java.lang.Object
  extended by org.samcrow.DrawQueue

public class DrawQueue
extends java.lang.Object

Manages SGObjects to draw. Background objects are drawn in the background every time. Persistent objects are drawn after the background every time. Transient objects are drawn after the persistent objects only once. Calling redraw subsequently will erase them.

Author:
Sam Crow

Field Summary
private  java.util.Collection<org.lekan.graphics.SGObject> backgroundObjects
           
private  java.util.Collection<org.lekan.graphics.SGObject> persistentObjects
           
private  org.lekan.graphics.GraphicsProgram program
           
private  java.util.Collection<org.lekan.graphics.SGObject> transientObjects
           
 
Constructor Summary
DrawQueue(org.lekan.graphics.GraphicsProgram inProgram)
          Constructor
DrawQueue(org.lekan.graphics.GraphicsProgram inProgram, java.util.Collection<org.lekan.graphics.SGObject> inBackgroundObjects)
          Constructor, specifying a collection of SGObjects to draw in the background every time
 
Method Summary
 void addBackground(java.util.Collection<org.lekan.graphics.SGObject> objects)
          Add a Collection of objects to the background list
 void addBackground(org.lekan.graphics.SGObject object)
          Add an object to the background list
 void addPersistent(java.util.Collection<org.lekan.graphics.SGObject> objects)
          Add a Collection of objects to the persistent list
 void addPersistent(org.lekan.graphics.SGObject object)
          Add an object to the persistent list
 void addTransient(java.util.Collection<org.lekan.graphics.SGObject> objects)
          Add a Collection of objects to the transient list
 void addTransient(org.lekan.graphics.SGObject object)
          Add a feature that will be drawn when redraw is called, but that will be erased when redraw is called subsequent times.
 void clearPersistent()
          Remove all SGObejcts from the array of persistent objects to draw
 void redraw(java.lang.String mode, DisplayOptions.DisplayState state)
          Clear the frame and draw all features added since the last call to redraw
private  boolean shouldDraw(org.lekan.graphics.SGObject.Origin origin, DisplayOptions.DisplayState state)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transientObjects

private java.util.Collection<org.lekan.graphics.SGObject> transientObjects

persistentObjects

private java.util.Collection<org.lekan.graphics.SGObject> persistentObjects

backgroundObjects

private java.util.Collection<org.lekan.graphics.SGObject> backgroundObjects

program

private org.lekan.graphics.GraphicsProgram program
Constructor Detail

DrawQueue

public DrawQueue(org.lekan.graphics.GraphicsProgram inProgram)
Constructor

Parameters:
inProgram - the GraphicsProgram that contains the SGFrame to draw to

DrawQueue

public DrawQueue(org.lekan.graphics.GraphicsProgram inProgram,
                 java.util.Collection<org.lekan.graphics.SGObject> inBackgroundObjects)
Constructor, specifying a collection of SGObjects to draw in the background every time

Parameters:
inProgram - the GraphicsProgram that contains the SGFrame to draw to
inBackgroundObjects - a Collection of background SGObjects
Method Detail

addBackground

public void addBackground(org.lekan.graphics.SGObject object)
Add an object to the background list

Parameters:
object - the SGObject to add

addBackground

public void addBackground(java.util.Collection<org.lekan.graphics.SGObject> objects)
Add a Collection of objects to the background list

Parameters:
objects - the Collection of SGObjects to add

addPersistent

public void addPersistent(org.lekan.graphics.SGObject object)
Add an object to the persistent list

Parameters:
object - the SGObject to add

addPersistent

public void addPersistent(java.util.Collection<org.lekan.graphics.SGObject> objects)
Add a Collection of objects to the persistent list

Parameters:
objects - the Collection of SGObjects to add

addTransient

public void addTransient(org.lekan.graphics.SGObject object)
Add a feature that will be drawn when redraw is called, but that will be erased when redraw is called subsequent times.

Parameters:
object - The SGObject that will be drawn

addTransient

public void addTransient(java.util.Collection<org.lekan.graphics.SGObject> objects)
Add a Collection of objects to the transient list

Parameters:
objects - the Collection of SGObjects to add

clearPersistent

public void clearPersistent()
Remove all SGObejcts from the array of persistent objects to draw


redraw

public void redraw(java.lang.String mode,
                   DisplayOptions.DisplayState state)
Clear the frame and draw all features added since the last call to redraw

Parameters:
mode - the mode to indicate
state - the current DisplayState

shouldDraw

private boolean shouldDraw(org.lekan.graphics.SGObject.Origin origin,
                           DisplayOptions.DisplayState state)