public void HandleNewTrackData(TrackData trackdata) { //Check if no track data with given tag exists. if (_currentTracks.Exists(x => x._Tag == trackdata._Tag) == false) { // Add the new track if coordinates are inside the given boundaries of the airspace. if (_airspace.CheckIfInMonitoredArea(trackdata._CurrentXcord, trackdata._CurrentYcord, trackdata._CurrentZcord)) { AddTrack(trackdata); } } else { // Update trackdata TrackData trackToEdit = _currentTracks.Find(x => x._Tag == trackdata._Tag); trackToEdit._CurrentXcord = trackdata._CurrentXcord; trackToEdit._CurrentYcord = trackdata._CurrentYcord; trackToEdit._CurrentZcord = trackdata._CurrentZcord; trackToEdit._CurrentCourse = trackdata._CurrentCourse; trackToEdit._CurrentHorzVel = trackToEdit._CurrentHorzVel; // Remove tracks if out of airspace if (!(_airspace.CheckIfInMonitoredArea(trackToEdit._CurrentXcord, trackToEdit._CurrentYcord, trackToEdit._CurrentZcord))) { RemoveTrack(trackToEdit._Tag); } // Check for potential seperation events CheckForSeperationEvents(trackToEdit); } // Check for potential seperation events CheckForSeperationEvents(trackdata); // Remove separations event after update RemoveSeparationEvents(); // Render updated tracks to console RenderTracks(); // Render seperation events RenderSeperationEvents(); }
public void HandleNewTrackData(TrackData trackdata) { //Check if no track data with given tag exists. if (CurrentTracks.Exists(x => x.Tag == trackdata.Tag) == false) { // Add the new track if coordinates are inside the given boundaries of the airspace. if (_airspace.CheckIfInMonitoredArea(trackdata.CurrentXcord, trackdata.CurrentYcord, trackdata.CurrentZcord)) { AddTrack(trackdata); //string time = trackdata._TimeStamp; //TrackEnteredEvent TrackEnteredEvent = new TrackEnteredEvent(time, trackdata, true, _outputConsole, _outputFile); CurrentEvents.AddTrackEnteredEventFor(trackdata, _outputFile); } } else { //Update trackdata UpdateTrackData(trackdata); // Remove tracks if out of airspace CheckIfTrackdataIsStillInAirspace(trackdata); // Check for potential seperation events CheckForSeperationEvents(trackdata); } //Remove all events that are not relevant anymore CurrentEvents.cleanUpEvents(); // Check for potential seperation events CheckForSeperationEvents(trackdata); // Update status of flightEvents' _isRaised-attribute. UpdateSeperationEventStatus(); }