Пример #1
0
        private void OnFlightTracksUpdated(object o, FlightTracksUpdatedEventArgs args)
        {
            List <IFlightTrack> allUpdatedFlights = args.UpdatedFlights;

            _content.Clear();

            foreach (var f in allUpdatedFlights)
            {
                var pos = f.GetCurrentPosition();
                if (_airspaceArea.IsInside((int)pos.X, (int)pos.Y, (int)f.GetCurrentAltitude()))
                {
                    _content.Add(f);
                }
            }

            FlightTracksUpdated?.Invoke(this, new FlightTracksUpdatedEventArgs(_content));
            AirspaceContentUpdated?.Invoke(this, new AirspaceContentEventArgs(_content));
        }
Пример #2
0
        private void OnFlightTrackDataReady(object o, FlightTrackDataEventArgs args)
        {
            Debug.Log("FlightManager: Handling FlightTrackDataReady event, recieved " + args.FTDataPoints.Count + " Datapoints");
            List <FTDataPoint>  recievedDataPoints = args.FTDataPoints;
            List <IFlightTrack> updatedflights     = new List <IFlightTrack>();

            foreach (var dp in args.FTDataPoints)
            {
                if (!_flights.Exists(x => x.GetTag() == dp.Tag))
                {
                    Debug.Log("New flight entered sensor range with tag '" + dp.Tag + "'");
                    _flights.Add(new Flight(dp));
                }

                //Debug.Log("FlightManager: Adding datapoint to flight with tag '" + dp.Tag + "'");
                IFlightTrack f = _flights.Find(x => x.GetTag() == dp.Tag);
                f.AddDataPoint(dp);

                updatedflights.Add(f);
            }

            Debug.Log("FlightManager: Invoking FlightTracksUpdated, sending list of " + updatedflights.Count + " updated flights");
            FlightTracksUpdated?.Invoke(this, new FlightTracksUpdatedEventArgs(updatedflights));
        }