From ac460e8b7968a8df4361634b1b79fd0b873d2afc Mon Sep 17 00:00:00 2001 From: "Leigh B. Stoller" <stoller@flux.utah.edu> Date: Tue, 22 Mar 2005 19:47:50 +0000 Subject: [PATCH] Draw the actual obstacles from the obstacles table, including the label. --- vis/floormap.in | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/vis/floormap.in b/vis/floormap.in index 48859b3fd7..a21241461a 100755 --- a/vis/floormap.in +++ b/vis/floormap.in @@ -617,6 +617,8 @@ sub dofloor($$) my $y1 = $obrow{"y1"}; my $y2 = $obrow{"y2"}; my $descr = $obrow{"description"}; + my $label = $obrow{"label"}; + my $drawit = $obrow{"draw"}; my $props = {}; $props->{"X1"} = $x1; @@ -627,6 +629,40 @@ sub dofloor($$) $props->{"ISOBS"} = 1; $areamap->{"$id"} = $props; + if ($drawit) { + $err = $baseimage->Draw(primitive=>'rectangle', + points=>"$x1,$y1 $x2,$y2", + stroke=>'Black', + strokewidth=>'2'); + warn "$err" if "$err"; + } + + if (defined($label) && $label ne "" && ($drawit || $show_exclusion)) { + my $pointsize = 12; + my $strlen = length($label); + my $pointlen = (($pointsize * 0.45) * $strlen); + + # + # Initially, lets try to put the label right in the middle. + # + my $dlx = $x1 + (($x2-$x1)/2) - ($pointlen / 2); + my $dly = $y1 + (($y2-$y1)/2); + + # + # If the label looks too big along the X axis, then + # move it below the box. Yep, very simplistic ... + # + if ($dlx <= $x1 || ($dlx + $pointlen) >= $x2) { + $dly = $y2 + $pointsize; + } + + $err = $baseimage->Annotate(fill=>'black', + x=>$dlx, y=>$dly, + pointsize=>$pointsize, + text=>"$label"); + warn "$err" if "$err"; + } + if ($show_exclusion) { my $obstacle_buffer = 23; # XXX my $xmin = $x1 - $obstacle_buffer; -- GitLab