Beispiel #1
0
        static void Main(string[] args)
        {
            double minLatitudeInput  = 0;
            double minLongitudeInput = 0;
            double maxLatitudeInput  = 0;
            double maxLongitudeInput = 0;
            int    maxLevelOfDetail  = 1; // between 1 and 23
            string imagePath         = "";
            Quilt  quilt;

            // get user input
            Console.WriteLine("Enter q for any input to quit.");
            while (true)
            {
                minLatitudeInput  = GetUserInput <double>("Enter the minimum latitude value of the desired bounding box: ");
                minLongitudeInput = GetUserInput <double>("Enter the minimum longitude value of the desired bounding box: ");
                maxLatitudeInput  = GetUserInput <double>("Enter the maximum latitude value of the desired bounding box: ");
                maxLongitudeInput = GetUserInput <double>("Enter the maximum longitude value of the desired bounding box: ");
                maxLevelOfDetail  = GetUserInput <int>("Enter the maximum level of detail (1-23): ");

                // correct values before sending them to get bounding box
                if (maxLevelOfDetail > 21)
                {
                    maxLevelOfDetail = 21;
                }
                else if (maxLevelOfDetail < 1)
                {
                    maxLevelOfDetail = 1;
                }
                TileSystem.Clip(minLatitudeInput, TileSystem.MinLatitude, TileSystem.MaxLatitude);
                TileSystem.Clip(minLongitudeInput, TileSystem.MinLongitude, TileSystem.MaxLongitude);

                try
                {
                    quilt = new Quilt(minLatitudeInput, minLongitudeInput, maxLatitudeInput, maxLongitudeInput, maxLevelOfDetail);
                    break;
                }
                catch (Exception)
                {
                    Console.WriteLine("Bounding Box invalid (too large or zero).");
                }
            }
            imagePath = GetUserInput <string>("Enter the absolute path to the directory you would like the image saved in: ");
            Console.WriteLine("Fetching images... (this may take some time)");
            // Bitmap image = GetImageInBBAsync(41.78, -87.7, 41.783, -87.705);
            // my absolute path = C:\Users\Julianna\Documents\Documents\Academic\CS 513 Windows\CS 513 Repository HW 3\CS513-Homework3
            Bitmap image = GetImageInBBAsync(quilt, minLatitudeInput, minLongitudeInput, maxLatitudeInput, maxLongitudeInput, maxLevelOfDetail);

            image.Save(imagePath + "/BoundingBoxImage.png", ImageFormat.Png);
        }