org.jscience.architecture.traffic.tools
Class LaneAction

java.lang.Object
  extended by org.jscience.architecture.traffic.tools.LaneAction
All Implemented Interfaces:
ToolAction

public class LaneAction
extends java.lang.Object
implements ToolAction

This implements the add lane user action


Field Summary
protected  Node alphaNode
          DOCUMENT ME!
protected  EditModel model
          DOCUMENT ME!
protected  java.awt.Point mousePoint
          DOCUMENT ME!
protected  java.awt.Point startPoint
          DOCUMENT ME!
 
Constructor Summary
LaneAction(EditModel em)
          Creates a new LaneAction object.
 
Method Summary
 boolean beingUsed()
          DOCUMENT ME!
 boolean endAction(View view, java.awt.Point p)
          Looks for the second node at given point.
 void moveAction(View view, java.awt.Point p)
          Moves the current mouse point
 void paint(java.awt.Graphics g)
          Paints a graphical representation of the status of this action
 void reset()
          DOCUMENT ME!
 boolean startAction(View view, java.awt.Point p)
          Starts the action by finding the alpha node of the road
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

protected EditModel model
DOCUMENT ME!


alphaNode

protected Node alphaNode
DOCUMENT ME!


startPoint

protected java.awt.Point startPoint
DOCUMENT ME!


mousePoint

protected java.awt.Point mousePoint
DOCUMENT ME!

Constructor Detail

LaneAction

public LaneAction(EditModel em)
Creates a new LaneAction object.

Parameters:
em - DOCUMENT ME!
Method Detail

beingUsed

public boolean beingUsed()
DOCUMENT ME!

Specified by:
beingUsed in interface ToolAction
Returns:
DOCUMENT ME!

reset

public void reset()
DOCUMENT ME!


startAction

public boolean startAction(View view,
                           java.awt.Point p)
Starts the action by finding the alpha node of the road

Parameters:
view - The main view. Needed to convert coordinates
p - The point to search for the first node
Returns:
False if no node was found at the given point (and the action could not be started consequently)

endAction

public boolean endAction(View view,
                         java.awt.Point p)
Looks for the second node at given point. If it is found, ends the action by adding a drivelane to the road connecting the first and second node.

Parameters:
view - DOCUMENT ME!
p - The point
Returns:
False if the action was ended without adding a drivelane.

moveAction

public void moveAction(View view,
                       java.awt.Point p)
Moves the current mouse point

Parameters:
view - DOCUMENT ME!
p - The new position of the mouse cursor

paint

public void paint(java.awt.Graphics g)
Paints a graphical representation of the status of this action

Parameters:
g - The Graphics object to paint on