netmap |
Subversion Repositories: |
Rev 21 | Rev 44 | |
---|---|---|
Line 93... | Line 93... | |
if ( (substr($ap_name, 0, 1) == "!") || (substr($ap_name, 0, 1) == "%") ) { |
if ( (substr($ap_name, 0, 1) == "!") || (substr($ap_name, 0, 1) == "%") ) { | |
$ap_lat_show = 0; |
$ap_lat_show = 0; | |
$ap_name_show = substr($ap_name, 1, (strlen($ap_name)-1)); // not needed if ! (already done in previous step) |
$ap_name_show = substr($ap_name, 1, (strlen($ap_name)-1)); // not needed if ! (already done in previous step) | |
} |
} | |
|
| |
$ap_xsize = 70; |
$ap_xsize = 40; | |
$ap_ysize = 35; |
$ap_ysize = 20; | |
if ($ap_showip == 0) { $ap_ysize=17; } |
$ap_rowh = $ap_ysize/2; | |
$ap_name_size = ImageFontWidth(3)*strlen($ap_name_show); |
$ap_name_font = 1; | |
$ap_ip_size = ImageFontWidth(2)*strlen($ap_ip); |
$ap_lat_font = 1; | |
$ap_lat_size = ImageFontWidth(2)*strlen(round($ap_lat_show))+6; |
$ap_ip_font = 1; | |
| ||
if ($ap_showip == 0) { $ap_ysize=$ap_ysize/2; } | ||
$ap_name_size = ImageFontWidth($ap_name_font)*strlen($ap_name_show); | ||
$ap_ip_size = ImageFontWidth($ap_ip_font)*strlen($ap_ip); | ||
$ap_lat_size = ImageFontWidth($ap_lat_font)*strlen(round($ap_lat_show))+3; | ||
if ($ap_lat_show == 0) { $ap_lat_size = 1; } |
if ($ap_lat_show == 0) { $ap_lat_size = 1; } | |
|
| |
if (($ap_name_size + $ap_lat_size + 10) > ($ap_xsize)) { |
if (($ap_name_size + $ap_lat_size + 4) > ($ap_xsize)) { | |
$ap_xsize = $ap_name_size + $ap_lat_size+10; |
$ap_xsize = $ap_name_size + $ap_lat_size + 4; | |
/* |
/* | |
if (($ap_ip_size + 10) > $ap_xsize) { |
if (($ap_ip_size + 10) > $ap_xsize) { | |
$ap_xsize = $ap_ip_size + 10; |
$ap_xsize = $ap_ip_size + 10; | |
} |
} | |
*/ |
*/ | |
} | ||
| ||
if (($ap_ip_size + 5) > ($ap_xsize)) { | ||
$ap_xsize = $ap_ip_size + 5; | ||
} |
} | |
|
| |
switch ($ap_state) { |
switch ($ap_state) { | |
case 0 : $ap_color = ImageColorExact($im, 255, 0, 0); $ap_color2=ImageColorExact($im, 255, 140, 140); break; |
case 0 : $ap_color = ImageColorExact($im, 255, 0, 0); $ap_color2=ImageColorExact($im, 255, 140, 140); break; | |
case 1 : $ap_color = ImageColorExact($im, 0, 255, 0); $ap_color2=ImageColorExact($im, 140, 255, 140); break; |
case 1 : $ap_color = ImageColorExact($im, 0, 255, 0); $ap_color2=ImageColorExact($im, 140, 255, 140); break; | |
case 2 : $ap_color = ImageColorExact($im, 180, 180, 180); $ap_color2=ImageColorExact($im, 220, 220, 220); break; |
case 2 : $ap_color = ImageColorExact($im, 180, 180, 180); $ap_color2=ImageColorExact($im, 220, 220, 220); break; | |
} |
} | |
|
| |
ImageRectangle($im, ($x1-($ap_xsize/2)), ($y1-($ap_ysize/2)), ($x1+($ap_xsize/2)), ($y1+($ap_ysize/2)), ImageColorExact($im, 0, 0, 0)); |
ImageRectangle($im, ($x1-($ap_xsize/2)), ($y1-($ap_ysize/2)), ($x1+($ap_xsize/2)), ($y1+($ap_ysize/2)), ImageColorExact($im, 0, 0, 0)); | |
ImageFilledRectangle($im, ($x1-($ap_xsize/2-1)), ($y1-($ap_ysize/2-1)), ($x1+($ap_xsize/2-$ap_lat_size)), ($y1-($ap_ysize/2-16)), $ap_color); |
ImageFilledRectangle($im, ($x1-($ap_xsize/2-1)), ($y1-($ap_ysize/2-1)), ($x1+($ap_xsize/2-$ap_lat_size)), ($y1-($ap_ysize/2-$ap_rowh)), $ap_color); | |
if ($ap_showip == 1) { |
if ($ap_showip == 1) { | |
ImageLine($im, ($x1-($ap_xsize/2-1)), ($y1-($ap_ysize/2-17)), ($x1+($ap_xsize/2-1)), ($y1-($ap_ysize/2-17)), ImageColorExact($im, 140, 140, 140)); |
ImageLine($im, ($x1-($ap_xsize/2-1)), ($y1-($ap_ysize/2-1-$ap_rowh)), ($x1+($ap_xsize/2-1)), ($y1-($ap_ysize/2-1-$ap_rowh)), ImageColorExact($im, 140, 140, 140)); | |
} |
} | |
|
| |
if ($ap_lat_show !=0 ) { |
if ($ap_lat_show !=0 ) { | |
if ($ap_lat_show < 15) { |
if ($ap_lat_show < 15) { | |
ImageFilledRectangle($im, ($x1+($ap_xsize/2-$ap_lat_size+2)), ($y1-($ap_ysize/2-1)), ($x1+($ap_xsize/2-1)), ($y1-($ap_ysize/2-16)), $ap_color2); |
ImageFilledRectangle($im, ($x1+($ap_xsize/2-$ap_lat_size+2)), ($y1-($ap_ysize/2-1)), ($x1+($ap_xsize/2-1)), ($y1-($ap_ysize/2-$ap_rowh)), $ap_color2); | |
} else { |
} else { | |
ImageFilledRectangle($im, ($x1+($ap_xsize/2-$ap_lat_size+2)), ($y1-($ap_ysize/2-1)), ($x1+($ap_xsize/2-1)), ($y1-($ap_ysize/2-16)), ImageColorExact($im, 255, 140, 140)); |
ImageFilledRectangle($im, ($x1+($ap_xsize/2-$ap_lat_size+2)), ($y1-($ap_ysize/2-1)), ($x1+($ap_xsize/2-1)), ($y1-($ap_ysize/2-$ap_rowh)), ImageColorExact($im, 255, 140, 140)); | |
} |
} | |
ImageLine($im, ($x1+($ap_xsize/2-$ap_lat_size+1)), ($y1-($ap_ysize/2-1)), ($x1+($ap_xsize/2-$ap_lat_size+1)), ($y1-($ap_ysize/2-16)),ImageColorExact($im, 140, 140, 140)); |
ImageLine($im, ($x1+($ap_xsize/2-$ap_lat_size+1)), ($y1-($ap_ysize/2-1)), ($x1+($ap_xsize/2-$ap_lat_size+1)), ($y1-($ap_ysize/2-$ap_rowh)),ImageColorExact($im, 140, 140, 140)); | |
ImageString($im, 2, ($x1+($ap_xsize/2)-$ap_lat_size+4), $y1-($ap_ysize/2-2), round($ap_lat_show), ImageColorExact($im, 0, 0, 0)); |
ImageString($im, $ap_lat_font, ($x1+($ap_xsize/2)-$ap_lat_size+3), $y1-($ap_ysize/2-1), round($ap_lat_show), ImageColorExact($im, 0, 0, 0)); | |
} |
} | |
|
| |
ImageFilledRectangle($im, ($x1-($ap_xsize/2-1)), ($y1-($ap_ysize/2-18)), ($x1+($ap_xsize/2-1)), ($y1+($ap_ysize/2-1)), ImageColorExact($im, 220, 220, 220)); |
if ($ap_showip == 1) { | |
ImageFilledRectangle($im, ($x1-($ap_xsize/2-1)), ($y1-($ap_ysize/2-2-$ap_rowh)), ($x1+($ap_xsize/2-1)), ($y1+($ap_ysize/2-1)), ImageColorExact($im, 220, 220, 220)); | ||
} | ||
|
| |
for ($i=1; $i<=$ap_type; $i++) { |
for ($i=1; $i<=$ap_type; $i++) { | |
ImageRectangle($im, ($x1-($ap_xsize/2)-$i), ($y1-($ap_ysize/2)-$i), ($x1+($ap_xsize/2)+$i), ($y1+($ap_ysize/2)+$i), ImageColorExact($im, 0, 0, 0)); |
ImageRectangle($im, ($x1-($ap_xsize/2)-$i), ($y1-($ap_ysize/2)-$i), ($x1+($ap_xsize/2)+$i), ($y1+($ap_ysize/2)+$i), ImageColorExact($im, 0, 0, 0)); | |
} |
} | |
|
| |
ImageString($im, 3, ($x1-($ap_name_size/2)-($ap_lat_size/2)+2), $y1-($ap_ysize/2-2), $ap_name_show, ImageColorExact($im, 0, 0, 0)); |
ImageString($im, $ap_name_font, ($x1-($ap_name_size/2)-($ap_lat_size/2)+2), $y1-($ap_ysize/2-2), $ap_name_show, ImageColorExact($im, 0, 0, 0)); | |
if ($ap_showip == 1) { |
if ($ap_showip == 1) { | |
ImageString($im, 2, ($x1-strlen($ap_ip)*3), ($y1+1), $ap_ip, ImageColorExact($im, 0, 0, 0)); |
ImageString($im, $ap_ip_font, ($x1-$ap_ip_size/2), ($y1+2), $ap_ip, ImageColorExact($im, 0, 0, 0)); | |
} |
} | |
|
| |
} |
} | |
|
| |
function placeLN($im, $x1, $y1, $x2, $y2, $lnd) { |
function placeLN($im, $x1, $y1, $x2, $y2, $lnd) { |