static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            AirField airfield = new AirField();
            //Application.Run(airfield);
            ITuple  setupTuple = new dotSpace.Objects.Space.Tuple(noOfRunways, noOfTaxiWays, taxiWayCapacity, noOfPlanes, airfield, realisticMode, windDirection);
            Airport airport    = new Airport(setupTuple);

            //airport.printElements();
            //Console.Read();
        }
示例#2
0
        public void spawnAirplanes(AirField airField)
        {
            int counter = 0;

            while (counter < noOfPlanes)
            {
                Airplane airplane = new Airplane(controlTowerSpace, runWaySpace, taxiWaySpace, "" + counter, airField, realisticMode, windDirection);
                //(new System.Threading.Thread(new System.Threading.ThreadStart(() => airplane.landing()))).Start();

                if (counter < noOfPlanes / 2)
                {
                    (new System.Threading.Thread(new System.Threading.ThreadStart(() => airplane.takeoff()))).Start();
                    //(new System.Threading.Thread(new System.Threading.ThreadStart(() => airplane.flyEternally("Airspace")))).Start();
                }
                else
                {
                    (new System.Threading.Thread(new System.Threading.ThreadStart(() => airplane.landing()))).Start();
                    //(new System.Threading.Thread(new System.Threading.ThreadStart(() => airplane.flyEternally("Hangar")))).Start();
                }

                counter++;
            }
        }
示例#3
0
        public Airplane(SequentialSpace CTSpace, SequentialSpace rwSpace, SequentialSpace twSpace, string credentials, AirField airField, bool realisticMode, string windDirection) //SpaceRepository airportRepository)
        {
            //this.airport = airportRepository;
            this.controlTowerSpace = CTSpace;
            this.runwaySpace       = rwSpace;
            this.taxiwaySpace      = twSpace;
            this.credentials       = credentials;
            this.runwayGUILock     = credentials + "Runway" + "-lock";
            this.taxiwayGUILock    = credentials + "Taxiway" + "-lock";

            this.translator = new Controller.Translator(rwSpace, twSpace, airField);

            this.windDirection = windDirection;
            this.realisticmode = realisticMode;
        }
示例#4
0
        public Airport(ITuple setup)//, int noOfHangers, int noOfControlTowers)
        {
            //this.airport = new SpaceRepository();
            this.runWaySpace       = new SequentialSpace();
            this.taxiWaySpace      = new SequentialSpace();
            this.controlTowerSpace = new SequentialSpace();
            this.airplaneSpace     = new SequentialSpace();
            //this.hanger = new SequentialSpace();
            //this.controlTower = new SequentialSpace();
            this.noOfRunways   = (int)setup[0];
            this.noOfTaxiways  = (int)setup[1];
            this.barrier       = (int)setup[2];
            this.noOfPlanes    = (int)setup[3];
            this.airField      = (AirField)setup[4];
            this.realisticMode = (bool)setup[5];
            this.windDirection = (string)setup[6];
            //this.noOfHangers = noOfHangers;
            //this.noOfControlTowers = noOfControlTowers;
            while (noOfRunways > 0 || noOfTaxiways > 0)//|| noOfHangers > 0)
            {
                if (noOfRunways > 0)
                {
                    if (noOfRunways == 2)
                    {
                        this.runWaySpace.Put("Runway Nr.", 0);
                    }

                    else
                    {
                        this.runWaySpace.Put("Runway Nr.", 90);
                    }

                    //this.runWaySpace.Put("Runway Nr. " + noOfRunways + " -lock");
                    noOfRunways--;
                }
                if (noOfTaxiways > 0)
                {
                    if (noOfTaxiways == 5)
                    {
                        this.taxiWaySpace.Put("Taxiway", "Alfa", barrier, barrier > 0);
                    }
                    else if (noOfTaxiways == 4)
                    {
                        this.taxiWaySpace.Put("Taxiway", "Beta", barrier, barrier > 0);
                    }
                    else if (noOfTaxiways == 3)
                    {
                        this.taxiWaySpace.Put("Taxiway", "Charlie", barrier, barrier > 0);
                    }
                    else if (noOfTaxiways == 2)
                    {
                        this.taxiWaySpace.Put("Taxiway", "Delta", barrier, barrier > 0);
                    }
                    else
                    {
                        this.taxiWaySpace.Put("Taxiway", "Epsilon", barrier, barrier > 0);
                    }
                    noOfTaxiways--;
                }

                /*if (noOfHangers > 0)
                 * {
                 *  this.hanger.Put("Hanger Nr.", noOfHangers);
                 *  noOfHangers--;
                 * }*/
                while (noOfControlTowers > 0)
                {
                    ControlTower controlTower = new ControlTower(runWaySpace, taxiWaySpace, hangerSpace, airplaneSpace);
                    if (controlTowerSpace != null)
                    {
                        this.controlTowerSpace.Put("Control Tower Nr.", noOfControlTowers, controlTower);
                        noOfControlTowers--;
                    }
                }
            }
            spawnAirplanes(airField);
            //this.airport.AddSpace("Runways", runWaySpace);
            //this.airport.AddSpace("Runway Locks", runWayLockSpace);
            //this.airport.AddSpace("Taxiways", taxiWaySpace);
            //this.airport.AddSpace("Hangers", hangerSpace);
            //this.airport.AddSpace("Control Towers", controlTowerSpace);
        }