de.steeringbehaviors.simulation.simulationobjects
Class Vehicle

java.lang.Object
  extended by de.steeringbehaviors.simulation.renderer.Geometrie
      extended by de.steeringbehaviors.simulation.simulationobjects.Vehicle
All Implemented Interfaces:
ObjectAttributes

public class Vehicle
extends Geometrie

Class defining vehicles


Field Summary
static int ARRIVED_TARGET
           
static int FOLLOWING_PATH
           
 
Fields inherited from class de.steeringbehaviors.simulation.renderer.Geometrie
m_boundingbox, m_localx, m_localy, m_mind, m_objectName, m_pos, m_radius, m_scaleX, m_scaleY, m_shapes, m_visible
 
Constructor Summary
Vehicle()
          Constructor
Vehicle(Point2d pos, Vector2d mvel, double radius, Rect boundingbox, double maxVel, double maxForce, double mass)
          Constructor
Vehicle(java.lang.String objectName, double posX, double posY, double velX, double velY, double radius, double maxVel, double maxForce)
          Constructor
 
Method Summary
 void addForce(Vector2d force)
           
 void addWaypoint(Point2d waypoint)
          Adds a new waypoint to the list of current waypoints
 double getMaxForce()
          Returns the current maximum force
 double getMaxVel()
          Returns the current maximum velocity
 Point2d getOldPos()
          Returns the position before the last simulation step
 Vector2d getOldVel()
          Returns the velocity before the last simulation step
 java.util.LinkedList getPath()
          Give acces to the path for the vehicle.
 int getPathState()
          Give acces to the pathfollowing state of the vehicle.
 Vector2d getVel()
          Returns the current velocity
 double getX()
          Returns the x position
 double getY()
          Returns the y position
protected  void init(java.lang.String objectName, double posX, double posY, double velX, double velY, double radius, double maxVel, double maxForce)
           
 void removeWaypoint()
          Removes the first waypoint from the list
 void restoreState()
          Restores the position, the direction the vehicle is facing and the velocity back to the last saved state.
 void saveState()
          Makes a copy of the last position, the direction the vehicle is facing and the velocity.
 void setAttribute(java.lang.String name, java.lang.String value, java.util.Hashtable objectList)
          Sets a attribute specified by the name
 void setMass(double mass)
          Sets the mass of the vehicle
 void setMaxForce(double maxForce)
          Sets the maximum force of the vehicle
 void setMaxVel(double maxVel)
          Sets the maximum velocity of the vehicle
 void setPathState(int state)
          Sets the current pathfollowing state for the vehicle
 void setVel(Vector2d vel)
          Returns the current velocity
 void setX(double x)
          Returns the x position
 void setY(double y)
          Returns the y position
 
Methods inherited from class de.steeringbehaviors.simulation.renderer.Geometrie
addShape, getBoundingBox, getLocalX, getLocalY, getMind, getObjectName, getPoints, getPos, getRadius, getScaleX, getScaleY, getShapeIter, getVisible, localToWorld, localToWorld, moveCenter, onCollide, setLocalx, setMind, setObjectName, setPos, setRadius, setScaleX, setScaleY, setVisible, updateBoundingRadius, worldToLocal, worldToLocal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FOLLOWING_PATH

public static final int FOLLOWING_PATH
See Also:
Constant Field Values

ARRIVED_TARGET

public static final int ARRIVED_TARGET
See Also:
Constant Field Values
Constructor Detail

Vehicle

public Vehicle()
Constructor


Vehicle

public Vehicle(Point2d pos,
               Vector2d mvel,
               double radius,
               Rect boundingbox,
               double maxVel,
               double maxForce,
               double mass)
Constructor

Parameters:
pos - The position
mvel - The velcocity
radius - The radius
boundingbox - The boundingbox
maxVel - The maximum velocity
maxForce - Tha maximum force
mass - The mass

Vehicle

public Vehicle(java.lang.String objectName,
               double posX,
               double posY,
               double velX,
               double velY,
               double radius,
               double maxVel,
               double maxForce)
Constructor

Parameters:
objectName - The name
posX - The x position
posY - The y position
velX - The x velocity
velY - The y velocity
radius - The radius
maxVel - The maximum velicity
maxForce - The maximum force
Method Detail

init

protected void init(java.lang.String objectName,
                    double posX,
                    double posY,
                    double velX,
                    double velY,
                    double radius,
                    double maxVel,
                    double maxForce)

addForce

public void addForce(Vector2d force)

addWaypoint

public void addWaypoint(Point2d waypoint)
Adds a new waypoint to the list of current waypoints

Parameters:
waypoint - New waypoint to add to the list

removeWaypoint

public void removeWaypoint()
Removes the first waypoint from the list


restoreState

public void restoreState()
Restores the position, the direction the vehicle is facing and the velocity back to the last saved state.


saveState

public void saveState()
Makes a copy of the last position, the direction the vehicle is facing and the velocity.


setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value,
                         java.util.Hashtable objectList)
Sets a attribute specified by the name

Specified by:
setAttribute in interface ObjectAttributes
Overrides:
setAttribute in class Geometrie
Parameters:
name - name of the attribute
value - value of the attribute

setMass

public void setMass(double mass)
Sets the mass of the vehicle

Parameters:
mass - New mass

setMaxForce

public void setMaxForce(double maxForce)
Sets the maximum force of the vehicle

Parameters:
mass - New mximum force

setMaxVel

public void setMaxVel(double maxVel)
Sets the maximum velocity of the vehicle

Parameters:
mass - New mximum velocity

setPathState

public void setPathState(int state)
Sets the current pathfollowing state for the vehicle

Parameters:
state - New pathfollowing state

setVel

public void setVel(Vector2d vel)
Returns the current velocity


setX

public void setX(double x)
Returns the x position


setY

public void setY(double y)
Returns the y position


getMaxVel

public double getMaxVel()
Returns the current maximum velocity

Returns:
Maximum velocity

getMaxForce

public double getMaxForce()
Returns the current maximum force

Returns:
Maximum force

getOldPos

public Point2d getOldPos()
Returns the position before the last simulation step

Returns:
Position before last simulation step

getOldVel

public Vector2d getOldVel()
Returns the velocity before the last simulation step

Returns:
Velocity before last simulation step

getPath

public java.util.LinkedList getPath()
Give acces to the path for the vehicle.

Returns:
List of waypoints for the vehicle

getPathState

public int getPathState()
Give acces to the pathfollowing state of the vehicle.

Returns:
The current state of the vehicle

getVel

public Vector2d getVel()
Returns the current velocity

Returns:
Current velocity

getX

public double getX()
Returns the x position

Returns:
X position

getY

public double getY()
Returns the y position

Returns:
Y position