Example #1
0
        //returns the correct image for the status of a traffic light
        private Image showLightStatusOverpass(TrafficLight light)
        {
            if (light.isRight())
            {
                if (light.forStatus() && light.rightStatus())
                {
                    return Image.FromFile("rightForwardRightGreen.jpg");
                }

                else if (!light.forStatus() && light.rightStatus())
                {
                    return Image.FromFile("rightGreenRed.jpg");
                }

                else if (!light.forStatus() && !light.rightStatus())
                {
                    return Image.FromFile("rightRed.jpg");
                }

                else if (light.forStatus() && !light.rightStatus())
                {
                    return Image.FromFile("rightForwardGreen.jpg");
                }
                else return Image.FromFile("rightRed.jpg");
            }

            else if (light.isLeft())
            {
                if (light.forStatus() && light.leftStatus())
                {
                    return Image.FromFile("leftForwardRightGreen.jpg");
                }

                else if (!light.forStatus() && light.leftStatus())
                {
                    return Image.FromFile("leftGreenRed.jpg");
                }

                else if (!light.forStatus() && !light.leftStatus())
                {
                    return Image.FromFile("leftRed.jpg");
                }

                else if (light.forStatus() && !light.leftStatus())
                {
                    return Image.FromFile("leftForwardGreen.jpg");
                }
                else return Image.FromFile("leftRed.jpg");

            }

            else return Image.FromFile("leftRed.jpg");
        }
Example #2
0
        private Image showLightStatus4Way(TrafficLight light)
        {
            if (light.forStatus() && light.leftStatus() && light.rightStatus())
            {
                return Image.FromFile("allForwardAllGreen.jpg");
            }

            else if (!light.forStatus() && light.leftStatus() && light.rightStatus())
            {
                return Image.FromFile("allRightLeftGreenRed.jpg");
            }

            else if (!light.forStatus() && !light.leftStatus() && light.rightStatus())
            {
                return Image.FromFile("allRightGreenRed.jpg");
            }

            else if (!light.forStatus() && !light.leftStatus() && !light.rightStatus())
            {
                return Image.FromFile("allRed.jpg");
            }

            else if (light.forStatus() && !light.leftStatus() && !light.rightStatus())
            {
                return Image.FromFile("allForwardGreen.jpg");
            }

            else if (light.forStatus() && light.leftStatus() && !light.rightStatus())
            {
                return Image.FromFile("allForwardLeftGreen.jpg");
            }

            else if (!light.forStatus() && light.leftStatus() && !light.rightStatus())
            {
                return Image.FromFile("allLeftGreenRed.jpg");
            }

            else if (light.forStatus() && !light.leftStatus() && light.rightStatus())
            {
                return Image.FromFile("allForwardRightGreen.jpg");
            }

            else return Image.FromFile("allRed.jpg");
        }