Author: Jogy
Date: 2007-01-05 13:35:42 +0000 (Fri, 05 Jan 2007)
New Revision: 11571

Modified:
   trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
Log:
* Make the peer circles really centered :/

Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2007-01-05 13:23:46 UTC (rev 11570)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2007-01-05 13:35:42 UTC (rev 11571)
@@ -551,6 +551,7 @@

        private final static int PEER_CIRCLE_RADIUS = 100;
        private final static int PEER_CIRCLE_INNER_RADIUS = 60;
+       private final static int PEER_CIRCLE_ADDITIONAL_FREE_SPACE = 10;
        private final static long MAX_CIRCLE_AGE_THRESHOLD = 24l*60*60*1000;   
// 24 hours
        private final static int HISTOGRAM_LENGTH = 10;
        private final DecimalFormat fix1p2 = new DecimalFormat("0.00");
@@ -558,7 +559,7 @@
        private final DecimalFormat fix3pctUS = new DecimalFormat("##0%", new 
DecimalFormatSymbols(Locale.US));

        private void addNodeCircle (HTMLNode htmlNode) {
-               HTMLNode nodeCircleInfoboxContentDiv = htmlNode.addChild("div", 
new String[] { "style", "class" }, new String[] {"position: relative; height: " 
+ (PEER_CIRCLE_RADIUS * 2 + 10) + "px; width: " + (PEER_CIRCLE_RADIUS * 2 + 10) 
+ "px", "peercircle" });
+               HTMLNode nodeCircleInfoboxContentDiv = htmlNode.addChild("div", 
new String[] { "style", "class" }, new String[] {"position: relative; height: " 
+ ((PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) * 2) + "px; width: 
" + ((PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) * 2) + "px", 
"peercircle" });
                nodeCircleInfoboxContentDiv.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0, false, 
1.0),     "mark" }, "|");
                nodeCircleInfoboxContentDiv.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0.125, false, 
1.0), "mark" }, "+");
                nodeCircleInfoboxContentDiv.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0.25, false, 
1.0),  "mark" }, "--");
@@ -568,7 +569,7 @@
                nodeCircleInfoboxContentDiv.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0.75, false, 
1.0),  "mark" }, "--");
                nodeCircleInfoboxContentDiv.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0.875, false, 
1.0), "mark" }, "+");
                nodeCircleInfoboxContentDiv.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0.875, false, 
1.0), "mark" }, "+");
-               nodeCircleInfoboxContentDiv.addChild("span", new String[] { 
"style", "class" }, new String[] { "position: absolute; top: " + 
PEER_CIRCLE_RADIUS + "px; left: " + PEER_CIRCLE_RADIUS + "px", "mark" }, "+");
+               nodeCircleInfoboxContentDiv.addChild("span", new String[] { 
"style", "class" }, new String[] { "position: absolute; top: " + 
(PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) + "px; left: " + 
(PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) + "px", "mark" }, "+");
                HashMap knownLocsCopy = node.getKnownLocations(-1);
                Double location = new Double(0.0);
                Long locationTime = new Long(0);
@@ -602,7 +603,7 @@
                HTMLNode peerCircleTableCell = 
peerCircleTableRow.addChild("td", new String[] { "class", "colspan" }, new 
String[] {"first", "10"});
                HTMLNode peerHistogramLegendCell;
                HTMLNode peerHistogramGraphCell;
-               HTMLNode peerCircleInfoboxContent = 
peerCircleTableCell.addChild("div", new String[] { "style", "class" }, new 
String[] {"position: relative; height: " + (PEER_CIRCLE_RADIUS * 2 + 10) + "px; 
width: " + (PEER_CIRCLE_RADIUS * 2 + 10) + "px", "peercircle" });
+               HTMLNode peerCircleInfoboxContent = 
peerCircleTableCell.addChild("div", new String[] { "style", "class" }, new 
String[] {"position: relative; height: " + ((PEER_CIRCLE_RADIUS + 
PEER_CIRCLE_ADDITIONAL_FREE_SPACE) * 2) + "px; width: " + ((PEER_CIRCLE_RADIUS 
+ PEER_CIRCLE_ADDITIONAL_FREE_SPACE) * 2) + "px", "peercircle" });
                peerCircleInfoboxContent.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0, false, 
1.0),     "mark" }, "|");
                peerCircleInfoboxContent.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0.125, false, 
1.0), "mark" }, "+");
                peerCircleInfoboxContent.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0.25, false, 
1.0),  "mark" }, "--");
@@ -610,7 +611,7 @@
                peerCircleInfoboxContent.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0.5, false, 
1.0),   "mark" }, "|");
                peerCircleInfoboxContent.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0.625, false, 
1.0), "mark" }, "+");
                peerCircleInfoboxContent.addChild("span", new String[] { 
"style", "class" }, new String[] { generatePeerCircleStyleString(0.75, false, 
1.0),  "mark" }, "--");
-               peerCircleInfoboxContent.addChild("span", new String[] { 
"style", "class" }, new String[] { "position: absolute; top: " + 
PEER_CIRCLE_RADIUS + "px; left: " + PEER_CIRCLE_RADIUS + "px", "mark" }, "+");
+               peerCircleInfoboxContent.addChild("span", new String[] { 
"style", "class" }, new String[] { "position: absolute; top: " + 
(PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) + "px; left: " + 
(PEER_CIRCLE_RADIUS + PEER_CIRCLE_ADDITIONAL_FREE_SPACE) + "px", "mark" }, "+");
                //
                double myLocation = node.getLocation();
                PeerNodeStatus[] peerNodeStatuses = node.getPeerNodeStatuses();
@@ -657,8 +658,8 @@
                } else {
                        offset = (int) (((double) PEER_CIRCLE_INNER_RADIUS) * 
(1.0 - strength));
                }
-               double x = PEER_CIRCLE_RADIUS + Math.sin(peerLocation) * 
(PEER_CIRCLE_RADIUS - offset);
-               double y = PEER_CIRCLE_RADIUS - Math.cos(peerLocation) * 
(PEER_CIRCLE_RADIUS - offset);
+               double x = PEER_CIRCLE_ADDITIONAL_FREE_SPACE + 
PEER_CIRCLE_RADIUS + Math.sin(peerLocation) * (PEER_CIRCLE_RADIUS - offset);
+               double y = PEER_CIRCLE_RADIUS - Math.cos(peerLocation) * 
(PEER_CIRCLE_RADIUS - offset);  // no PEER_CIRCLE_ADDITIONAL_FREE_SPACE for 
y-disposition
                //
                return "position: absolute; top: " + fix3p1US.format(y) + "px; 
left: " + fix3p1US.format(x) + "px";
        }


Reply via email to