Giter Site home page Giter Site logo

earthquake-data's Introduction

Earthquake-Data

  • Name and Surname: Asel Esra Ozyilmaz
  • Email: [email protected]
  • Computer Science Department of Alatoo International University.
  • Individual final project for CS-102 Java class.

A GUI created by using Processing and Unfolding Maps library functions in Eclipse IDE to display and print out the earthquakes which have occured all over the world.

This is a project that I have created with the help of the Object Oriented Programming in Java course offered by UC San Diego through Coursera. The project was half created and the other half was asked to implement throughout the course. However, in the course the project has further features but to not make it more complex I haven't added all of them.

Processing and Unfolding map libraries;

Processing library: an open-source graphical library and integrated development environment (IDE) built for the electronic arts, new media art, and visual design communities with the purpose of teaching non-programmers the fundamentals of computer programming in a visual context. Processing uses the Java language, with additional simplifications such as additional classes and aliased mathematical functions and operations. It also provides a graphical user interface for simplifying the compilation and execution stage.

Unfolding maps library: Enables you to quickly create interactive maps. Simply create geo-positioned markers to display data on a map. The library supports loading and displaying user-defined shapes, such as points, lines, or polygons.

Description Of The Project

Displayed And Printed Results;

Map can be zoomed as shown below. The image next to it is the printed results appearing on the console.

Detailed Explanation Of The Code;

The project has an interactive map which displays where the earthquakes have occured with the help of markers. Optionally you can work online or offline with it. If you work online GoogleMapProvider() will display a map otherwise, an offline map is displayed.

The data of earthquakes are taken from this live RSS feed https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_week.atom and parsed by the course in order to read the data inside it. In addition, there are two more files: cityFile and countryFile. countryFile includes features of the countries such as: name, location, type. Also, if an earthquake occurs in a particular country it is added as a marker to the map. cityFile on the other hand, includes cities and their properties.

A RuntimeException is checked while reading and adding the cityFile to the map as shown below;

Code of exception handling;

//read in city data and check if an runtime exception occurs
try {
   List<Feature> cities = GeoJSONReader.loadData(this, cityFile);
   cityMarkers = new ArrayList<Marker>();
   for(Feature city : cities) {
	cityMarkers.add(new CityMarker(city));
}}
catch (RuntimeException e) {
    System.out.println("Exception occured in Runtime");
}

UML Class/Data Diagrams

As shown above, the project contains 5 classes: EarthquakeCityMap, CityMarker, EarthqukeMarker, LandQuakeMarker and OceanQuakeMarker. Let's further investigate them;

Five Classes

EarthquakeCityMarker Class;

  • It is the main class which extends PApplet in order to create a GUI. This class includes some methods and helper methods. addKey() is a helper method which draws key in GUI and isInCountry() is another helper method which is used to test whether a given earthquake is in a given country or not. It also adds the country property to the properties of the earthquake feature if it's in one of the countries. Moreover, there is a method called printQuakes() which prints out countries with number of earthquakes.

CityMarker Class;

  • This class extends SimplePointMarker to mark the cities on the map. SimplePointMarker is a class of UnfoldingMaps library which represents marker on a single location.

EarthquakeMarker Class;

  • An abstract class which implements a visual marker for earthquakes on an earthquake map. It has two subclasses: LandQuakeMarker and OceanQuakeMarker. EarthquakeMarker class allows these two classes to implement abstract method drawEarthquake() differently. Moreover, class includes method colorDetermine() which allows the derived classes to determine color of marker from depth of the earthquake.

LandQuakeMarker and OceanQuakeMarker Classes;

  • The main difference between these two child classes is that they both implement markers on different places. LandQuakeMarker implements quakes markers on the land; however, OceanQuakeMarker implements them on the ocean.

earthquake-data's People

Contributors

aselesra avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.