Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

a pass at cleaning up some errors.

  • Loading branch information...
commit 8fe6b6f40fb5104ff1c0a715692636de97d53882 1 parent 28b0d6d
Will authored March 12, 2012
2  build.xml
@@ -15,6 +15,8 @@
15 15
 		<pathelement location="lib/core.jar" />
16 16
 		<pathelement location="lib/carnivore.jar" />
17 17
 		<pathelement location="lib/rsglib.jar" />
  18
+		<pathelement location="lib/SQLibrary.jar" />
  19
+		<pathelement location="lib/sqlitejdbc-v053-pure.jar" />
18 20
 	</path>
19 21
 	
20 22
 
25  src/com/p2pbr/netviz/NetViz.java
@@ -58,6 +58,8 @@
58 58
     int lastBG[]  = new int[3];
59 59
     
60 60
     private class Pin {
  61
+      PApplet parent;
  62
+    
61 63
       public int state;
62 64
       public int animation;
63 65
       
@@ -86,7 +88,8 @@
86 88
       private int deadTimer = 1;
87 89
       private boolean pulseUp = true;
88 90
       
89  
-      public Pin(PImage mapImage, float lat, float lon, String country, String city) {
  91
+      public Pin(PApplet p, PImage mapImage, float lat, float lon, String country, String city) {
  92
+        this.parent = p;
90 93
         this.mapImage = mapImage;
91 94
         this.x = map(lon, -180, 180, mapX, mapX+mapImage.width);
92 95
         this.y = map(lat, 90, -90, mapY, mapY+mapImage.height);
@@ -98,6 +101,7 @@ public Pin(PImage mapImage, float lat, float lon, String country, String city) {
98 101
         this.state = STATE_ANIMATE;
99 102
         this.animation = 1;
100 103
       }
  104
+
101 105
       private int pulseStep() {
102 106
         if (pulseUp) { pulse++; }
103 107
         else         { pulse--; }
@@ -105,6 +109,7 @@ private int pulseStep() {
105 109
         if (pulse <= PULSE_MAX * -1) { pulseUp = true; }
106 110
         return pulse;
107 111
       }
  112
+
108 113
       public boolean drawSelf() {
109 114
         int rad = 8;
110 115
         if (bytes > 0) {
@@ -118,7 +123,7 @@ public boolean drawSelf() {
118 123
         if (state == STATE_STATIC) {
119 124
           //println("static, rad="+rad);
120 125
           if (bytes > 0) {
121  
-            int variation = int(random(3));
  126
+            int variation = (int)(parent.random(3));
122 127
             //println("bytes >0");
123 128
             fill(0x00, 0x00, 0x00, 0x00);
124 129
             stroke(0xff, 0x00, 0xff);
@@ -193,10 +198,10 @@ void setup() {
193 198
       
194 199
       // setup pins for local, loopback, autoconfig, broadcast.
195 200
       //public Pin(PImage mapImage, float lat, float lon, String country, String city) {
196  
-      localPin = new Pin(mapImage, -105, -160, null, null);
197  
-      broadcastPin = new Pin(mapImage, -105, -120, null, null);
198  
-      loopbackPin = new Pin(mapImage, -105, -80, null, null);
199  
-      autoconfigPin = new Pin(mapImage, -105, -40, null, null);
  201
+      localPin = new Pin(this, mapImage, -105, -160, null, null);
  202
+      broadcastPin = new Pin(this, mapImage, -105, -120, null, null);
  203
+      loopbackPin = new Pin(this, mapImage, -105, -80, null, null);
  204
+      autoconfigPin = new Pin(this, mapImage, -105, -40, null, null);
200 205
     
201 206
       // 
202 207
       size(WIDTH, HEIGHT);
@@ -270,8 +275,8 @@ private void drawPointsForNewPackets() {
270 275
       // draw new packets
271 276
       for (int i=0; i<this.newPackets/2; i++) {
272 277
         stroke(0xFF, 0xFF, 0xFF);
273  
-        int x = int(random(WIDTH-1));
274  
-        int y = int(random(mapImage.height, HEIGHT-1));
  278
+        int x = (int)(random(WIDTH-1));
  279
+        int y = (int)(random(mapImage.height, HEIGHT-1));
275 280
         point(x,y);
276 281
       }
277 282
       this.newPackets = this.newPackets/2;
@@ -299,7 +304,7 @@ private void drawPointsForNewPackets() {
299 304
       if (absFraction > 1) {
300 305
         absFraction = 1;   
301 306
       }
302  
-      int r = int(Math.round(255 * absFraction));
  307
+      int r = (int)(Math.round(255 * absFraction));
303 308
       if (r > 255) {
304 309
         r = 255; 
305 310
       }
@@ -462,7 +467,7 @@ synchronized void packetEvent(CarnivorePacket packet) {
462 467
           float lat = latlon[0];
463 468
           float lon = latlon[1];
464 469
     
465  
-          p = new Pin(mapImage, lat, lon, country, city);
  470
+          p = new Pin(this, mapImage, lat, lon, country, city);
466 471
           pins.put(ip.toString(), p);
467 472
           output.println(ip.toString());
468 473
           output.flush();

0 notes on commit 8fe6b6f

Please sign in to comment.
Something went wrong with that request. Please try again.