/// <summary>
        /// A constructor for Pedestrian lane
        /// </summary>
        /// <param name="iD">the id of the lane</param>
        /// <param name="points">a list of points on the lane</param>
        /// <param name="pLight">the light object on the lane</param>
        /// <param name="crossing">the crossing this lane belongs to</param>
        public PedestrianLane(int iD, List<Point> points, PedestrianLight pLight, Crossing_B crossing)
            : base(iD, points)
        {
            this.PLight = pLight;
            this.parent = crossing;

        }
Example #2
0
        /// <param name="crossingId">The Id of the crossing</param>
        /// <param name="position"></param>
        public Crossing_B(int crossingId)
            : base(crossingId)
        {


            lanes = new List<TrafficLane>();
            tLanes = new List<TrafficLane>();
            Light lightNORTH = new Light(false);
            Light lightEAST = new Light(false);
            Light lightSOUTH = new Light(false);
            Light lightWEST = new Light(false);


            for (int i = 0; i < 4; i++)
            {
                lanes.Add(new TrafficLane(i, false, (Direction)i, null, tLanes, this));
                tLanes = new List<TrafficLane>();
            }

            //Adding the list of lanes that a certain lane can go to, as well as creating the lanes.

            //For South
            tLanes.Add(lanes.ElementAt(2));
            lanes.Add(new TrafficLane(4, true, Direction.SOUTH, lightSOUTH, tLanes, this));
            tLanes = new List<TrafficLane>();

            //For West
            tLanes.AddRange(new TrafficLane[] { lanes.ElementAt(0), lanes.ElementAt(3) });
            lanes.Add(new TrafficLane(5, true, Direction.WEST, lightWEST, tLanes, this));
            tLanes = new List<TrafficLane>();

            tLanes.Add(lanes.ElementAt(2));
            lanes.Add(new TrafficLane(6, true, Direction.WEST, lightWEST, tLanes, this));
            tLanes = new List<TrafficLane>();

            //For North
            tLanes.Add(lanes.ElementAt(0));
            lanes.Add(new TrafficLane(7, true, Direction.NORTH, lightNORTH, tLanes, this));
            tLanes = new List<TrafficLane>();

            //For East
            tLanes.AddRange(new TrafficLane[] { lanes.ElementAt(1), lanes.ElementAt(2) });
            lanes.Add(new TrafficLane(8, true, Direction.EAST, lightEAST, tLanes, this));
            tLanes = new List<TrafficLane>();

            tLanes.Add(lanes.ElementAt(0));
            lanes.Add(new TrafficLane(9, true, Direction.EAST, lightEAST, tLanes, this));
            tLanes = new List<TrafficLane>();

            base.Lanes.AddRange(lanes);

            //Adding the list of pedestrians
            pedestrians = new List<Pedestrian>();
            //Adding the pedestrian lane list and the pedestrian lights
            pLanes = new List<PedestrianLane>();
            //top lane
            PedestrianLight pLight = new PedestrianLight(false, false);

            pLanes.Add(new PedestrianLane(1, CalculatePedestrianLanePoints(1), pLight, this));
            //bottom lane
            pLight = new PedestrianLight(false, false);

            pLanes.Add(new PedestrianLane(2, CalculatePedestrianLanePoints(2), pLight, this));

        }
Example #3
0
 /// <summary>
 /// A constructor for Pedestrian lane
 /// </summary>
 /// <param name="iD">the id of the lane</param>
 /// <param name="points">a list of points on the lane</param>
 /// <param name="pLight">the light object on the lane</param>
 /// <param name="crossing">the crossing this lane belongs to</param>
 public PedestrianLane(int iD, List <Point> points, PedestrianLight pLight, Crossing_B crossing)
     : base(iD, points)
 {
     this.PLight = pLight;
     this.parent = crossing;
 }
Example #4
0
        /// <param name="crossingId">The Id of the crossing</param>
        /// <param name="position"></param>
        public Crossing_B(int crossingId)
            : base(crossingId)
        {
            lanes  = new List <TrafficLane>();
            tLanes = new List <TrafficLane>();
            Light lightNORTH = new Light(false);
            Light lightEAST  = new Light(false);
            Light lightSOUTH = new Light(false);
            Light lightWEST  = new Light(false);


            for (int i = 0; i < 4; i++)
            {
                lanes.Add(new TrafficLane(i, false, (Direction)i, null, tLanes, this));
                tLanes = new List <TrafficLane>();
            }

            //Adding the list of lanes that a certain lane can go to, as well as creating the lanes.

            //For South
            tLanes.Add(lanes.ElementAt(2));
            lanes.Add(new TrafficLane(4, true, Direction.SOUTH, lightSOUTH, tLanes, this));
            tLanes = new List <TrafficLane>();

            //For West
            tLanes.AddRange(new TrafficLane[] { lanes.ElementAt(0), lanes.ElementAt(3) });
            lanes.Add(new TrafficLane(5, true, Direction.WEST, lightWEST, tLanes, this));
            tLanes = new List <TrafficLane>();

            tLanes.Add(lanes.ElementAt(2));
            lanes.Add(new TrafficLane(6, true, Direction.WEST, lightWEST, tLanes, this));
            tLanes = new List <TrafficLane>();

            //For North
            tLanes.Add(lanes.ElementAt(0));
            lanes.Add(new TrafficLane(7, true, Direction.NORTH, lightNORTH, tLanes, this));
            tLanes = new List <TrafficLane>();

            //For East
            tLanes.AddRange(new TrafficLane[] { lanes.ElementAt(1), lanes.ElementAt(2) });
            lanes.Add(new TrafficLane(8, true, Direction.EAST, lightEAST, tLanes, this));
            tLanes = new List <TrafficLane>();

            tLanes.Add(lanes.ElementAt(0));
            lanes.Add(new TrafficLane(9, true, Direction.EAST, lightEAST, tLanes, this));
            tLanes = new List <TrafficLane>();

            base.Lanes.AddRange(lanes);

            //Adding the list of pedestrians
            pedestrians = new List <Pedestrian>();
            //Adding the pedestrian lane list and the pedestrian lights
            pLanes = new List <PedestrianLane>();
            //top lane
            PedestrianLight pLight = new PedestrianLight(false, false);

            pLanes.Add(new PedestrianLane(1, CalculatePedestrianLanePoints(1), pLight, this));
            //bottom lane
            pLight = new PedestrianLight(false, false);

            pLanes.Add(new PedestrianLane(2, CalculatePedestrianLanePoints(2), pLight, this));
        }