nl.tudelft.simulation.traffic.track
Interface TrackInterface

All Known Implementing Classes:
Track

public interface TrackInterface

The TrackInterface defines the interface of Track. A track represents an element of the infrastructure running from its startLink to its endLink. Progression is defined as a distance along the infrastructure. Vehicles only use progression. They only think in a line along the infrastructure, not in worldcoordinates.

Author:
Alexander Verbraeck
Original authors: J.H. Kwakkel and H.W.G. Phaff
See Also:
TrackLinkInterface

Method Summary
 void addControlPoint(ControlPointInterface cp)
          This method adds a controlPoint to this track.
 void addVehicle(VehiclePhysicalInterface vehicle)
          indicate that a vehicle is driving on the track (with front)
 TrackProgression calculateTrackProgressionListActive(double delta)
          Calculate a position on the 'active' track located 'delta' meters from the start of the current track.
 java.util.List calculateTrackProgressionListAll(double delta)
          Calculate all positions on tracks located 'delta' meters from the start of the current track.
 java.util.List calculateTrackProgressionListLine(double delta, java.lang.String line)
          Calculate a position on a track located 'delta' meters from the start of the current track.
 ControlPointsList getControlPoints()
          Returns controlpoints for the track, as a sorted list.
 ControlPointsList getCpsOnInterval(double startProgression, double lengthOfInterval)
          This method checks for controlPoints in an interval, inclusive, so returns cps that are on the edges of the interval
 TrackLinkInterface getEndLink()
          This method returns the link seen as the link at which the track ends.
 double getLength()
           
 nl.tudelft.simulation.language.d3.DirectedPoint getLocationOfProgression(double progression)
          The getLocationOfProgression method is only used for animation.
 TrackLinkInterface getStartLink()
          This method returns the link seen as the link from which the track starts.
 java.util.List getVehiclesOnTrack()
          get the vehicles on the track
 void removeControlPoint(ControlPointInterface cp)
          This method removes a given cp from the ControlPointsLists of the track.
 void removeVehicle(VehiclePhysicalInterface vehicle)
          indicate that a vehicle is no longer driving on the track (with front)
 

Method Detail

getLocationOfProgression

public nl.tudelft.simulation.language.d3.DirectedPoint getLocationOfProgression(double progression)
The getLocationOfProgression method is only used for animation. It translates a progression on this track to a 3d-coordinate. It also calculates the orientation of the returned Location.

Parameters:
progression -
Returns:
location

getControlPoints

public ControlPointsList getControlPoints()
Returns controlpoints for the track, as a sorted list.

Returns:
controlPoints

addControlPoint

public void addControlPoint(ControlPointInterface cp)
This method adds a controlPoint to this track.

Parameters:
cp -
See Also:
ControlPointInterface

getStartLink

public TrackLinkInterface getStartLink()
This method returns the link seen as the link from which the track starts.

Returns:
startLink

getEndLink

public TrackLinkInterface getEndLink()
This method returns the link seen as the link at which the track ends.

Returns:
endLink

getLength

public double getLength()
Returns:
length of the track

getCpsOnInterval

public ControlPointsList getCpsOnInterval(double startProgression,
                                          double lengthOfInterval)
This method checks for controlPoints in an interval, inclusive, so returns cps that are on the edges of the interval

Parameters:
startProgression -
lengthOfInterval -
Returns:
controlPoints

removeControlPoint

public void removeControlPoint(ControlPointInterface cp)
This method removes a given cp from the ControlPointsLists of the track.

Parameters:
cp -

addVehicle

public void addVehicle(VehiclePhysicalInterface vehicle)
indicate that a vehicle is driving on the track (with front)

Parameters:
vehicle -

removeVehicle

public void removeVehicle(VehiclePhysicalInterface vehicle)
indicate that a vehicle is no longer driving on the track (with front)

Parameters:
vehicle -

getVehiclesOnTrack

public java.util.List getVehiclesOnTrack()
get the vehicles on the track

Returns:
the list of vehicles

calculateTrackProgressionListAll

public java.util.List calculateTrackProgressionListAll(double delta)
Calculate all positions on tracks located 'delta' meters from the start of the current track. Delta can be positive or negative. When the track splits, all paths are followed, and points on all the paths are returned.

Parameters:
delta -
Returns:

calculateTrackProgressionListActive

public TrackProgression calculateTrackProgressionListActive(double delta)
Calculate a position on the 'active' track located 'delta' meters from the start of the current track. Delta can (for now) only be positive. When the track splits, only the active path is followed, and a point on that path is returned. The active path is determined by the current setting of the switches in the links that connect the tracks.

Parameters:
delta -
Returns:

calculateTrackProgressionListLine

public java.util.List calculateTrackProgressionListLine(double delta,
                                                        java.lang.String line)
Calculate a position on a track located 'delta' meters from the start of the current track. Delta can (for now) only be positive. When the track splits, the path that is linked to the given line number is followed, and a point on that path is returned. This path is determined by the way the switches will be set when a vehicle of the given line number passes.

Parameters:
delta -
line -
Returns:


Copyright © 2003-2004 Delft University of Technology, the Netherlands. All Rights Reserved.