public FormattedData FormatData(string data) { string[] inputFields = data.Split(';'); currentData = new FormattedData(Convert.ToString(inputFields[0]), Convert.ToDouble(inputFields[1]), Convert.ToDouble(inputFields[2]), Convert.ToDouble(inputFields[3]), DateTime.ParseExact(inputFields[4], "yyyyMMddHHmmssfff", System.Globalization.CultureInfo.InvariantCulture), "", 0); return(currentData); }
public void HandleNewData(FormattedData currentData) { if (_seperationCalculator.IsAircraftInAirspace(currentData) == true) { foreach (FormattedData aircraft in _seperationCalculator.GetAircraftList()) { if (currentData.Tag == aircraft.Tag) { oldData = aircraft; } } currentData.Speed = _speedCalculator.CalculateSpeed(currentData, oldData); currentData.CompassCourse = _positionCalculator.CalculatePosition(currentData); _seperationCalculator.Remove(oldData); _seperationCalculator.Add(currentData); if (_seperationCalculator.IsThereConflict(currentData) == true) { IsThereConflicts = true; _render = new RenderWithSeperation(_clear); _render.PrintData(_seperationCalculator.GetAircraftList(), _seperationCalculator.GetConflicts()); } else { IsThereConflicts = false; _render = new RenderData(_clear); _render.PrintData(_seperationCalculator.GetAircraftList(), _seperationCalculator.GetConflicts()); } } else { _seperationCalculator.Add(currentData); _seperationCalculator.IsThereConflict(currentData); if (_seperationCalculator.IsThereConflict(currentData) == true) { IsThereConflicts = true; _render = new RenderWithSeperation(_clear); _render.PrintData(_seperationCalculator.GetAircraftList(), _seperationCalculator.GetConflicts()); } else { IsThereConflicts = false; _render = new RenderData(_clear); _render.PrintData(_seperationCalculator.GetAircraftList(), _seperationCalculator.GetConflicts()); } } }
public void Add(FormattedData conflict1, FormattedData conflict2) { currentConflicts.Add(new Conflict(conflict1, conflict2)); writer.LogSeperation(GetConflictList()); }
public void ReceiverOnFormattedDataReady(object sender, FormattedDataEventArgs e) { CurrentData = e.FormattedData; HandleNewData(e.FormattedData); }