Skip to content

Commit

Permalink
changes to web structure page
Browse files Browse the repository at this point in the history
- added catos idea: hosts that have more connections are closer
- design update to page
- added +/- again

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3798 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jun 6, 2007
1 parent 7b904e0 commit 25a54c8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 22 deletions.
41 changes: 26 additions & 15 deletions htroot/WatchWebStructure_p.html
Expand Up @@ -4,40 +4,51 @@
<title>YaCy '#[clientname]#': Web Structure</title>
#%env/templates/metas.template%#
<script type="text/javascript" src="/js/WatchWebStructure.js"></script>
<style type="text/css">
#left {
float: left;
width: 240px;
}
form dt {
width: 60px;
}
form dd {
width: 140px;
text-align:right;
}
</style>
</head>
<body id="WebStructure" style="margin:0px;">
#%env/templates/header.template%#
#%env/templates/submenuCrawler.template%#
<h2>Web Structure</h2>

<div id="left">
<form action="/WatchWebStructure_p.html">
<table>
<tr>
<td valign="top">
<dl>
<dt>host</dt>
<dd>
<input type="text" value="#[host]#" name="host" id="host" />
<input type="text" value="#[host]#" name="host" id="host" size="20" maxlength="80" />
</dd>
<dt>depth</dt>
<dd><input type="text" name="depth" value="#[depth]#" /></dd>
<dd>
<a href="WatchWebStructure_p.html?host=#[host]#&depth=#[depthd]#&width=#[width]#&height=#[height]#"><img src="env/grafics/minus.gif" /></a>
<a href="WatchWebStructure_p.html?host=#[host]#&depth=#[depthi]#&width=#[width]#&height=#[height]#"><img src="env/grafics/plus.gif" /></a>
<input type="text" name="depth" value="#[depth]#" size="1" maxlength="1" />
</dd>
<dt>width</dt>
<dd><input type="text" name="width" value="#[width]#" /></dd>
<dd><input type="text" name="width" value="#[width]#" size="4" maxlength="4" /></dd>
<dt>depth</dt>
<dd><input type="text" name="height" value="#[height]#" /></dd>
<dd><input type="text" name="height" value="#[height]#" size="4" maxlength="4" /></dd>
<dt>
<input type="submit" value="change" />
</dt>
</dl>
</td>
<td>
<img src="WebStructurePicture_p.png?host=#[host]#&depth=#[depth]#&width=#[width]#&height=#[height]#" />
</td>
<td>
</td>
</tr>
</table>
</form>
</div>

<img src="WebStructurePicture_p.png?host=#[host]#&depth=#[depth]#&width=#[width]#&height=#[height]#" />

#%env/templates/footer.template%#
</body>
</html>
17 changes: 10 additions & 7 deletions htroot/WebStructurePicture_p.java
Expand Up @@ -102,23 +102,26 @@ private static final void place(ymageGraph graph, plasmaWebStructure structure,
// first set points to next hosts
Iterator i = next.entrySet().iterator();
ArrayList targets = new ArrayList();
int maxrefs = 8;
int refcount;
double rr;
int maxtargetrefs = 8, maxthisrefs = 8;
int targetrefs, thisrefs;
double rr, re;
while (i.hasNext()) {
entry = (Map.Entry) i.next();
targethash = (String) entry.getKey();
targethost = structure.resolveDomHash2DomString(targethash);
if (targethost == null) continue;
refcount = structure.referencesCount(targethash);
maxrefs = Math.max(refcount, maxrefs);
thisrefs = ((Integer) entry.getValue()).intValue();
targetrefs = structure.referencesCount(targethash); // can be cpu/time-critical
maxtargetrefs = Math.max(targetrefs, maxtargetrefs);
maxthisrefs = Math.max(thisrefs, maxthisrefs);
targets.add(new String[] {targethash, targethost});
if (graph.getPoint(targethost) != null) continue;
// set a new point. It is placed on a circle around the host point
double angle = ((double) kelondroBase64Order.enhancedCoder.cardinal((targethash + "____").getBytes())) / maxlongd * 2 * Math.PI;
//System.out.println("ANGLE = " + angle);
rr = radius / 4 * (1 - refcount / maxrefs);
graph.addPoint(targethost, x + (radius - rr) * Math.cos(angle), y + (radius - rr) * Math.sin(angle), nextlayer);
rr = radius * 0.25 * (1 - targetrefs / maxtargetrefs);
re = radius * 0.5 * (thisrefs / maxthisrefs);
graph.addPoint(targethost, x + (radius - rr - re) * Math.cos(angle), y + (radius - rr - re) * Math.sin(angle), nextlayer);
}
// recursively set next hosts
i = targets.iterator();
Expand Down

0 comments on commit 25a54c8

Please sign in to comment.