Permalink
Browse files

a pass at cleaning up some errors.

  • Loading branch information...
1 parent 28b0d6d commit 8fe6b6f40fb5104ff1c0a715692636de97d53882 @willscott committed Mar 12, 2012
Showing with 17 additions and 10 deletions.
  1. +2 −0 build.xml
  2. +15 −10 src/com/p2pbr/netviz/NetViz.java
View
@@ -15,6 +15,8 @@
<pathelement location="lib/core.jar" />
<pathelement location="lib/carnivore.jar" />
<pathelement location="lib/rsglib.jar" />
+ <pathelement location="lib/SQLibrary.jar" />
+ <pathelement location="lib/sqlitejdbc-v053-pure.jar" />
</path>
@@ -58,6 +58,8 @@
int lastBG[] = new int[3];
private class Pin {
+ PApplet parent;
+
public int state;
public int animation;
@@ -86,7 +88,8 @@
private int deadTimer = 1;
private boolean pulseUp = true;
- public Pin(PImage mapImage, float lat, float lon, String country, String city) {
+ public Pin(PApplet p, PImage mapImage, float lat, float lon, String country, String city) {
+ this.parent = p;
this.mapImage = mapImage;
this.x = map(lon, -180, 180, mapX, mapX+mapImage.width);
this.y = map(lat, 90, -90, mapY, mapY+mapImage.height);
@@ -98,13 +101,15 @@ public Pin(PImage mapImage, float lat, float lon, String country, String city) {
this.state = STATE_ANIMATE;
this.animation = 1;
}
+
private int pulseStep() {
if (pulseUp) { pulse++; }
else { pulse--; }
if (pulse >= PULSE_MAX) { pulseUp = false; }
if (pulse <= PULSE_MAX * -1) { pulseUp = true; }
return pulse;
}
+
public boolean drawSelf() {
int rad = 8;
if (bytes > 0) {
@@ -118,7 +123,7 @@ public boolean drawSelf() {
if (state == STATE_STATIC) {
//println("static, rad="+rad);
if (bytes > 0) {
- int variation = int(random(3));
+ int variation = (int)(parent.random(3));
//println("bytes >0");
fill(0x00, 0x00, 0x00, 0x00);
stroke(0xff, 0x00, 0xff);
@@ -193,10 +198,10 @@ void setup() {
// setup pins for local, loopback, autoconfig, broadcast.
//public Pin(PImage mapImage, float lat, float lon, String country, String city) {
- localPin = new Pin(mapImage, -105, -160, null, null);
- broadcastPin = new Pin(mapImage, -105, -120, null, null);
- loopbackPin = new Pin(mapImage, -105, -80, null, null);
- autoconfigPin = new Pin(mapImage, -105, -40, null, null);
+ localPin = new Pin(this, mapImage, -105, -160, null, null);
+ broadcastPin = new Pin(this, mapImage, -105, -120, null, null);
+ loopbackPin = new Pin(this, mapImage, -105, -80, null, null);
+ autoconfigPin = new Pin(this, mapImage, -105, -40, null, null);
//
size(WIDTH, HEIGHT);
@@ -270,8 +275,8 @@ private void drawPointsForNewPackets() {
// draw new packets
for (int i=0; i<this.newPackets/2; i++) {
stroke(0xFF, 0xFF, 0xFF);
- int x = int(random(WIDTH-1));
- int y = int(random(mapImage.height, HEIGHT-1));
+ int x = (int)(random(WIDTH-1));
+ int y = (int)(random(mapImage.height, HEIGHT-1));
point(x,y);
}
this.newPackets = this.newPackets/2;
@@ -299,7 +304,7 @@ private void drawPointsForNewPackets() {
if (absFraction > 1) {
absFraction = 1;
}
- int r = int(Math.round(255 * absFraction));
+ int r = (int)(Math.round(255 * absFraction));
if (r > 255) {
r = 255;
}
@@ -462,7 +467,7 @@ synchronized void packetEvent(CarnivorePacket packet) {
float lat = latlon[0];
float lon = latlon[1];
- p = new Pin(mapImage, lat, lon, country, city);
+ p = new Pin(this, mapImage, lat, lon, country, city);
pins.put(ip.toString(), p);
output.println(ip.toString());
output.flush();

0 comments on commit 8fe6b6f

Please sign in to comment.