From 6a72f06c40ba801c246263cd99f33308a534d3f3 Mon Sep 17 00:00:00 2001 From: orbiter Date: Mon, 10 Oct 2005 10:08:28 +0000 Subject: [PATCH] resizable network picture + greater on click git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@900 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Network.html | 2 +- htroot/NetworkPicture.java | 17 ++++++++++++----- source/de/anomic/server/serverObjects.java | 20 ++++++++++++++++++++ source/de/anomic/tools/ImagePainter.java | 2 +- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/htroot/Network.html b/htroot/Network.html index a85f6faa5..d1ab9c389 100644 --- a/htroot/Network.html +++ b/htroot/Network.html @@ -167,7 +167,7 @@ YaCy Cluster Indexing Speed: #[gppm]# Pages Per Minute (Accumulated PPM over Act

-

+

#(comment)# :: diff --git a/htroot/NetworkPicture.java b/htroot/NetworkPicture.java index 8d15742af..2c4df4f95 100644 --- a/htroot/NetworkPicture.java +++ b/htroot/NetworkPicture.java @@ -60,12 +60,19 @@ import de.anomic.yacy.yacySeed; public class NetworkPicture { - private static final int width = 640; - private static final int height = 420; - private static final int radius = Math.min(width, height) / 5; public static BufferedImage respond(httpHeader header, serverObjects post, serverSwitch env) { + + int width = 640; + int height = 420; + + if (post != null) { + width = post.getInt("width", 640); + height = post.getInt("height", 420); + } + int radius = Math.min(width, height) / 5; + ImagePainter img = new ImagePainter(width, height, ImagePainter.TRANSPARENT); img.setMode(ImagePainter.MODE_ADD); @@ -132,7 +139,7 @@ public class NetworkPicture { // draw description img.setColor("FFFFFF"); - img.print(2, 8, "YACY NETWORK PICTURE", true); + img.print(2, 8, "THE YACY NETWORK", true); img.print(2, 16, "DRAWING OF " + totalCount + " SELECTED PEERS", true); img.print(width - 2, 8, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), false); @@ -142,7 +149,7 @@ public class NetworkPicture { private static void drawPeer(ImagePainter img, int x, int y, int radius, yacySeed seed, String colorDot, String colorText) { int angle = (int) ((long) 360 * (seed.dhtDistance() / (yacySeed.maxDHTDistance / (long) 10000)) / (long) 10000); //System.out.println("Seed " + seed.hash + " has distance " + seed.dhtDistance() + ", angle = " + angle); - int linelength = radius + 60 + (seed.hash.hashCode() % (radius / 2)); + int linelength = radius + 60 + (Math.abs(seed.hash.hashCode()) % (radius / 2)); int dotsize = 6 + 2 * (int) (seed.getLinkCount() / 500000L); if (dotsize > 18) dotsize = 18; img.setColor(colorDot); diff --git a/source/de/anomic/server/serverObjects.java b/source/de/anomic/server/serverObjects.java index 9584ac118..3be0bb555 100644 --- a/source/de/anomic/server/serverObjects.java +++ b/source/de/anomic/server/serverObjects.java @@ -133,6 +133,26 @@ public final class serverObjects extends Hashtable implements Cloneable { return (String) this.get((Object) key, (Object) dflt); } + public int getInt(String key, int dflt) { + String s = (String) super.get(key); + if (s == null) return dflt; + try { + return Integer.parseInt(s); + } catch (NumberFormatException e) { + return dflt; + } + } + + public long getLong(String key, long dflt) { + String s = (String) super.get(key); + if (s == null) return dflt; + try { + return Long.parseLong(s); + } catch (NumberFormatException e) { + return dflt; + } + } + // returns a set of all values where their key mappes the keyMapper public String[] getAll(String keyMapper) { // the keyMapper may contain regular expressions as defined in String.matches diff --git a/source/de/anomic/tools/ImagePainter.java b/source/de/anomic/tools/ImagePainter.java index c202d979f..c22817a50 100644 --- a/source/de/anomic/tools/ImagePainter.java +++ b/source/de/anomic/tools/ImagePainter.java @@ -93,7 +93,7 @@ public class ImagePainter { 0x000288A,0x0002884,0x0003C9E,0x0622086,0x0421084,0x0C2088C,0x0045440,0x1F8C63F }; - private static final int radiusPrecalc = 120; + private static final int radiusPrecalc = 180; private static HashSet crds = new HashSet(); private static ArrayList crc; private static int[][][] circles = new int[radiusPrecalc][][];