added parameter for network graphic background

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3942 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 18 years ago
parent 19786b73b6
commit c1aad9e508

@ -193,7 +193,7 @@
</div>
<div id="left">
<a href="NetworkPicture.png?width=768&amp;height=576"><img src="NetworkPicture.png" alt="The yacy Network" /></a>
<a href="NetworkPicture.png?width=768&height=576&bgcolor=000000"><img src="NetworkPicture.png?width=768&height=576&bgcolor=000000" alt="The yacy Network" /></a>
</div>
<div id="left">
<table border="0">

@ -59,6 +59,7 @@ public class NetworkPicture {
int passiveLimit = 300;
int potentialLimit = 300;
int maxCount = 1000;
String bgcolor = plasmaGrafics.COL_BACKGROUND;
boolean corona = true;
if (post != null) {
@ -68,6 +69,7 @@ public class NetworkPicture {
potentialLimit = post.getInt("pol", 300);
maxCount = post.getInt("max", 1000);
corona = post.get("corona", "true").equals("true");
bgcolor = post.get("bgcolor", bgcolor);
}
//too small values lead to an error, too big to huge CPU/memory consumption, resulting in possible DOS.
@ -78,7 +80,7 @@ public class NetworkPicture {
if (passiveLimit > 1000000) passiveLimit = 1000000;
if (potentialLimit > 1000000) potentialLimit = 1000000;
if (maxCount > 1000) maxCount = 1000;
return plasmaGrafics.getNetworkPicture(10000, width, height, passiveLimit, potentialLimit, maxCount, corona, env.getConfig("network.unit.name", "unspecified"), env.getConfig("network.unit.description", "unspecified"));
return plasmaGrafics.getNetworkPicture(10000, width, height, passiveLimit, potentialLimit, maxCount, corona, env.getConfig("network.unit.name", "unspecified"), env.getConfig("network.unit.description", "unspecified"), bgcolor);
}
}

@ -64,9 +64,9 @@ public class plasmaGrafics {
private static int shortestName = 10;
private static int longestName = 12;
public static final String COL_BACKGROUND = "080808"; /*"FFFFE0"*/
private static final String COL_DHTCIRCLE = "400030"; /*"008020"*/
private static final long COL_HEADLINE = ymageMatrix.SUBTRACTIVE_BLACK;
private static final String COL_BACKGROUND = "080808"; /*"FFFFE0"*/
private static final String COL_ACTIVE_DOT = "181808";
private static final String COL_ACTIVE_LINE = "604040";
private static final String COL_ACTIVE_TEXT = "b080b0";
@ -127,7 +127,7 @@ public class plasmaGrafics {
if (primarySearches == null) return null; // this was a local search and there are no threads
// get a copy of a recent network picture
ymageMatrix eventPicture = getNetworkPicture(120000, plasmaSwitchboard.getSwitchboard().getConfig("network.unit.name", "unspecified"), plasmaSwitchboard.getSwitchboard().getConfig("network.unit.description", "unspecified"));
ymageMatrix eventPicture = getNetworkPicture(120000, plasmaSwitchboard.getSwitchboard().getConfig("network.unit.name", "unspecified"), plasmaSwitchboard.getSwitchboard().getConfig("network.unit.description", "unspecified"), COL_BACKGROUND);
if (eventPicture instanceof ymageMatrix) eventPicture = (ymageMatrix) eventPicture; //new ymageMatrix((ymageMatrix) eventPicture);
// TODO: fix cloning of ymageMatrix pictures
@ -172,18 +172,18 @@ public class plasmaGrafics {
return eventPicture;
}
public static ymageMatrix getNetworkPicture(long maxAge, String networkName, String networkTitle) {
return getNetworkPicture(maxAge, 640, 480, 300, 300, 1000, true, networkName, networkTitle);
public static ymageMatrix getNetworkPicture(long maxAge, String networkName, String networkTitle, String bgcolor) {
return getNetworkPicture(maxAge, 640, 480, 300, 300, 1000, true, networkName, networkTitle, bgcolor);
}
public static ymageMatrix getNetworkPicture(long maxAge, int width, int height, int passiveLimit, int potentialLimit, int maxCount, boolean corona, String networkName, String networkTitle) {
public static ymageMatrix getNetworkPicture(long maxAge, int width, int height, int passiveLimit, int potentialLimit, int maxCount, boolean corona, String networkName, String networkTitle, String bgcolor) {
if ((networkPicture == null) || ((System.currentTimeMillis() - networkPictureDate) > maxAge)) {
drawNetworkPicture(width, height, passiveLimit, potentialLimit, maxCount, corona, networkName, networkTitle);
drawNetworkPicture(width, height, passiveLimit, potentialLimit, maxCount, corona, networkName, networkTitle, bgcolor);
}
return networkPicture;
}
private static void drawNetworkPicture(int width, int height, int passiveLimit, int potentialLimit, int maxCount, boolean corona, String networkName, String networkTitle) {
private static void drawNetworkPicture(int width, int height, int passiveLimit, int potentialLimit, int maxCount, boolean corona, String networkName, String networkTitle, String bgcolor) {
int innerradius = Math.min(width, height) / 5;
int outerradius = innerradius + innerradius * yacyCore.seedDB.sizeConnected() / 100;
@ -191,7 +191,7 @@ public class plasmaGrafics {
if (yacyCore.seedDB == null) return; // no other peers known
networkPicture = new ymageMatrix(width, height, COL_BACKGROUND);
networkPicture = new ymageMatrix(width, height, bgcolor);
networkPicture.setMode(ymageMatrix.MODE_SUB);
// draw network circle

Loading…
Cancel
Save