示例#1
0
        static void Main(string[] args)
        {
            string format = "yyyyMMddHHmmssfff";

            DateTime time1     = DateTime.ParseExact("20151006213456001", format, CultureInfo.InvariantCulture);
            Airplane airplane1 = new Airplane("ATR423", 8000, 10000, 14000, time1);

            DateTime time2     = DateTime.ParseExact("20151006213457001", format, CultureInfo.InvariantCulture);
            Airplane airplane2 = new Airplane("ATR425", 8100, 10100, 14000, time2);

            List <Airplane> airplanesList = new List <Airplane>();

            airplanesList.Add(airplane1);

            airplanesList.Add(airplane2);

            Seperation septest = new Seperation();

            septest.ConditionDetected(airplanesList);


            Calculator testCalculator = new Calculator(airplanesList);

            Console.WriteLine(testCalculator.GetDirection(airplane2));

            //Console.WriteLine(testCalculator.GetDirection(airplane2.X_coordinate, airplane2.Y_coordinate));

            Console.WriteLine(testCalculator.CalculateSpeed(airplane2));

            Airspace airspace = new Airspace();

            Console.WriteLine(airspace.WithInAirspace(airplane1));
            Console.WriteLine(airspace.WithInAirspace(airplane2));

            IPrint print = new Print();

            print.PrintAirplaneWithSpeedAndDirection(airplane1, testCalculator, airspace);
        }
示例#2
0
        private void DecodeReadyData(object sender, RawTransponderDataEventArgs arg)
        {
            airplaneList.Clear();
            foreach (var data in arg.TransponderData)
            {
                string[] plane  = data.Split(';');
                string   tag    = plane[0];
                int      xCord  = Int32.Parse(plane[1]);
                int      yCord  = Int32.Parse(plane[2]);
                int      alti   = Int32.Parse(plane[3]);
                string   format = "yyyyMMddHHmmssfff";
                DateTime time   = DateTime.ParseExact(plane[4], format, CultureInfo.InvariantCulture);

                //Create new plane from decoder.
                Airplane airplane = new Airplane(tag, xCord, yCord, alti, time);

                //Add current Airplane to list of Airplanes.
                airplaneList.Add(airplane);

                printer.PrintAirplaneWithSpeedAndDirection(airplane, calc, space);
            }
            calc.NewPositions(airplaneList);
        }
示例#3
0
 public void PrintAirplane(Airplane airplane)
 {
     System.Console.WriteLine("Airplane: Tag: {0} // X-coordinate: {1} // Y-coordinate: {2} // Altitude: {3} // Timestamp: {4}",
                              airplane.Tag, airplane.X_coordinate, airplane.Y_coordinate, airplane.Altitude, airplane.Timestamp);
 }
示例#4
0
 public void newTrack(Airplane airplane)
 {
     Airplane = airplane;
 }