I'm trying to adapt the code from Ben Fry's zipdecode to handle place names. I can't figure out an error I'm getting now: "Duplicate method draw() in type DataSetTester" I'm using Processing 2.0b8. I've checked and checked and only see one method draw() in the DataSetTester host application.
Any help is very appreciated!
Francis
Here's DataSetTester (and after that the class Place):
// Test of MN21010towns.tsv data
// Modified from Ben Fry, Visualizing Data, Chapter 6, code
// column numbers in the data file
static final int NAME = 0;
static final int Y = 1;
static final int X = 2;
int totalCount; // total number of places
Place[] places;
int placeCount; // number of places loaded
// min/max boundary of all points
float minX, maxX;
float minY, maxY;
// Border of where the map should be drawn on the screen
float mapX1, mapY1;
float mapX2, mapY2;
public void setup() {
size(720, 453, P3D);
mapX1 = 30;
mapX2 = width - mapX1;
mapY1 = 20;
mapY2 = height - mapY1;
readData();
}
void readData() {
String[] lines = loadStrings("MN2010Towns.tsv");
parseInfo(lines[0]); // read the header line
places = new Place[totalCount];
for (int i = 1; i < lines.length; i++) {
places[placeCount] = parsePlace(lines[i]);
placeCount++;
}
}
void parseInfo(String line) {
String infoString = line.substring(2); //remove the #
String[] infoPieces = split(infoString, ',');
totalCount = int(infoPieces[0]);
minX = float(infoPieces[1]);
maxX = float(infoPieces[2]);
minY = float(infoPieces[3]);
maxY = float(infoPieces[4]);
}
Place parsePlace(String line) {
String pieces[] = split(line, TAB);
String name = pieces[NAME];
float y = float(pieces[Y]);
float x = float(pieces[X]);
// println(name+x+y); use for debugging reading of input file