Commit 233f928e authored by Chad Barb's avatar Chad Barb
Browse files

Got new visualization integrated...
Put .png files for icons in www/ (both src and build trees)
..those should probably be somewhere else eventually (at least in a subdir of www),
but they're happy there for now.
parent 20623633
......@@ -1219,7 +1219,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config \
utils/sshtb utils/create_image utils/node_admin utils/webcreateimage \
www/GNUmakefile www/defs.php3 www/dbdefs.php3 \
vis/GNUmakefile vis/vistopology vis/webvistopology vis/top2gif vis/top2png \
vis/GNUmakefile vis/vistopology vis/webvistopology vis/top2gif vis/top2png vis/render \
rc.d/GNUmakefile rc.d/2.mysql-server.sh rc.d/3.testbed.sh \
rc.d/cvsupd.sh \
$eventfiles \
......
......@@ -291,7 +291,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config \
utils/sshtb utils/create_image utils/node_admin utils/webcreateimage \
www/GNUmakefile www/defs.php3 www/dbdefs.php3 \
vis/GNUmakefile vis/vistopology vis/webvistopology vis/top2gif vis/top2png \
vis/GNUmakefile vis/vistopology vis/webvistopology vis/top2gif vis/top2png vis/render \
rc.d/GNUmakefile rc.d/2.mysql-server.sh rc.d/3.testbed.sh \
rc.d/cvsupd.sh \
$eventfiles \
......
......@@ -9,10 +9,11 @@
use GD;
# "ideal" width and height
$idealw = 500;
$idealh = 500;
#
# Configure variables
#
my $TB = "@prefix@";
my $ICONDIR = "$TB/www";
%props = ();
%nodes = ();
......@@ -66,6 +67,12 @@ foreach $i (keys %nodes) {
}
}
# "ideal" width and height
$idealw = 500;
$idealh = 500;
$maxX = 1000;
$minX = 0;
$maxY = 1000;
......@@ -139,6 +146,14 @@ $ybig = $maxY - $minY;
$xscale = 1.0;
$yscale = 1.0;
# recompute new ideal.. minimum size.
$nodecount = (keys %nodepos);
$idealarea = 4200 * $nodecount;
$idealw = sqrt( $idealarea );
if ($idealw > 500) { $idealw = 500; }
$idealh = $idealw;
# if it is too small, scale everything up so it takes the
# "ideal" amount of space
......@@ -169,8 +184,8 @@ foreach $i (keys %nodepos) {
$im = new GD::Image($xbig + 40, $ybig + 50);
$nodeicon = GD::Image->newFromPng("nodeicon.png") || warn "nodeicon.png not found";
$lanicon = GD::Image->newFromPng("lanicon.png") || warn "lanicon.png not found";
$nodeicon = GD::Image->newFromPng("$ICONDIR/nodeicon.png") || warn "nodeicon.png not found";
$lanicon = GD::Image->newFromPng("$ICONDIR/lanicon.png") || warn "lanicon.png not found";
%colors = ();
......@@ -186,7 +201,7 @@ $colors{"gray50"} = $im->colorAllocate(127,127,127);
$colors{"gray25"} = $im->colorAllocate(63,63,63);
# set clear background
$bgcolor = $colors{"white"}; # $im->colorAllocate(254, 254, 254);
$bgcolor = $im->colorAllocate(254, 254, 254);
$im->transparent($bgcolor);
#$im->interlaced('true');
......@@ -249,13 +264,13 @@ foreach $i (keys %nodes) {
$xpos = $x - (((length($i) - 0.5) * $fontw) / 2);
$im->string(gdSmallFont, $xpos + 1, $y + 20,
$i, $colors{"white"});
$i, $bgcolor);
$im->string(gdSmallFont, $xpos - 1, $y + 20,
$i, $colors{"white"});
$i, $bgcolor);
$im->string(gdSmallFont, $xpos, $y + 19,
$i, $colors{"white"});
$i, $bgcolor);
$im->string(gdSmallFont, $xpos, $y + 21,
$i, $colors{"white"});
$i, $bgcolor);
$im->string(gdSmallFont, $xpos, $y + 20,
$i, $colors{"black"});
}
......
......@@ -20,9 +20,10 @@ include $(TESTBED_SRCDIR)/GNUmakerules
# Generate a list of all the files we want to install from the current
# directory and the source directory.
#
FILES = $(wildcard *.css *.jpg *.gif *.html *.php3)
FILES = $(wildcard *.css *.jpg *.gif *.png *.html *.php3)
FILES += $(wildcard $(SRCDIR)/*.css)
FILES += $(wildcard $(SRCDIR)/*.jpg)
FILES += $(wildcard $(SRCDIR)/*.png)
FILES += $(wildcard $(SRCDIR)/*.gif)
FILES += $(wildcard $(SRCDIR)/*.html)
FILES += $(wildcard $(SRCDIR)/*.php3)
......
......@@ -56,7 +56,7 @@ if (ISADMIN($uid)) {
# Spit out the image with a content header.
#
if ($fp = popen("$TBSUEXEC_PATH $uid $gid webvistopology $pid $eid", "r")) {
header("Content-type: image/gif");
header("Content-type: image/png");
fpassthru($fp);
}
......
......@@ -48,7 +48,7 @@ if (! TBExptAccessCheck($uid, $exp_pid, $exp_eid, $TB_EXPT_READINFO)) {
#
echo "<br>
<center>
<img src='top2gif.php3?pid=$exp_pid&eid=$exp_eid' align=center>
<img src='top2image.php3?pid=$exp_pid&eid=$exp_eid' align=center>
</center>\n";
#
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment