protected void sendEvent(NewTrackArgs args)
 {
     if (NewTracks != null)
     {
         NewTracks(this, args);
     }
 }
Esempio n. 2
0
        public void OnTrackRecieved(object sender, NewTrackArgs newTrackArgs)
        {
            // Loop through list of tracks
            foreach (var track in newTrackArgs.Tracks)
            {
                // if old in list
                //remove from list
                var old_track = GetTrackById(track.TagId);

                if (old_track != null)
                {
                    TracksInAirspace.Remove(old_track);
                }

                // If not in airspace
                // do nothing
                if (!Airspace.IsInside(track.X, track.Y, track.Altitude))
                {
                    if (old_track != null)
                    {
                        TrackLeavesAirSpaceEvent?.Invoke(this, new TrackLeavesAirSpaceArgs {
                            Track = old_track
                        });
                    }
                    //Console.WriteLine("Not in Airspace: " + track.TagId);

                    continue;
                }

                if (old_track != null)
                {
                    Tracker.calculateCompassCourse(old_track, track);
                    Tracker.calculateSpeed(old_track, track);
                }
                else
                {
                    NewTrackInTairSpaceEvent?.Invoke(this, new NewTrackInAirSpaceArgs {
                        Track = track
                    });
                }

                //Console.WriteLine("In Airspace with speed: " + track.TagId + " " + track.Velocity);
                // Verify if in airspace
                // Add new track
                TracksInAirspace.Add(track);
            }

            var tracksInAirSpaceArgs = new TracksInAirspaceArgs {
                Tracks = TracksInAirspace
            };

            TracksInAirspaceEvent(this, tracksInAirSpaceArgs);
        }
        public void OnTransponderData(object sender, RawTransponderDataEventArgs data)
        {
            // Split tracks
            var tracks = SplitData(data.TransponderData);

            // Put tracks i wrapper
            var newTrackArgs = new NewTrackArgs {
                Tracks = tracks
            };

            // Send Event
            sendEvent(newTrackArgs);
        }