Skip to content

Commit

Permalink
small update to network drawing
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@892 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Oct 9, 2005
1 parent 2b5829c commit 579b22d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
8 changes: 7 additions & 1 deletion htroot/NetworkPicture.java
Expand Up @@ -88,6 +88,7 @@ public static BufferedImage respond(httpHeader header, serverObjects post, serve

// draw connected senior and principals
int count = 0;
int totalCount = 0;
Enumeration e = yacyCore.seedDB.seedsConnected(true, false, null);
while (e.hasMoreElements() && count < maxCount) {
seed = (yacySeed) e.nextElement();
Expand All @@ -96,6 +97,7 @@ public static BufferedImage respond(httpHeader header, serverObjects post, serve
count++;
}
}
totalCount += count;

// draw disconnected senior and principals that have been seen lately
count = 0;
Expand All @@ -109,6 +111,7 @@ public static BufferedImage respond(httpHeader header, serverObjects post, serve
count++;
}
}
totalCount += count;

// draw juniors that have been seen lately
count = 0;
Expand All @@ -122,13 +125,16 @@ public static BufferedImage respond(httpHeader header, serverObjects post, serve
count++;
}
}
totalCount += count;

// draw my own peer
drawPeer(img, width / 2, height / 2, radius, yacyCore.seedDB.mySeed, "800000", "FFFFFF");

// draw description
img.setColor("FFFFFF");
img.print(2, 8, "YACY NETWORK PICTURE / SNAPSHOT FROM " + new Date().toString().toUpperCase());
img.print(2, 8, "YACY NETWORK PICTURE", true);
img.print(2, 16, "DRAWING OF " + totalCount + " SELECTED PEERS", true);
img.print(width - 2, 8, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), false);

return img.toImage(true);
}
Expand Down
8 changes: 4 additions & 4 deletions htroot/imagetest.java
Expand Up @@ -100,8 +100,8 @@ public static BufferedImage respond(httpHeader header, serverObjects post, serve

img.setMode(ImagePainter.MODE_ADD);
img.setColor(ImagePainter.ADDITIVE_BLACK);
for (int y = 0; y < 600; y = y + 50) img.print(0, 6 + y, "" + y);
for (int x = 0; x < 800; x = x + 50) img.print(x, 6 , "" + x);
for (int y = 0; y < 600; y = y + 50) img.print(0, 6 + y, "" + y, true);
for (int x = 0; x < 800; x = x + 50) img.print(x, 6 , "" + x, true);
img.setColor(ImagePainter.ADDITIVE_RED);
img.dot(550, 110, 90, true);
img.setColor(ImagePainter.ADDITIVE_GREEN);
Expand All @@ -114,9 +114,9 @@ public static BufferedImage respond(httpHeader header, serverObjects post, serve
img.arc(220, 110, 50, 90, 30, 110);
img.arc(210, 120, 50, 90, 30, 110);
img.setColor(ImagePainter.ADDITIVE_BLACK);
img.print(50, 110, "BROADCAST MESSAGE #772: NODE %882 BLACK abcefghijklmnopqrstuvwxyz");
img.print(50, 110, "BROADCAST MESSAGE #772: NODE %882 BLACK abcefghijklmnopqrstuvwxyz", true);
img.setColor(ImagePainter.ADDITIVE_GREEN);
img.print(50, 120, "BROADCAST MESSAGE #772: NODE %882 GREEN abcefghijklmnopqrstuvwxyz");
img.print(50, 120, "BROADCAST MESSAGE #772: NODE %882 GREEN abcefghijklmnopqrstuvwxyz", true);
for (long i = 0; i < 256; i++) {
img.setColor(i);
img.dot(10 + 14 * (int) (i / 16), 200 + 14 * (int) (i % 16), 6, true);
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/plasma/plasmaCrawlStacker.java
@@ -1,4 +1,4 @@
// plasmaSwitchboard.java
// plasmaCrawlStacker.java
// -----------------------
// part of YaCy
// (C) by Michael Peter Christen; mc@anomic.de
Expand Down
9 changes: 5 additions & 4 deletions source/de/anomic/tools/ImagePainter.java
Expand Up @@ -307,10 +307,11 @@ public void arc(int x, int y, int innerRadius, int outerRadius, int fromArc, int

}

public void print(int x, int y, String message) {
public void print(int x, int y, String message, boolean alignRight) {
int xx = (alignRight) ? x : x - 6 * message.length();
for (int i = 0; i < message.length(); i++) {
print(x, y, message.charAt(i));
x += 6;
print(xx, y, message.charAt(i));
xx += 6;
}
}

Expand All @@ -326,7 +327,7 @@ public void arcPrint(int cx, int cy, int radius, int angle, String message) {
int xp = x - 3 * message.length();
if ((angle > (90 + arcDist)) && (angle < (270 - arcDist))) xp = x - 6 * message.length();
if ((angle < (90 - arcDist)) || (angle > (270 + arcDist))) xp = x;
print(xp, yp, message);
print(xp, yp, message, true);
}

public void arcLine(int cx, int cy, int innerRadius, int outerRadius, int angle) {
Expand Down

0 comments on commit 579b22d

Please sign in to comment.