\n"; $edge["$edgecnt"]="$node:$status"; $conn["$node"]=true; # store connected nodes in hash $edgecnt++; # if connection is to a reflector, # increment count for that reflector. #if ($reflectorlist["$status"]=='Y') { # $reflectorcount["$status"]+=1; #} $status_no_channel=substr($status,0,3); if (isset($refidlist["$status_no_channel"]) and $refidlist["$status_no_channel"]=='Y') { if(isset($reflectorcount["$status"])) { $reflectorcount["$status"]+=1; } else { $reflectorcount["$status"]=1; } } } # draw a larger red dot for reflectors, smaller white # dot for normal nodes. Translate long/lat to pix # positions via call to getlocationcoords() if (preg_match("/^REF.*$/",$call)) { $color=$red; $radius=2; } elseif (preg_match("/^DOWN.*$/",$status)) { $color=$black; $radius=1; } else { $color=$white; $radius=2; } $pt = getlocationcoords($lat, $long, $scale_x, $scale_y); if (($call==$homenode) && ($call != null)) { imagearc($im, $pt["x"], $pt["y"], 10, 10, 0, 360, $blue); } else { imagearc($im, $pt["x"], $pt["y"], $radius, $radius, 0, 360, $color); } if ($radius > 1) { # dot the center in ring color imagearc($im, $pt["x"], $pt["y"], 1, 1, 0, 360, $color); } } #die(); # draw edges on graph foreach ($edge as $var) { list($a,$b) = split(":",$var); if (preg_match("/9[0-9][0-9][1-9]/",$b)) { $b = substr($b,0,3); $b = $b."0"; $type='ref_sub_channel'; } elseif (preg_match("/9[0-9][0-9]0/",$b)) { $type='ref_main_channel'; } else { $type='peer_to_peer'; } # get long/lat stored in hash earlier by key node number if(isset($nodehash["$a"])) {$from=$nodehash["$a"];} else {$from=null;} if(isset($nodehash["$b"])) {$to=$nodehash["$b"]; } else {$to=null;} if (($from != null) and ($to != null)) { list ($long1,$lat1)=split(",",$from); list ($long2,$lat2)=split(",",$to); $pt1 = getlocationcoords($lat1, $long1, $scale_x, $scale_y); $pt2 = getlocationcoords($lat2, $long2, $scale_x, $scale_y); if ($type == 'ref_sub_channel') { imagedashedline($im,$pt1["x"],$pt1["y"],$pt2["x"],$pt2["y"],$aqua); } elseif ($type == 'ref_main_channel') { imageline($im,$pt1["x"],$pt1["y"],$pt2["x"],$pt2["y"],$aqua); } else { imageline($im,$pt1["x"],$pt1["y"],$pt2["x"],$pt2["y"],$green); } } } # add timestamp & node info to image imagestring($im, 2, 10, 1695, "Nodes: $nodecount", $aqua); imagestring($im, 2, 10, 1710, "Edges: $edgecnt", $aqua); imagestring($im, 2, 10, 1725, "$timestamp UTC", $aqua); imagestring($im, 2, 10, 1550, "KEY:", $aqua); imagestring($im, 2, 10, 1560, "aqua = connection to reflector, main channel", $aqua); imagestring($im, 2, 10, 1570, "dashed = connection to refector, sub channel", $aqua); imagestring($im, 2, 10, 1580, "green = node-to-node direct connection", $aqua); # list reflector status $horiz=15; imagestring($im, 2, 2300, $horiz, "Ref#", $aqua); imagestring($im, 2, 2350, $horiz, "cnt.", $aqua); $horiz+=15; imageline($im,2300,$horiz,2380,$horiz,$aqua); $horiz+=15; while($refnum=each($reflectorlist)) { $shownum=substr($refnum[0],0,3); imagestring($im, 2, 2300, $horiz, $shownum, $aqua); $temp1=$refnum[0]; if(isset($reflectorcount["$temp1"])) { imagestring($im, 2, 2350, $horiz, $reflectorcount["$temp1"], $aqua); } $horiz+=15; } $hz=1200; imagestring($im, 2, 30, $hz, "Nodes Missing Long/Latitude", $aqua); $hz+=15; imageline($im,30,$hz,214,$hz,$aqua); $hz+=5; while($refnum=each($unknownlocnodes)) { if (isset($conn["$refnum[0]"]) and ($conn["$refnum[0]"])) { $check="*"; } else { $check = " "; } $msg = "($check) $refnum[0] - $refnum[1]"; imagestring($im, 2, 30, $hz, $msg, $aqua); $hz+=10; } $hz+=5; imageline($im,30,$hz,214,$hz,$aqua); $hz+=5; imagestring($im, 2, 30, $hz, "Connections with these nodes", $aqua); $hz+=10; imagestring($im, 2, 30, $hz, "(denoted by *) cannot be plotted", $aqua); # send image out to browser header ("Content-type: image/png"); imagepng($im); imagedestroy($im); # end of program # functions function getlocationcoords($lat, $lon, $width, $height) { $x = (($lon + 180) * ($width / 360)); $y = ((($lat * -1) + 90) * ($height / 180)); return array("x"=>round($x),"y"=>round($y)); } function checkfile ($dest,$source) { # this function keeps our website from hitting the IRLP node status # site any more than 1 hit per minute. This is to cache and respect # the load on IRLP's status server. # if not exist, or is over 1 min old, write new file. $filename="tmp/irlpnodes.data"; if ((!file_exists($filename)) or (filemtime($filename) < time()-60) ) { $time=time(); # Sorry about eating the bandwidth. $data=file("http://status.irlp.net/nohtmlstatus.txt"); $fhandle=fopen($filename, "w"); foreach ($data as $var) { fwrite($fhandle,"$var"); } $newflag=1; } else { $newflag=0; } return $newflag; } ?>