RiverRat  - An MIT iCampus project http://web.mit.edu/riverrat/

Main Page | Software Documentation | Hardware Documentation | People | Contact | Wiki

Main Page | Class Hierarchy | Class List | File List | Class Members

riverrat.RiverRatDemo Class Reference

Finished prototype - The prototype for the RiverRat 2D GUI. More...

Inheritance diagram for riverrat.RiverRatDemo:

riverrat.RiverRatClient List of all members.

Public Member Functions

 RiverRatDemo ()
 Default constructor.

void actionPerformed (ActionEvent e)
 This implements the ActionListener class, and allows Menus to send actions to the application.

void mouseEntered (MouseEvent e)
 Unused part of the MouseListener interface.

void mouseExited (MouseEvent e)
void mouseClicked (MouseEvent e)
void mousePressed (MouseEvent e)
 Part of the MouseListener interface.

void mouseReleased (MouseEvent e)
 Part of the MouseListener interface.

void mouseMoved (MouseEvent e)
 Part of the MouseMotionListener interface.

void mouseDragged (MouseEvent e)
 Part of the MouseMotionListener interface.

void drawArrows (Graphics g)
 This is a test method (unused) to draw a series of triangle boat icons at different headings, with 45 degree increments.

void drawTriangle (Graphics g, int x, int y, float radians)
 Draws a triangular boat icon at position (x,y), with heading radians, from 0 to 2Pi, on the Graphics object g.

void drawBoatIcon (Graphics g, int x, int y, float radians)
 Draws a boat-shaped boat icon at position (x,y), with heading radians, from 0 to 2Pi, on the Graphics object g.

void drawHelpMessage (Graphics g)
 Draws a help message to show keyboard commands.

void drawCursorLatLon (Graphics g)
 Draws a string with the cursor location in latitude and longitude.

void drawLatLonGrid (Graphics g)
 Draws a grid of vertical and horizontal lines.

void drawMark (Graphics g, int markid)
 Draws a certain mark from the race.

void drawBoat (Graphics g, int boatid)
 Draws a certain boat from the race.

void paint (Graphics g)
 This is where the magic happens.

void keyTyped (KeyEvent e)
 Implements part of the KeyListener interface.

void keyReleased (KeyEvent e)
void keyPressed (KeyEvent e)

Static Public Member Functions

void main (String args[])
 This makes a new RiverRatDemo object, then goes into a loop sending a repaint() event every half-second.


Package Attributes

Map themap
Race therace
Color dotcolor
int boatid
int markid
int width = 1000
int height = 375
int mouse_x
int mouse_y
boolean isButtonPressed = false
boolean drawPointerLocation = false
boolean drawRaceStatus = true
boolean drawBoatStatus = true
boolean drawGrid = false
boolean drawHelp = false

Static Package Attributes

final int TRACK_DOT_RADIUS = 10
final int DOT_RADIUS = 10
final int MARK_RADIUS = 15
final int MAX_DIMENSION = 500
final float NW_LAT = 42.3645f
final float SE_LAT = 42.3505f
final float NW_LON = -71.095f
final float SE_LON = -71.075f
final int GRID_DIVISIONS = 10
final boolean DEBUG = false
final boolean ENABLE_TRACKS = true
final boolean DRAW_BOAT_ICON = true
final Color BG_COLOR = Color.white
final Color GRID_COLOR = Color.gray
String host = "localhost"
int port = 8080

Detailed Description

Finished prototype - The prototype for the RiverRat 2D GUI.

Definition at line 87 of file RiverRatDemo.java.


Constructor & Destructor Documentation

riverrat.RiverRatDemo.RiverRatDemo  ) 
 

Default constructor.

Sets up new Race, initializes Map with defined coordinates, sets size to defined width and height, sets background color, and initializes application.

Definition at line 131 of file RiverRatDemo.java.


Member Function Documentation

void riverrat.RiverRatDemo.actionPerformed ActionEvent  e  ) 
 

This implements the ActionListener class, and allows Menus to send actions to the application.

Definition at line 159 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.drawArrows Graphics  g  ) 
 

This is a test method (unused) to draw a series of triangle boat icons at different headings, with 45 degree increments.

Parameters:
g Graphics object to draw on

Definition at line 253 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.drawBoat Graphics  g,
int  boatid
 

Draws a certain boat from the race.

Parameters:
g Graphics object to draw on boatid int with id of mark to draw

Definition at line 417 of file RiverRatDemo.java.

References riverrat.Fix.fixToString(), riverrat.Fix.getLat(), and riverrat.Fix.getLon().

void riverrat.RiverRatDemo.drawBoatIcon Graphics  g,
int  x,
int  y,
float  radians
 

Draws a boat-shaped boat icon at position (x,y), with heading radians, from 0 to 2Pi, on the Graphics object g.

x is measured from the left side of the window, y is measured from the top of the window. A heading of 0 draws an icon pointing north. Doesn't really work at the moment.

Parameters:
g Graphics object to draw to x int with x coordinates of center of icon y int with y coordinates of center of icon radians float with heading in radians

Definition at line 306 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.drawCursorLatLon Graphics  g  ) 
 

Draws a string with the cursor location in latitude and longitude.

Parameters:
g Graphics object to draw on

Definition at line 356 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.drawHelpMessage Graphics  g  ) 
 

Draws a help message to show keyboard commands.

Parameters:
g Graphics object to draw on

Definition at line 337 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.drawLatLonGrid Graphics  g  ) 
 

Draws a grid of vertical and horizontal lines.

Parameters:
g Graphics object to draw on

Definition at line 365 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.drawMark Graphics  g,
int  markid
 

Draws a certain mark from the race.

Parameters:
g Graphics object to draw on markid int with id of mark to draw

Definition at line 387 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.drawTriangle Graphics  g,
int  x,
int  y,
float  radians
 

Draws a triangular boat icon at position (x,y), with heading radians, from 0 to 2Pi, on the Graphics object g.

x is measured from the left side of the window, y is measured from the top of the window. A heading of 0 draws an icon pointing north.

Parameters:
g Graphics object to draw to x int with x coordinate of center of icon y int with y coordinate of center of icon radians float with heading in radians

Definition at line 277 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.keyTyped KeyEvent  e  ) 
 

Implements part of the KeyListener interface.

Listens for certain keys and triggers these behaviors.
P = Toggle Pointer Location
G = Toggle Grid
R = Toggle Race Status
B = Toggle Boat Status
H = Toggle Help

Definition at line 513 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.main String  args[]  )  [static]
 

This makes a new RiverRatDemo object, then goes into a loop sending a repaint() event every half-second.

Definition at line 545 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.mouseDragged MouseEvent  e  ) 
 

Part of the MouseMotionListener interface.

Updates internal variables describing the position of the mouse. This is used to display the pointer location on the screen.

Definition at line 239 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.mouseEntered MouseEvent  e  ) 
 

Unused part of the MouseListener interface.

Definition at line 196 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.mouseMoved MouseEvent  e  ) 
 

Part of the MouseMotionListener interface.

Updates internal variables describing the position of the mouse. This is used to display the pointer location on the screen.

Definition at line 226 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.mousePressed MouseEvent  e  ) 
 

Part of the MouseListener interface.

Simply changes an internal state variable describing the mouse status.

Definition at line 204 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.mouseReleased MouseEvent  e  ) 
 

Part of the MouseListener interface.

Simply changes an internal state variable describing the mouse status.

Definition at line 214 of file RiverRatDemo.java.

void riverrat.RiverRatDemo.paint Graphics  g  ) 
 

This is where the magic happens.

This paint() gets called to draw the appropriate stuff. This paint() then calls other methods, like drawBoat().

Parameters:
g Graphics object to draw on

Definition at line 478 of file RiverRatDemo.java.


The documentation for this class was generated from the following file:  

Brought to you by the RiverRat team.