/// <summary>
        /// This method will be called to add a crossing to the traffic system
        /// </summary>
        /// <param name="position">The position of the crossing tht the user wants to place the crossing</param>
        /// <returns>returns true if the crossing is successfully added and false otherwise</returns>


        public bool addCrossing(Crossing crossing, Point pt)
        {
            if (traficsrossings.Count == 0)
            {
                traficsrossings.Add(crossing);

                return(true);
            }
            else
            {
                int size = traficsrossings.Count;
                for (int x = 0; x < size; x++)
                {
                    if (pt == traficsrossings[x].GetRectangle().Location)
                    {
                        // MessageBox.Show("the selected area have crossing, please select other place");
                        return(false);
                    }
                }

                traficsrossings.Add(crossing);
                findNeighbour(crossing);
                return(true);
            }
        }
        /// <summary>
        /// a method which checks the neighbours of a given crossing corresponding to their direction
        /// </summary>
        /// <param name="currentCrossing"> the crossing which its neighbours are to be found</param>
        /// <returns>a number of crossing which are neighbours to the parameter crossing</returns>
        public void findNeighbour(Crossing currentCrossing)
        {
            for (int x = 0; x < traficsrossings.Count; x++)
            {
                //adding north
                if (currentCrossing.position.Y - currentCrossing.crossingrect.Height == traficsrossings[x].position.Y && currentCrossing.position.X == traficsrossings[x].position.X)
                {
                    currentCrossing.myneighbours.Insert(0, traficsrossings[x]);
                    // to add for the other existing neghbour
                    traficsrossings[x].myneighbours.Insert(2, currentCrossing);
                }
                //adding east
                else if (currentCrossing.position.X + currentCrossing.crossingrect.Width == traficsrossings[x].position.X && currentCrossing.position.Y == traficsrossings[x].position.Y)
                {
                    currentCrossing.myneighbours.Insert(1, traficsrossings[x]);

                    traficsrossings[x].myneighbours.Insert(3, currentCrossing);
                }
                // adding south
                else if (currentCrossing.position.Y + currentCrossing.crossingrect.Height == traficsrossings[x].position.Y && currentCrossing.position.X == traficsrossings[x].position.X)
                {
                    currentCrossing.myneighbours.Insert(2, traficsrossings[x]);

                    traficsrossings[x].myneighbours.Insert(0, currentCrossing);
                }
                //  adding west
                else if (currentCrossing.position.X - currentCrossing.crossingrect.Width == traficsrossings[x].position.X && currentCrossing.position.Y == traficsrossings[x].position.Y)
                {
                    currentCrossing.myneighbours.Insert(3, traficsrossings[x]);

                    traficsrossings[x].myneighbours.Insert(1, currentCrossing);
                }
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="currentcrossing"></param>
 public void incomingAndOutgoingcar(Crossing currentcrossing)
 {
     // findNeighbour(current);
 }