The assignment should be submitted via Faser. Your submission should comprise a single zip file containing the source code (i.e. the .java files) for all the classes that you have written as solutions to the assignment tasks. No other files should be included in the zip file.
The name of your zip file should include both your name and your registration number
In this part you will create a visualisation of the data. This visualisation can be based on random values if you did not complete any of the previous exercises. You can consider the longitude as your x-coordinate, and the latitude as your y-coordinate.
JFrame and JComponent
Create a JFrame with a JComponent. You can use a design of your choice and any source code from the lecture notes, support classes and the lab solutions. In the JComponent visualise the altitude data at the corresponding coordinates from either the file or the randomly generated data. If you did not complete Exercise 2 you can generate random values between -5000 and +5000 in a grid of 360 by 180 pixels and draw those values onto the JComponent. The visualisation may be via grey scale.
There are two important aspects to the visualisation: the rate at which you sample the data in the file and the size of the visualisation you use to represent the altitude in your JComponent. If the size of the visualisation is too small gaps will appear and the colour of the background of your JComponent will show.
Add some colour
Add some colour to your visualisation. To get credit for this part you must use one colour gradient for altitudes below 0 and a different colour gradient for altitudes above 0. The colour should show a variation that depends on the altitude, that means 50 m above zero should be distinguishable from 3000 m above zero.
Have a look at (link) or Figure 1 for some inspiration on which colours you could use. You may use as many different colour gradients as you wish but will receive full credit if you use at least two.
Centre the map on 0 longitude. This should then be in the centre of your JComponent. If you ar using a random array because you did not complete Exercise 2 centre on the first column of your array.
Add a method that will shift the sea level of your rendering. Ideally you will modify the altitudes in the data structure that is the basis for your visualisation. Iterating over maps is a bit tricky but it is possible to do so with for-each loops by accessing the so-called entrySet.
Create a new class MapCoordinate in a file called MapCoordinate.java. See Figure 7 for the corresponding class diagram.
The instance variables for latitude, longitude and altitude should be immutable and public. Design a corresponding constructor. You may add additional variables if you wish.
The class should have a method to calculate the distance to another MapCoordinate in km across the surface of the globe. Altitude must not be taken into account and you can assume the Earth is a smooth sphere for the purposes of this calculation.
Furthermore the class should implement Comparable and override equals and toString. Equals should be consistent with the result of compareTo(). The comparison should be first according to altitude, then latitude, then longitude.
Use the JFrame from Exercise 3 if you completed it OR create a new JFrame with JComponent if you did not.
Add a mouse listener to your graphical user interface (GUI). A left click should:
Add the coordinates of your map + true elevation to a List OR if you did not complete Exercise 3+4 add a random double with the current screen coordinates to the list