public static Bitmap MapToBitmapWithLeastCost(Map mapWithheightValues, bool costMap)
        {
            Bitmap bmp = new Bitmap(mapWithheightValues.dimensions[0], mapWithheightValues.dimensions[1]);

            if (costMap)
            {
                RasterFunctions.generateCostMap(bmp, mapWithheightValues);
            }
            else
            {
                for (int y = 0; y < mapWithheightValues.dimensions[0]; y++)
                {
                    for (int x = 0; x < mapWithheightValues.dimensions[1]; x++)
                    {
                        // We find the node that have these coordinates in the list of all the nodes of the map
                        int height = mapWithheightValues.tableOfNodes[x, y].height;
                        RasterFunctions.chooseColorOfPixel(bmp, x, y, height);
                    }
                }
            }



            // we display the departure node and the surroundings in blue
            for (int x = -5; x < 6; x++)
            {
                for (int y = -5; y < 6; y++)
                {
                    if (mapWithheightValues.departureNode.coordinates[0] + x >= 0 && (mapWithheightValues.departureNode.coordinates[0] + x <= (mapWithheightValues.dimensions[0] - 1)) && mapWithheightValues.departureNode.coordinates[1] + y >= 0 && mapWithheightValues.departureNode.coordinates[1] + y <= mapWithheightValues.dimensions[1] - 1)
                    {
                        bmp.SetPixel(mapWithheightValues.departureNode.coordinates[0] + x, mapWithheightValues.departureNode.coordinates[1] + y, Color.FromArgb((int)0, (int)77, (int)255));
                    }
                }
            }

            // We display the arrival node and the surroundings in yellow
            for (int x = -5; x < 6; x++)
            {
                for (int y = -5; y < 6; y++)
                {
                    if (mapWithheightValues.arrivalNode.coordinates[0] + x >= 0 && (mapWithheightValues.arrivalNode.coordinates[0] + x <= (mapWithheightValues.dimensions[0] - 1)) && mapWithheightValues.arrivalNode.coordinates[1] + y >= 0 && mapWithheightValues.arrivalNode.coordinates[1] + y <= mapWithheightValues.dimensions[1] - 1)
                    {
                        bmp.SetPixel(mapWithheightValues.arrivalNode.coordinates[0] + x, mapWithheightValues.arrivalNode.coordinates[1] + y, Color.FromArgb((int)255, (int)239, (int)0));
                    }
                }
            }

            // We display the path in red
            foreach (Node nodeInPath in mapWithheightValues.LeastCostPath)
            {
                bmp.SetPixel(nodeInPath.coordinates[0], nodeInPath.coordinates[1], Color.FromArgb((int)255, (int)0, (int)127));
            }

            return(bmp);
        }
        // Outdated; we make the bitmap from the map directly now
        public static Bitmap ArrayToBitmap(int[,] arrayOfHeightValues)
        {
            Bitmap bmp = new Bitmap(arrayOfHeightValues.GetLength(0), arrayOfHeightValues.GetLength(1));

            for (int x = 0; x < arrayOfHeightValues.GetLength(0); x++)
            {
                for (int y = 0; y < arrayOfHeightValues.GetLength(1); y++)
                {
                    int height = (int)arrayOfHeightValues[x, y];
                    RasterFunctions.chooseColorOfPixel(bmp, x, y, height);
                }
            }

            return(bmp);
        }
        public static Bitmap MapToBitmap(Map mapWithheightValues, bool costMap)
        {
            Bitmap bmp = new Bitmap(mapWithheightValues.dimensions[0], mapWithheightValues.dimensions[1]);

            if (costMap)
            {
                RasterFunctions.generateCostMap(bmp, mapWithheightValues);
            }
            else
            {
                for (int y = 0; y < mapWithheightValues.dimensions[0]; y++)
                {
                    for (int x = 0; x < mapWithheightValues.dimensions[1]; x++)
                    {
                        // We find the node that have these coordinates in the list of all the nodes of the map
                        int height = mapWithheightValues.tableOfNodes[x, y].height;
                        RasterFunctions.chooseColorOfPixel(bmp, x, y, height);
                    }
                }
            }
            return(bmp);
        }