resizable network picture + greater on click

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@900 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 839db8869c
commit 6a72f06c40

@ -167,7 +167,7 @@ YaCy Cluster Indexing Speed: #[gppm]# Pages Per Minute (Accumulated PPM over Act
</tr> </tr>
</table> </table>
</p> </p>
<p><img src="NetworkPicture.png"></p> <p><a href="NetworkPicture.png?width=800&height=600"><img src="NetworkPicture.png"></a></p>
<p> <p>
#(comment)# #(comment)#
:: ::

@ -60,12 +60,19 @@ import de.anomic.yacy.yacySeed;
public class NetworkPicture { 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) { 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); ImagePainter img = new ImagePainter(width, height, ImagePainter.TRANSPARENT);
img.setMode(ImagePainter.MODE_ADD); img.setMode(ImagePainter.MODE_ADD);
@ -132,7 +139,7 @@ public class NetworkPicture {
// draw description // draw description
img.setColor("FFFFFF"); 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(2, 16, "DRAWING OF " + totalCount + " SELECTED PEERS", true);
img.print(width - 2, 8, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), false); 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) { 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); 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); //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); int dotsize = 6 + 2 * (int) (seed.getLinkCount() / 500000L);
if (dotsize > 18) dotsize = 18; if (dotsize > 18) dotsize = 18;
img.setColor(colorDot); img.setColor(colorDot);

@ -133,6 +133,26 @@ public final class serverObjects extends Hashtable implements Cloneable {
return (String) this.get((Object) key, (Object) dflt); 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 // returns a set of all values where their key mappes the keyMapper
public String[] getAll(String keyMapper) { public String[] getAll(String keyMapper) {
// the keyMapper may contain regular expressions as defined in String.matches // the keyMapper may contain regular expressions as defined in String.matches

@ -93,7 +93,7 @@ public class ImagePainter {
0x000288A,0x0002884,0x0003C9E,0x0622086,0x0421084,0x0C2088C,0x0045440,0x1F8C63F 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 HashSet crds = new HashSet();
private static ArrayList crc; private static ArrayList crc;
private static int[][][] circles = new int[radiusPrecalc][][]; private static int[][][] circles = new int[radiusPrecalc][][];

Loading…
Cancel
Save