added another network activity visualization: show strong query activity as radiation around peer

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7006 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 989948e1a9
commit d5c65b17a6

@ -249,10 +249,16 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
</tr>
<tr>
<td style="background-color:#AAAAAA">&nbsp;</td>
<td>waves</td>
<td>grey waves</td>
<td>:</td>
<td>crawling activity</td>
</tr>
<tr>
<td style="background-color:#66FF66">&nbsp;</td>
<td>green radiation</td>
<td>:</td>
<td>strong query activity</td>
</tr>
<tr>
<td style="background-color:#FF6666">&nbsp;</td>
<td>red lines</td>
@ -260,7 +266,7 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
<td>DHT-out</td>
</tr>
<tr>
<td style="background-color:#66FF66">&nbsp;</td>
<td style="background-color:#44FF44">&nbsp;</td>
<td>green lines</td>
<td>:</td>
<td>DHT-in</td>

@ -71,7 +71,7 @@ public class NetworkGraph {
private static final String COL_MYPEER_LINE = "FFAAAA";
private static final String COL_MYPEER_TEXT = "FFCCCC";
private static final String COL_DHTOUT = "440000";
private static final String COL_DHTIN = "004400";
private static final String COL_DHTIN = "008800";
private static final String COL_BORDER = "000000";
private static final String COL_NORMAL_TEXT = "000000";
@ -294,20 +294,35 @@ public class NetworkGraph {
PrintTool.arcPrint(img, centerX, centerY, innerradius + linelength, angle, name);
// draw corona around dot for crawling activity
int ppm20 = seed.getPPM() / 20;
if (coronaangle >= 0 && ppm20 > 0) {
double ca = Math.PI * 2.0 * ((double) coronaangle) / 360.0;
if (ppm20 > 3) ppm20 = 3;
// draw a wave around crawling peers
long strength;
img.setColor("303030");
img.arcArc(centerX, centerY, innerradius, angle, dotsize + 1, dotsize + 1, 0, 360);
final int waveradius = innerradius / 2;
for (int r = 0; r < waveradius; r++) {
strength = (waveradius - r) * (long) (0x08 * ppm20 * (1.0 + Math.sin(ca + Math.PI * 16 * r / waveradius))) / waveradius;
//System.out.println("r = " + r + ", Strength = " + strength);
img.setColor((strength << 16) | (strength << 8) | strength);
img.arcArc(centerX, centerY, innerradius, angle, dotsize + r, dotsize + r, 0, 360);
int ppmx = seed.getPPM() / 30;
if (coronaangle >= 0 && ppmx > 0) {
drawCorona(img, centerX, centerY, innerradius, angle, dotsize, ppmx, coronaangle, true, false, 24, 24, 24); // color = 0..63
}
// draw corona around dot for query activity
int qphx = ((int) (seed.getQPM() * 4.0));
if (coronaangle >= 0 && qphx > 0) {
drawCorona(img, centerX, centerY, innerradius, angle, dotsize, qphx, coronaangle, false, true, 8, 62, 8); // color = 0..63
}
}
private static void drawCorona(final RasterPlotter img, final int centerX, final int centerY, final int innerradius, int angle, int dotsize, int strength, int coronaangle, boolean inside, boolean split, int r, int g, int b) {
double ca = Math.PI * 2.0 * ((double) coronaangle) / 360.0;
if (strength > 4) strength = 4;
// draw a wave around crawling peers
double wave;
final int waveradius = innerradius / 2;
int segments = 72;
for (int radius = 0; radius < waveradius; radius++) {
wave = ((double) (waveradius - radius) * strength) * (1.0 + Math.sin(Math.PI * 16 * radius / waveradius + ((inside) ? ca : -ca))) / 2.0 / (double) waveradius;
img.setColor(((((long) (r * wave)) & 0xff) << 16) | (((long) ((g * wave)) & 0xff) << 8) | ((((long) (b * wave))) & 0xff));
if (split) {
for (int i = 0; i < segments; i++) {
int a = (coronaangle + 360 * i) / segments;
img.arcArc(centerX, centerY, innerradius, angle, dotsize + radius, dotsize + radius, a, a + 180/segments);
}
} else {
img.arcArc(centerX, centerY, innerradius, angle, dotsize + radius, dotsize + radius, 0, 360);
}
}
}

@ -21,6 +21,7 @@
package net.yacy.cora.document;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
@ -113,7 +114,11 @@ public class RSSFeed implements Iterable<Hit> {
}
public RSSMessage next() {
lastGUID = GUIDiterator.next();
try {
lastGUID = GUIDiterator.next();
} catch (ConcurrentModificationException e) {
return null;
}
if (lastGUID == null) return null;
return messages.get(lastGUID);
}

@ -114,9 +114,13 @@ public class CircleTool {
}
}
public static void circle(final RasterPlotter matrix, final int xc, final int yc, final int radius, final int fromArc, final int toArc) {
public static void circle(final RasterPlotter matrix, final int xc, final int yc, final int radius, int fromArc, int toArc) {
// draws only a part of a circle
// arc is given in degree
while (fromArc > 360) fromArc -=360;
while (fromArc < 0 ) fromArc +=360;
while ( toArc > 360) toArc -=360;
while ( toArc < 0 ) toArc +=360;
if (radius == 0) {
matrix.plot(xc, yc, 100);
} else {
@ -141,8 +145,22 @@ public class CircleTool {
c4x[i + 3 * q] = a2 ; // quadrant 4
c4y[i + 3 * q] = a3 ; // quadrant 4
}
for (int i = q * 4 * fromArc / 360; i < q * 4 * toArc / 360; i++) {
if (fromArc == toArc) {
int i = q * 4 * fromArc / 360;
matrix.plot(xc + c4x[i], yc + c4y[i], 100);
} else if (fromArc > toArc) {
// draw two parts
for (int i = q * 4 * fromArc / 360; i < q * 4; i++) {
matrix.plot(xc + c4x[i], yc + c4y[i], 100);
}
for (int i = 0; i < q * 4 * toArc / 360; i++) {
matrix.plot(xc + c4x[i], yc + c4y[i], 100);
}
} else {
// can be drawn in one part
for (int i = q * 4 * fromArc / 360; i < q * 4 * toArc / 360; i++) {
matrix.plot(xc + c4x[i], yc + c4y[i], 100);
}
}
}
}

Loading…
Cancel
Save