ec.teambots
Class ECSimulationCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--ec.teambots.ECSimulationCanvas
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable

public class ECSimulationCanvas
extends java.awt.Canvas
implements java.lang.Runnable

See Also:
Serialized Form

Inner classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static int MAX_SIM_OBJS
          The maximum number of objects in a simulation.
 long seed
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ECSimulationCanvas(java.awt.Frame p, int w, int h, java.lang.String dscfile)
           
ECSimulationCanvas(java.awt.Frame p, int w, int h, java.lang.String dscfile, boolean preserveSize)
          Set up the SimulationCanvas.
 
Method Summary
 boolean descriptionLoaded()
          Provide info about whether we have successufully loaded the file.
 java.awt.Dimension getPreferredSize()
           
 EDU.gatech.cc.is.abstractrobot.Simple getRobot(int index)
          Returns a robot atached to a control system (for logging and evaluation purposes)
 java.lang.Thread getThread()
          Get the thread (for joining)
 void load(java.lang.String df)
          Handle a load request.
 void pause()
          Handle a pause event.
 void quit()
          Handle a quit event.
 void reset()
          Handle a reset event.
 void reSizeWindow()
           
 void run()
          Run the simulation.
 void setControlSystem(int index, EDU.gatech.cc.is.abstractrobot.ControlSystemS controlSystem)
          Modifies a control system
 void setDrawIcons(boolean v)
          Handle setDrawIcons
 void setDrawIDs(boolean v)
          Handle setDrawIDs
 void setDrawObjectState(boolean v)
          Handle setDrawObjectState
 void setDrawRobotState(boolean v)
          Handle setDrawRobotState
 void setDrawTrails(boolean v)
          Handle setDrawTrails
 void setGraphics(boolean v)
          Handle setGraphics
 void setSize(int w, int h)
          Resize the SimulationCanvas.
 void showRuntimeStats()
          Handle a Runtime Stats event
 void start()
          Handle a start/resume event.
 void update(java.awt.Graphics g)
          Handle a drawing request.
 
Methods inherited from class java.awt.Canvas
addNotify, getAccessibleContext, paint
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

seed

public long seed

MAX_SIM_OBJS

public static final int MAX_SIM_OBJS
The maximum number of objects in a simulation.
Constructor Detail

ECSimulationCanvas

public ECSimulationCanvas(java.awt.Frame p,
                          int w,
                          int h,
                          java.lang.String dscfile)

ECSimulationCanvas

public ECSimulationCanvas(java.awt.Frame p,
                          int w,
                          int h,
                          java.lang.String dscfile,
                          boolean preserveSize)
Set up the SimulationCanvas.
Method Detail

setControlSystem

public void setControlSystem(int index,
                             EDU.gatech.cc.is.abstractrobot.ControlSystemS controlSystem)
Modifies a control system

getRobot

public EDU.gatech.cc.is.abstractrobot.Simple getRobot(int index)
Returns a robot atached to a control system (for logging and evaluation purposes)

getThread

public java.lang.Thread getThread()
Get the thread (for joining)

descriptionLoaded

public boolean descriptionLoaded()
Provide info about whether we have successufully loaded the file.
Returns:
true if a file is loaded, false otherwise.

run

public void run()
Run the simulation.
Specified by:
run in interface java.lang.Runnable

update

public void update(java.awt.Graphics g)
Handle a drawing request.
Overrides:
update in class java.awt.Component

setSize

public void setSize(int w,
                    int h)
Resize the SimulationCanvas.
Overrides:
setSize in class java.awt.Component

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class java.awt.Component

reSizeWindow

public void reSizeWindow()

quit

public void quit()
Handle a quit event.

reset

public void reset()
Handle a reset event.

start

public void start()
Handle a start/resume event.

showRuntimeStats

public void showRuntimeStats()
Handle a Runtime Stats event

pause

public void pause()
Handle a pause event.

setDrawIDs

public void setDrawIDs(boolean v)
Handle setDrawIDs

setDrawIcons

public void setDrawIcons(boolean v)
Handle setDrawIcons

setGraphics

public void setGraphics(boolean v)
Handle setGraphics

setDrawRobotState

public void setDrawRobotState(boolean v)
Handle setDrawRobotState

setDrawObjectState

public void setDrawObjectState(boolean v)
Handle setDrawObjectState

setDrawTrails

public void setDrawTrails(boolean v)
Handle setDrawTrails

load

public void load(java.lang.String df)
Handle a load request.