Exemple #1
0
        /// <summary>
        /// Constructor for an in-vehicle segment
        /// </summary>
        /// <param name="departure"></param>
        /// <param name="arrival"></param>
        /// <param name="vehicle"></param>
        /// <param name="headSign"></param>
        /// <param name="intermediateStops"></param>
        /// <exception cref="ArgumentNullException"></exception>
        internal Segment(TimedLocation departure, TimedLocation arrival,
                         string vehicle, string headSign, List <TimedLocation> intermediateStops)
        {
            Departure = departure;
            Arrival   = arrival;
            Vehicle   = vehicle;
            Headsign  = headSign;
            if (Vehicle == null)
            {
                throw new ArgumentNullException(nameof(Vehicle));
            }

            Generator   = null;
            Coordinates = new List <Coordinate>();

            AllStops = intermediateStops;
            if (Arrival.Time != null && Departure.Time != null)
            {
                TotalTime = (uint)(Arrival.Time.Value - Departure.Time.Value).TotalSeconds;
            }
            else
            {
                TotalTime = 0;
            }

            if (intermediateStops != null)
            {
                foreach (var intermediateStop in intermediateStops)
                {
                    Coordinates.Add(new Coordinate(intermediateStop.Location.Lat, intermediateStop.Location.Lon));
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Constructor for a segment generated by an othermode, e.g. a walk, cycling, ...
 /// </summary>
 internal Segment(TimedLocation departure, TimedLocation arrival, string generator, List <Coordinate> coordinates,
                  uint totalTime, string license = null)
 {
     Departure   = departure;
     Arrival     = arrival;
     Vehicle     = null;
     Headsign    = null;
     Generator   = generator;
     Coordinates = coordinates;
     TotalTime   = totalTime;
     License     = license;
 }