The beginning of the mapLoad
This commit is contained in:
6
mapLoad/coords.csv
Normal file
6
mapLoad/coords.csv
Normal file
@@ -0,0 +1,6 @@
|
||||
lng,ltd,balls,
|
||||
5,5,help
|
||||
15,25,help
|
||||
25,45,help
|
||||
35,65,help
|
||||
45,85,help
|
||||
|
BIN
mapLoad/map.png
Normal file
BIN
mapLoad/map.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
38
mapLoad/mapLoad.pde
Normal file
38
mapLoad/mapLoad.pde
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Background Image.
|
||||
*
|
||||
* This example presents the fastest way to load a background image
|
||||
* into Processing. To load an image as the background, it must be
|
||||
* the same width and height as the program.
|
||||
*/
|
||||
|
||||
PImage bg;
|
||||
Table coords;
|
||||
int y;
|
||||
int dotWidth;
|
||||
int dotHeight;
|
||||
void setup() {
|
||||
size(1280, 726);
|
||||
dotWidth = 4;
|
||||
dotHeight = 4;
|
||||
// The background image must be the same size as the parameters
|
||||
// into the size() method. In this program, the size of the image
|
||||
// is 640 x 360 pixels.
|
||||
bg = loadImage("map.png");
|
||||
coords = loadTable("coords.csv", "header"); //"header" if the table has header row
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(bg);
|
||||
loadData();
|
||||
}
|
||||
|
||||
void loadData() {
|
||||
|
||||
for (TableRow row : coords.rows()) {
|
||||
float lng = row.getFloat("lng"); //value accessed by column name or index
|
||||
float ltd = row.getFloat("ltd");
|
||||
ellipse(lng, ltd, dotWidth, dotHeight);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user