Update End of Term Assignment authored by Zorenböhmer Christina's avatar Zorenböhmer Christina
...@@ -18,7 +18,7 @@ This End of Term (EoT) Assignment shall: ...@@ -18,7 +18,7 @@ This End of Term (EoT) Assignment shall:
Before launching into a detailed description of our code and result, we first want to discuss a few key aspects that we kept in mind for this assignment: Before launching into a detailed description of our code and result, we first want to discuss a few key aspects that we kept in mind for this assignment:
### Aim 1. Modularity (Object-Oriented Programming) ### Aim 1. Modularity
Since this assignment contains a variety of steps, it would lead to an extremely long and complex code if we designed it so that all the code was contained in a single class. Instead, after spending some time discussing our plan of action, we quickly opted for a more modular approach. This way, we can easily and intuitively dissect the programme into its sub-components. This division of sub-tasks makes it much easier for us to keep a clear structure in the programme and to easily jump into any of the sub-components if we need to work on that part. In this manner, we created one main executable class (`GoogleEarthTweetMapper.java`) that will bring all the individual steps together. Since this assignment contains a variety of steps, it would lead to an extremely long and complex code if we designed it so that all the code was contained in a single class. Instead, after spending some time discussing our plan of action, we quickly opted for a more modular approach. This way, we can easily and intuitively dissect the programme into its sub-components. This division of sub-tasks makes it much easier for us to keep a clear structure in the programme and to easily jump into any of the sub-components if we need to work on that part. In this manner, we created one main executable class (`GoogleEarthTweetMapper.java`) that will bring all the individual steps together.
...@@ -30,14 +30,31 @@ Although it was not technically required by the assignment instructions, we want ...@@ -30,14 +30,31 @@ Although it was not technically required by the assignment instructions, we want
Specifically, we wanted to allow user input for these decisions: Specifically, we wanted to allow user input for these decisions:
**1.** Ask the user to **choose a local directory**, where the programme would store the tweets.csv, tweets.kml, boston.png, and boston.kml files. **1.** Inform the user that the programme will download the CSV and KML files and **ask them for permission to store the files locally**.
```java ```java
Scanner askUser = new Scanner(System.in); Scanner askUser = new Scanner(System.in); // warning coming from non-closed scanner. Note: if we close it, subsequent scanners fail to work.
System.out.println("Hello! Welcome to this Google Earth Tweet and WMS Mapper.\n\nBefore we get started, could you please enter a local directory (= a folder) where a few files may be stored?\n" String answer;
+ "Simply enter a filepath below and hit enter.\nAn example would look like this: C:\\\\Users\\\\Christina\\\\Documents\\\\EoT");
directory = askUser.next(); System.out.println("Hello! Welcome to this Google Earth Tweet and WMS Mapper!\n\n"
+ "This programme will:\n"
+ "1: download an image of Boston from a WMS\n"
+ "2: convert it into a KML structure\n"
+ "3: download a tweets.csv file from the web\n"
+ "4: convert it into a KML structure\n"
+ "5: launch both kml files in Google Earth\n\n"
+ "The downloaded files will be stored at C:\\Users\\Public\\Documents\n"
+ "If this is fine, please enter Y below and hit enter to continue! If not, we will stop the programme and you can manually change the directory at the very top of this class's code.");
answer = askUser.next();
// askUser.close();
if(answer.contains("Y") || answer.contains("y") || answer.contains("yes") || answer.contains("Yes")) {
System.out.println("Great! Lets get started!\n");
} else {
System.out.println("We've stopped the programme. Please adjust the code and start again!");
System.exit(0);
}
``` ```
...@@ -46,10 +63,21 @@ System.out.println("Hello! Welcome to this Google Earth Tweet and WMS Mapper.\n\ ...@@ -46,10 +63,21 @@ System.out.println("Hello! Welcome to this Google Earth Tweet and WMS Mapper.\n\
```java ```java
Scanner askServiceInfo = new Scanner(System.in); Scanner askServiceInfo = new Scanner(System.in); //warning coming from non-closed scanner. Note: if scanner is closed subsequent scanners fail to work.
String answer; String answer;
System.out.println("Would you like additional information on the WMS service while the programme runs? Type Y for yes or anything else for no and hit enter."); System.out.println("\nWould you like additional information on the WMS service while the programme runs? Type Y for yes or anything else for no and hit enter.");
answer = askServiceInfo.next(); answer = askServiceInfo.next();
// askServiceInfo.close();
if(answer.contains("Y") || answer.contains("y") || answer.contains("yes") || answer.contains("Yes")) {
System.out.println("\tThe WMS capabilities are being retreived from a server called: " + serverName +"\n\tAnd the server's title is: " + serverTitle +"\n\t" +
"The requested image will be stored as a .png with dimensions of 1000 x 1000 pixels.\n\t" +
"The coordinate reference system is set to ESPG:4326.");
System.out.println("\tRequested GetMap URL: " + request.getFinalURL());
} else {
System.out.println("Alright.");
}
``` ```
...@@ -58,10 +86,18 @@ Scanner askServiceInfo = new Scanner(System.in); ...@@ -58,10 +86,18 @@ Scanner askServiceInfo = new Scanner(System.in);
```java ```java
Scanner askContinue = new Scanner(System.in); Scanner askContinue = new Scanner(System.in);
String answer1; String answer1;
System.out.println("Would you like to proceed to launch Google Earth now? Type Y for yes or anything else for no and hit enter."); System.out.println("Would you like to proceed to launch Google Earth now? Type Y for yes or anything else for no and hit enter.");
answer1 = askContinue.next(); answer1 = askContinue.next();
askContinue.close();
if(answer1.contains("Y") || answer1.contains("y") || answer1.contains("yes") || answer1.contains("Yes")) {
System.out.println("Proceeding... ");
} else {
System.out.println("We've ended the programme for you. If you'd like to try again, run the programme again. :)");
System.exit(0);
}
``` ```
... ...
......