// BIBLIOTECA UNFOLDING MAPS
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.mapdisplay.shaders.*;
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.*;

UnfoldingMap map;
String[] dots;

//
void setup() {
size(800, 600, P2D);
//  map = new UnfoldingMap(this, new OpenStreetMap.OpenStreetMapProvider());
//  map = new UnfoldingMap(this, new OpenStreetMap.OSMGrayProvider());
//  map = new UnfoldingMap(this, new StamenMapProvider.WaterColor()); //WATERCOLOR
map = new UnfoldingMap(this, new StamenMapProvider.TonerLite());
//  map = new UnfoldingMap(this, new StamenMapProvider.Toner());
//  map = new UnfoldingMap(this, new StamenMapProvider.TonerBackground());

//Load CSV file
dots = loadStrings(“bus_stops.csv”);

//Set initial location of the map
Location zlVortice = new Location(-23.506, -46.504);
map.zoomAndPanTo(new Location(zlVortice), 12);
MapUtils.createDefaultEventDispatcher(this, map);

//Draw the polygon
drawVortice();

//Process CSV data
processData();
}

void draw() {
map.draw();
//Display coordinates on mouse position
Location here = map.getLocation(mouseX, mouseY);
fill(0);
text(here.getLat() + “, ” + here.getLon(), mouseX, mouseY);
}

void drawVortice() {
Location Vortice1 =  new Location (-23.594751, -46.444786);
Location Vortice2 =  new Location (-23.598448, -46.467102);
Location Vortice3 =  new Location (-23.575089, -46.502636);
Location Vortice4 =  new Location (-23.55007, -46.524605);
Location Vortice5 =  new Location (-23.535902, -46.545883);
Location Vortice6 = new Location (-23.5239, -46.5589);
Location Vortice7 = new Location (-23.4959, -46.5594);
Location Vortice8 = new Location (-23.472622, -46.518417);
Location Vortice9 = new Location (-23.4546, -46.4700);

SimplePolygonMarker vorticeMarker = new SimplePolygonMarker();
vorticeMarker.addLocations
(new Location(Vortice1),
new Location(Vortice2),
new Location(Vortice3),
new Location(Vortice4),
new Location(Vortice5),
new Location(Vortice6),
new Location(Vortice7),
new Location(Vortice8),
new Location(Vortice9));

vorticeMarker.setColor(color(55, 55, 55, 60));
vorticeMarker.setStrokeColor(color(150, 150, 150, 50));
map.addMarkers(vorticeMarker);

// CANTEIRO 1 = AVENIDA ARICANDUVA
Location CT1Location = new Location(-23.58, -46.49);
SimplePointMarker CT1Marker = new SimplePointMarker(CT1Location);
map.addMarkers(CT1Marker);
CT1Marker.setColor(color(255, 0, 0, 0));
CT1Marker.setStrokeColor(color(150, 0, 0));
CT1Marker.setStrokeWeight(4);

// CANTEIRO 2 = AVENIDA JARDIM PANTANAL
Location CT2Location = new Location(-23.49, -46.47);
SimplePointMarker CT2Marker = new SimplePointMarker(CT2Location);
map.addMarkers(CT2Marker);
CT2Marker.setColor(color(255, 0, 0, 0));
CT2Marker.setStrokeColor(color(150, 0, 0));
CT2Marker.setStrokeWeight(4);

// CANTEIRO 3 = AVENIDA USP LESTE
Location CT3Location = new Location(-23.4856, -46.5030);
SimplePointMarker CT3Marker = new SimplePointMarker(CT3Location);
map.addMarkers(CT3Marker);
CT3Marker.setColor(color(255, 0, 0, 0));
CT3Marker.setStrokeColor(color(150, 0, 0));
CT3Marker.setStrokeWeight(4);
}

void processData() {
for (int i=1; i<dots.length; i++) {
String[] thisRow = split(dots[i], “,”);
Location thisLocation = new Location(float(thisRow[0]), float(thisRow[1]));
SimplePointMarker here = new SimplePointMarker(thisLocation);
color c = color(0, 0, 255, 15);
here.setColor(c);
here.setStrokeWeight(0);
map.addMarkers(here);
}
}

Anúncios