org.samcrow
Class Pathfinder

java.lang.Object
  extended by org.lekan.graphics.GraphicsProgram
      extended by org.samcrow.Pathfinder
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, DisplayOptions.DisplayChangeListener

public class Pathfinder
extends org.lekan.graphics.GraphicsProgram
implements java.awt.event.ActionListener, DisplayOptions.DisplayChangeListener

Who needs Google Maps when you have Pathfinder?

Author:
Sam Crow

Field Summary
private static java.lang.String ADD_DESTINATION
           
private static java.lang.String ADD_WAYPOINT
           
private static int CANVAS_HEIGHT
           
private static int CANVAS_WIDTH
           
private  javax.swing.JFileChooser chooser
           
private  Node dragStartNode
           
private  boolean isDragging
           
private  boolean isOpening
           
private  java.util.Collection<Link> links
           
private static java.lang.String MAP_FILE_NAME
           
private static java.lang.String MENU_CLEAR
           
private static java.lang.String MENU_OPEN
           
private static java.lang.String MENU_SAVE_AS
           
private  java.lang.String mode
           
private  java.util.Collection<Node> nodes
           
private  DrawQueue queue
           
private static java.lang.String ROUTE_MODE
           
private  DisplayOptions.DisplayState state
           
 
Fields inherited from class org.lekan.graphics.GraphicsProgram
EAST, NORTH, SOUTH, WEST
 
Constructor Summary
Pathfinder()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void displayStateChanged(DisplayOptions.DisplayState s)
          Called whenever the user changes the display state
static void main(java.lang.String[] args)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
private  Node nodeOver(java.awt.event.MouseEvent e)
          Check if a given MouseEvent is over the circle representing any of the active nodes
 void run()
           
 void setup()
           
 
Methods inherited from class org.lekan.graphics.GraphicsProgram
addButton, addJComponent, addTextField, getFrame, isKeyDebugModeSet, isMouseDebugModeSet, isMouseMotionDebugModeSet, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, setButtonDebugMode, setKeyDebugMode, setMouseDebugMode, setMouseMotionDebugMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CANVAS_WIDTH

private static final int CANVAS_WIDTH
See Also:
Constant Field Values

CANVAS_HEIGHT

private static final int CANVAS_HEIGHT
See Also:
Constant Field Values

MAP_FILE_NAME

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

ADD_WAYPOINT

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

ADD_DESTINATION

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

MENU_SAVE_AS

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

MENU_OPEN

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

MENU_CLEAR

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

ROUTE_MODE

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

mode

private java.lang.String mode

queue

private DrawQueue queue

nodes

private java.util.Collection<Node> nodes

links

private java.util.Collection<Link> links

chooser

private javax.swing.JFileChooser chooser

isOpening

private boolean isOpening

state

private DisplayOptions.DisplayState state

dragStartNode

private Node dragStartNode

isDragging

private boolean isDragging
Constructor Detail

Pathfinder

public Pathfinder()
Method Detail

main

public static void main(java.lang.String[] args)

setup

public void setup()
Overrides:
setup in class org.lekan.graphics.GraphicsProgram

run

public void run()
Overrides:
run in class org.lekan.graphics.GraphicsProgram

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class org.lekan.graphics.GraphicsProgram

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class org.lekan.graphics.GraphicsProgram

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class org.lekan.graphics.GraphicsProgram

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class org.lekan.graphics.GraphicsProgram

displayStateChanged

public void displayStateChanged(DisplayOptions.DisplayState s)
Description copied from interface: DisplayOptions.DisplayChangeListener
Called whenever the user changes the display state

Specified by:
displayStateChanged in interface DisplayOptions.DisplayChangeListener
Parameters:
s - The new DisplayState

nodeOver

private Node nodeOver(java.awt.event.MouseEvent e)
Check if a given MouseEvent is over the circle representing any of the active nodes

Parameters:
e - the MouseEvent to check
Returns:
the Node that the mouse event was over, null if it is not over any Node