View Javadoc

1   /*
2    * Created on Dec 4, 2003
3    * 
4    * Copyright (c) 2003, 2004 Delft University of Technology Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the General Public License
9    */
10  
11  package nl.tudelft.simulation.traffic.track;
12  
13  import java.util.List;
14  import nl.tudelft.simulation.language.d3.DirectedPoint;
15  import nl.tudelft.simulation.traffic.controlpoint.ControlPointInterface;
16  import nl.tudelft.simulation.traffic.controlpoint.util.ControlPointsList;
17  import nl.tudelft.simulation.traffic.track.util.TrackProgression;
18  import nl.tudelft.simulation.traffic.vehicle.VehiclePhysicalInterface;
19  
20  /***
21   * The TrackInterface defines the interface of Track. A track represents an
22   * element of the infrastructure running from its startLink to its endLink.
23   * 
24   * Progression is defined as a distance along the infrastructure. Vehicles only
25   * use progression. They only think in a line along the infrastructure, not in
26   * worldcoordinates. <br>
27   * 
28   * @see nl.tudelft.simulation.traffic.track.TrackLinkInterface
29   * 
30   * @author <a
31   * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
32   * Verbraeck </a> <br>
33   * Original authors: J.H. Kwakkel and H.W.G. Phaff
34   */
35  public interface TrackInterface
36  {
37      /***
38       * The getLocationOfProgression method is only used for animation. It
39       * translates a progression on this track to a 3d-coordinate. It also
40       * calculates the orientation of the returned Location.
41       * 
42       * @param progression
43       * @return location
44       */
45      public DirectedPoint getLocationOfProgression(final double progression);
46  
47      /***
48       * Returns controlpoints for the track, as a sorted list.
49       * 
50       * @return controlPoints
51       */
52      public ControlPointsList getControlPoints();
53  
54      /***
55       * This method adds a controlPoint to this track.
56       * 
57       * @param cp
58       * @see nl.tudelft.simulation.traffic.controlpoint.ControlPointInterface
59       */
60      public void addControlPoint(final ControlPointInterface cp);
61  
62      /***
63       * This method returns the link seen as the link from which the track
64       * starts.
65       * 
66       * @return startLink
67       */
68      public TrackLinkInterface getStartLink();
69  
70      /***
71       * This method returns the link seen as the link at which the track ends.
72       * 
73       * @return endLink
74       */
75      public TrackLinkInterface getEndLink();
76  
77      /***
78       * @return length of the track
79       */
80      public double getLength();
81  
82      /***
83       * This method checks for controlPoints in an interval, inclusive, so
84       * returns cps that are on the edges of the interval
85       * 
86       * @param startProgression
87       * @param lengthOfInterval
88       * @return controlPoints
89       */
90      public ControlPointsList getCpsOnInterval(final double startProgression,
91              final double lengthOfInterval);
92  
93      /***
94       * This method removes a given cp from the ControlPointsLists of the track.
95       * 
96       * @param cp
97       */
98      public void removeControlPoint(final ControlPointInterface cp);
99  
100     /***
101      * indicate that a vehicle is driving on the track (with front)
102      * 
103      * @param vehicle
104      */
105     public void addVehicle(VehiclePhysicalInterface vehicle);
106 
107     /***
108      * indicate that a vehicle is no longer driving on the track (with front)
109      * 
110      * @param vehicle
111      */
112     public void removeVehicle(VehiclePhysicalInterface vehicle);
113 
114     /***
115      * get the vehicles on the track
116      * 
117      * @return the list of vehicles
118      */
119     public List getVehiclesOnTrack();
120     
121     /***
122      * Calculate all positions on tracks located 'delta' meters from the start
123      * of the current track. Delta can be positive or negative. When the track
124      * splits, all paths are followed, and points on all the paths are returned.
125      * 
126      * @param delta
127      * @return
128      */
129     public List calculateTrackProgressionListAll(final double delta);
130 
131     /***
132      * Calculate a position on the 'active' track located 'delta' meters from
133      * the start of the current track. Delta can (for now) only be positive.
134      * When the track splits, only the active path is followed, and a point on
135      * that path is returned. The active path is determined by the current
136      * setting of the switches in the links that connect the tracks.
137      * 
138      * @param delta
139      * @return
140      */
141     public TrackProgression calculateTrackProgressionListActive(
142             final double delta);
143 
144     /***
145      * Calculate a position on a track located 'delta' meters from the start of
146      * the current track. Delta can (for now) only be positive. When the track
147      * splits, the path that is linked to the given line number is followed, and
148      * a point on that path is returned. This path is determined by the way the
149      * switches will be set when a vehicle of the given line number passes.
150      * 
151      * @param delta
152      * @param line
153      * @return
154      */
155     public List calculateTrackProgressionListLine(final double delta,
156             final String line);
157 }