public void setup() { // (1) Initializing canvas and map tiles size(900, 700, OPENGL); if (offline) { map = new UnfoldingMap(this, 200, 50, 650, 600, new MBTilesMapProvider(mbTilesString)); earthquakesURL = "2.5_week.atom"; // The same feed, but saved August 7, 2015 } else { map = new UnfoldingMap(this, 200, 50, 650, 600, new Google.GoogleMapProvider()); // IF YOU WANT TO TEST WITH A LOCAL FILE, uncomment the next line // earthquakesURL = "2.5_week.atom"; } MapUtils.createDefaultEventDispatcher(this, map); // (2) Reading in earthquake data and geometric properties // STEP 1: load country features and markers List<Feature> countries = GeoJSONReader.loadData(this, countryFile); countryMarkers = MapUtils.createSimpleMarkers(countries); // STEP 2: read in city data List<Feature> cities = GeoJSONReader.loadData(this, cityFile); cityMarkers = new ArrayList<Marker>(); for (Feature city : cities) { System.out.println( city.getProperty("name") + ", " + city.getProperty("country") + " Pop: " + city.getProperty("population") + "Million"); cityMarkers.add(new CityMarker(city)); } // STEP 3: read in earthquake RSS feed List<PointFeature> earthquakes = ParseFeed.parseEarthquake(this, earthquakesURL); quakeMarkers = new ArrayList<Marker>(); for (PointFeature feature : earthquakes) { // check if LandQuake if (isLand(feature)) { quakeMarkers.add(new LandQuakeMarker(feature)); } // OceanQuakes else { quakeMarkers.add(new OceanQuakeMarker(feature)); } } // could be used for debugging printQuakes(); // (3) Add markers to map // NOTE: Country markers are not added to the map. They are used // for their geometric properties map.addMarkers(quakeMarkers); map.addMarkers(cityMarkers); } // End setup
public CityMarker(Feature city) { super(((PointFeature) city).getLocation(), city.getProperties()); }