public AirlineFlightLocation ComputeLocation(DateTime currentTime)
        {
            var airplane = new AirlineFlightLocation();

            airplane.Time = currentTime;
            if (currentTime.Ticks < this.DepartureTime.Ticks) // check if the flight started
            {
                //airplane.Bearing = this.FlightPath.BearingInitial;
                //airplane.Latitude = this.Origin.Latitude;
                //airplane.Longitude = this.Origin.Longitude;
                //airplane.Duration = TimeSpan.FromMinutes(0);
                //airplane.Distance = 0.0;
                //airplane.Progress = 0.0;
            }
            else if (currentTime.Ticks > this.ArrivalTime.Ticks) // check if flight ended
            {
                airplane.Bearing   = this.FlightPath.BearingFinal;
                airplane.Latitude  = this.Destination.Latitude;
                airplane.Longitude = this.Destination.Longitude;
                airplane.Duration  = this.DurationTotal;
                airplane.Distance  = this.FlightPath.Distance;
                airplane.Progress  = 1.0;
            }
            else if (currentTime.Ticks >= this.DepartureTime.Ticks &&
                     currentTime.Ticks <= this.ArrivalTime.Ticks)
            {
                var flightDuration = this.ComputeDuration(currentTime);
                var flightProgress = this.ComputeProgress(currentTime);

                var flightDistance = this.FlightPath.Distance * flightProgress;
                var flightLocation = GeoCalculator.GetPathLocation(this.Origin, this.Destination, flightDistance);

                airplane.Latitude  = flightLocation.Latitude;
                airplane.Longitude = flightLocation.Longitude;
                airplane.Distance  = flightDistance;
                airplane.Duration  = flightDuration;
                airplane.Progress  = flightProgress;
                airplane.Bearing   = flightProgress >= 0.905
                                       ? this.FlightPath.BearingFinal
                                       : GeoCalculator.GetBearing(flightLocation, this.Destination);
            }
            return(airplane);
        }
        public AirlineFlightLocation ComputeLocation(DateTime currentTime)
        {
            var airplane = new AirlineFlightLocation();

            airplane.Time = currentTime;
            if (currentTime.Ticks >= Flight.DepartureTime.Ticks ||
                currentTime.Ticks <= Flight.ArrivalTime.Ticks)
            {
                var flightDuration = this.Flight.ComputeDuration(currentTime);
                var flightProgress = this.Flight.ComputeProgress(currentTime);

                var flightDistance = this.Flight.FlightPath.Distance * flightProgress;
                var flightLocation = GeoCalculator.GetPathLocation(this.Flight.Origin, this.Flight.Destination, flightDistance);

                airplane.Distance = flightDistance;
                airplane.Duration = flightDuration;
                airplane.Progress = flightProgress;
                airplane.Bearing  = flightProgress >= 0.905
                                       ? this.Flight.FlightPath.BearingFinal
                                       : GeoCalculator.GetBearing(flightLocation, this.Flight.Destination);
            }
            return(airplane);
        }