Skip to content

Commit

Permalink
network picture;
Browse files Browse the repository at this point in the history
back to old version

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2242 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
borg-0300 committed Jun 24, 2006
1 parent 9559153 commit 4c6083b
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions source/de/anomic/plasma/plasmaGrafics.java
Expand Up @@ -62,8 +62,6 @@ public class plasmaGrafics {
private static int shortestName = 10;
private static int longestName = 12;

private static int maxRadius = 28;

private static ymagePainter networkPicture = null;
private static long networkPictureDate = 0;

Expand All @@ -77,7 +75,7 @@ public static ymagePainter getSearchEventPicture() {
if (eventPicture instanceof ymageMatrixPainter) eventPicture = new ymageMatrixPainter((ymageMatrix) eventPicture);

// get dimensions
int cr = Math.min(eventPicture.getWidth(), eventPicture.getHeight()) / 6 - maxRadius;
int cr = Math.min(eventPicture.getWidth(), eventPicture.getHeight()) / 5 - 20;
int cx = eventPicture.getWidth() / 2;
int cy = eventPicture.getHeight() / 2;

Expand All @@ -89,7 +87,7 @@ public static ymagePainter getSearchEventPicture() {
eventPicture.setColor((searches[j].isAlive()) ? ymageMatrix.ADDITIVE_RED : ymageMatrix.ADDITIVE_GREEN);
hash = searches[j].target().hash;
angle = (int) ((long) 360 * (yacySeed.dhtPosition(hash) / (yacySeed.maxDHTDistance / (long) 10000)) / (long) 10000);
eventPicture.arcLine(cx, cy, cr - maxRadius, cr, angle);
eventPicture.arcLine(cx, cy, cr - 20, cr, angle);
}

// draw in the search target
Expand All @@ -100,7 +98,7 @@ public static ymagePainter getSearchEventPicture() {
while (i.hasNext()) {
hash = (String) i.next();
angle = (int) ((long) 360 * (yacySeed.dhtPosition(hash) / (yacySeed.maxDHTDistance / (long) 10000)) / (long) 10000);
eventPicture.arcLine(cx, cy, cr - maxRadius, cr, angle);
eventPicture.arcLine(cx, cy, cr - 20, cr, angle);
}

return eventPicture;
Expand All @@ -119,7 +117,7 @@ public static ymagePainter getNetworkPicture(long maxAge, int width, int height,

private static void drawNetworkPicture(int width, int height, int passiveLimit, int potentialLimit, int maxCount, boolean corona) {

int innerradius = Math.min(width, height) / 6;
int innerradius = Math.min(width, height) / 5;
int outerradius = innerradius + innerradius * yacyCore.seedDB.sizeConnected() / 100;
if (outerradius > innerradius * 2) outerradius = innerradius * 2;

Expand All @@ -130,7 +128,7 @@ private static void drawNetworkPicture(int width, int height, int passiveLimit,

// draw network circle
networkPicture.setColor("008020");
networkPicture.arc(width / 2, height / 2, innerradius - maxRadius, innerradius + maxRadius, 0, 360);
networkPicture.arc(width / 2, height / 2, innerradius - 20, innerradius + 20, 0, 360);

//System.out.println("Seed Maximum distance is " + yacySeed.maxDHTDistance);
//System.out.println("Seed Minimum distance is " + yacySeed.minDHTNumber);
Expand Down Expand Up @@ -180,7 +178,7 @@ private static void drawNetworkPicture(int width, int height, int passiveLimit,
totalCount += count;

// draw my own peer
drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, yacyCore.seedDB.mySeed, "800000", "AAAAAA", "F00000", corona);
drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, yacyCore.seedDB.mySeed, "800000", "AAAAAA", "FFFFFF", corona);

// draw description
networkPicture.setColor("FFFFFF");
Expand All @@ -199,24 +197,20 @@ private static void drawNetworkPicturePeer(ymagePainter img, int x, int y, int i
if (name.length() > longestName) longestName = name.length();
int angle = (int) ((long) 360 * (seed.dhtPosition() / (yacySeed.maxDHTDistance / (long) 10000)) / (long) 10000);
//System.out.println("Seed " + seed.hash + " has distance " + seed.dhtDistance() + ", angle = " + angle);
// int linelength = maxRadius + outerradius * (maxRadius * (name.length() - shortestName) / (longestName - shortestName) + (Math.abs(seed.hash.hashCode()) % maxRadius)) / 60;
// if (linelength > outerradius) linelength = outerradius;
int dotsize = 4 + 2 * (int) (seed.getLinkCount() / 1000000L); // peer dotsize
if (dotsize > (maxRadius - 2)) dotsize = maxRadius - 2;

int linelength = maxRadius + outerradius * (dotsize * (name.length() - shortestName) / (longestName - shortestName) + (Math.abs(seed.hash.hashCode()) % dotsize)) / 60;
int linelength = 20 + outerradius * (20 * (name.length() - shortestName) / (longestName - shortestName) + (Math.abs(seed.hash.hashCode()) % 20)) / 60;
if (linelength > outerradius) linelength = outerradius;

int dotsize = 6 + 2 * (int) (seed.getLinkCount() / 500000L);
if (dotsize > 18) dotsize = 18;
img.setMode(ymageMatrix.MODE_ADD);
// draw dot
img.setColor(colorDot);
img.arcDot(x, y, innerradius, angle, dotsize);
// draw line to text
// img.setColor(colorLine);
img.arcLine(x, y, innerradius + dotsize, innerradius + dotsize + linelength, angle);
img.setColor(colorLine);
img.arcLine(x, y, innerradius + 18, innerradius + linelength, angle);
// draw text
img.setColor(colorText);
img.arcPrint(x, y, innerradius + dotsize + linelength, angle, name);
img.arcPrint(x, y, innerradius + linelength, angle, name);

// draw corona around dot for crawling activity
int ppm10 = seed.getPPM() / 10;
Expand All @@ -237,4 +231,4 @@ private static void drawNetworkPicturePeer(ymagePainter img, int x, int y, int i
}
}

}
}

0 comments on commit 4c6083b

Please sign in to comment.