Skip to content

Instantly share code, notes, and snippets.

@PDXIII
Created April 15, 2013 11:17
Show Gist options
  • Save PDXIII/5387398 to your computer and use it in GitHub Desktop.
Save PDXIII/5387398 to your computer and use it in GitHub Desktop.
Complete code of the first extended GeoJSONApp for my Unfolding tutorial site.
import de.fhpotsdam.unfolding.mapdisplay.*;
import de.fhpotsdam.unfolding.utils.*;
import de.fhpotsdam.unfolding.marker.*;
import de.fhpotsdam.unfolding.tiles.*;
import de.fhpotsdam.unfolding.interactions.*;
import de.fhpotsdam.unfolding.ui.*;
import de.fhpotsdam.unfolding.*;
import de.fhpotsdam.unfolding.core.*;
import de.fhpotsdam.unfolding.data.*;
import de.fhpotsdam.unfolding.geo.*;
import de.fhpotsdam.unfolding.texture.*;
import de.fhpotsdam.unfolding.events.*;
import de.fhpotsdam.utils.*;
import de.fhpotsdam.unfolding.providers.*;
import processing.opengl.*;
import codeanticode.glgraphics.*;
UnfoldingMap map;
List<Marker> countryMarkers;
void setup() {
size(800, 600, GLConstants.GLGRAPHICS);
smooth();
map = new UnfoldingMap(this);
MapUtils.createDefaultEventDispatcher(this, map);
List<Feature> countries = GeoJSONReader.loadData(this, "countries.geo.json");
countryMarkers = MapUtils.createSimpleMarkers(countries);
}
void draw() {
map.draw();
for (int i = 0; i < countryMarkers.size(); i++){
Marker country = countryMarkers.get(i);
if(country.isInside(map, mouseX, mouseY)){
country.draw(map);
HashMap countryProps = country.getProperties();
String countryName = countryProps.get("name").toString();
println(countryName);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment