From 579b22d8ff85613e24429bd02c431263255d29ce Mon Sep 17 00:00:00 2001 From: orbiter Date: Sun, 9 Oct 2005 23:11:17 +0000 Subject: [PATCH] small update to network drawing git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@892 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/NetworkPicture.java | 8 +++++++- htroot/imagetest.java | 8 ++++---- source/de/anomic/plasma/plasmaCrawlStacker.java | 2 +- source/de/anomic/tools/ImagePainter.java | 9 +++++---- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/htroot/NetworkPicture.java b/htroot/NetworkPicture.java index d02a25b57..8d15742af 100644 --- a/htroot/NetworkPicture.java +++ b/htroot/NetworkPicture.java @@ -88,6 +88,7 @@ public class NetworkPicture { // 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(); @@ -96,6 +97,7 @@ public class NetworkPicture { count++; } } + totalCount += count; // draw disconnected senior and principals that have been seen lately count = 0; @@ -109,6 +111,7 @@ public class NetworkPicture { count++; } } + totalCount += count; // draw juniors that have been seen lately count = 0; @@ -122,13 +125,16 @@ public class NetworkPicture { 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); } diff --git a/htroot/imagetest.java b/htroot/imagetest.java index 1792376f6..f1065250d 100644 --- a/htroot/imagetest.java +++ b/htroot/imagetest.java @@ -100,8 +100,8 @@ public class imagetest { 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); @@ -114,9 +114,9 @@ public class imagetest { 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); diff --git a/source/de/anomic/plasma/plasmaCrawlStacker.java b/source/de/anomic/plasma/plasmaCrawlStacker.java index 8f4cbfe9d..0c863e375 100644 --- a/source/de/anomic/plasma/plasmaCrawlStacker.java +++ b/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 diff --git a/source/de/anomic/tools/ImagePainter.java b/source/de/anomic/tools/ImagePainter.java index b6e1d68bc..c202d979f 100644 --- a/source/de/anomic/tools/ImagePainter.java +++ b/source/de/anomic/tools/ImagePainter.java @@ -307,10 +307,11 @@ public class ImagePainter { } - 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; } } @@ -326,7 +327,7 @@ public class ImagePainter { 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) {