Class PlayerCanvas

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

public class PlayerCanvas
extends java.awt.Canvas

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, java.awt.Component.AWTTreeLock
 
Field Summary
private  int centre_x
           
private  int centre_y
           
 InputHandler control
           
private  java.awt.Polygon field
           
private  java.util.Vector field_flags
           
private  int height
           
private  PlayerFrame p_frame
           
private  double perspective_width
           
private  int scale
           
private  java.util.Vector selected
           
private  char side
           
private  java.lang.String team
           
private  int user_x
           
private  int user_y
           
private  int visible_dist
           
private  java.util.Vector visuals
           
private  int width
           
 
Fields inherited from class java.awt.Canvas
base, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dbg, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PlayerCanvas(PlayerFrame playerframe)
           
 
Method Summary
private  java.awt.Point calculatePoint(double distance, double direction, int width)
           
private  void drawBall(BallInfo ball, java.awt.Graphics g)
           
private  void drawField(java.util.Vector m_flags, java.awt.Graphics g)
           
private  void drawFieldLine(LineInfo line, java.awt.Graphics g)
           
private  void drawFlag(FlagInfo flag, java.awt.Graphics g)
           
private  void drawGoalPost(FlagInfo goalpost, java.awt.Graphics g)
           
private  void drawLine(ObjectInfo flag_a, ObjectInfo flag_b, java.awt.Graphics g)
           
private  void drawPlayer(PlayerInfo player, java.awt.Graphics g)
           
 java.util.Vector getSelectedObjects()
           
 java.awt.Point getUserCoordinates()
           
 void paint(java.awt.Graphics g)
           
private  ObjectInfo perpVCP(ObjectInfo origLine, ObjectInfo cornerPoint, boolean right)
           
 void selectObject(int x, int y)
           
private  void setField(java.util.Vector m_objects)
           
 void setObjects(java.util.Vector vobj)
           
 void setSide(char s)
           
 void setSquare(int w, int h)
           
 void setTeam(java.lang.String teamname)
           
private  ObjectInfo vcPoint(ObjectInfo line, boolean right)
           
 
Methods inherited from class java.awt.Canvas
, addNotify, constructComponentName, getAccessibleContext, postsOldMouseEvents
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initIDs, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, numListening, paintAll, paintHeavyweightComponents, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, readObject, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

visuals

private java.util.Vector visuals

field_flags

private java.util.Vector field_flags

selected

private java.util.Vector selected

width

private int width

height

private int height

centre_x

private int centre_x

centre_y

private int centre_y

field

private java.awt.Polygon field

perspective_width

private double perspective_width

team

private java.lang.String team

side

private char side

user_x

private int user_x

user_y

private int user_y

scale

private int scale

visible_dist

private int visible_dist

control

public InputHandler control

p_frame

private PlayerFrame p_frame
Constructor Detail

PlayerCanvas

public PlayerCanvas(PlayerFrame playerframe)
Method Detail

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Canvas

setObjects

public void setObjects(java.util.Vector vobj)

setField

private void setField(java.util.Vector m_objects)

setSquare

public void setSquare(int w,
                      int h)

setTeam

public void setTeam(java.lang.String teamname)

setSide

public void setSide(char s)

drawGoalPost

private void drawGoalPost(FlagInfo goalpost,
                          java.awt.Graphics g)

drawFlag

private void drawFlag(FlagInfo flag,
                      java.awt.Graphics g)

drawField

private void drawField(java.util.Vector m_flags,
                       java.awt.Graphics g)

drawLine

private void drawLine(ObjectInfo flag_a,
                      ObjectInfo flag_b,
                      java.awt.Graphics g)

drawFieldLine

private void drawFieldLine(LineInfo line,
                           java.awt.Graphics g)

drawBall

private void drawBall(BallInfo ball,
                      java.awt.Graphics g)

drawPlayer

private void drawPlayer(PlayerInfo player,
                        java.awt.Graphics g)

vcPoint

private ObjectInfo vcPoint(ObjectInfo line,
                           boolean right)

perpVCP

private ObjectInfo perpVCP(ObjectInfo origLine,
                           ObjectInfo cornerPoint,
                           boolean right)

calculatePoint

private java.awt.Point calculatePoint(double distance,
                                      double direction,
                                      int width)

getUserCoordinates

public java.awt.Point getUserCoordinates()

selectObject

public void selectObject(int x,
                         int y)

getSelectedObjects

public java.util.Vector getSelectedObjects()