diff options
-rwxr-xr-x | tools/make-switch-placements.pl | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/tools/make-switch-placements.pl b/tools/make-switch-placements.pl index 878b00e..efacfcc 100755 --- a/tools/make-switch-placements.pl +++ b/tools/make-switch-placements.pl @@ -5,7 +5,7 @@ use warnings; my $switchtype = "ex2200"; print "begin;\n"; -print "delete from placements where switch in (select switch from switches where switchtype = '$switchtype');\n"; +print "delete from placements where switch in (select switch from switches where switchtype = '$switchtype' and (sysname like 'e%') or sysname like '%creativia%');\n"; my %ip; my $i = 1; @@ -23,45 +23,48 @@ while (<STDIN>) { $name =~ /e(\d+)-(\d+)/; my ($e, $s) = ($1, $2); - $x = int(205 + (($e-1)/2) * 20.2); + $x = int(232 + (($e-1)/2) * 31.1); $y = undef; - $x += 8 if ($e >= 11); - $x += 6 if ($e >= 27); - $x += 12 if ($e >= 43); - $x += 7 if ($e >= 60); + $x += 14 if ($e >= 17); + $x += 14 if ($e >= 29); + $x += 14 if ($e >= 45); + $x += 14 if ($e >= 63); if ($s > 2) { - $y = 328 - 84 * ($s-2); + $y = 405 - 120 * ($s-2); } else { - $y = 519 - 84 * ($s); + $y = 689 - 120 * ($s); } - $xx = $x + 14; - $yy = $y + 84; + $xx = $x + 16; + $yy = $y + 120; # Justeringer $y += 45 if $name eq "e1-4"; $y += 20 if $name eq "e3-4"; $y += 15 if $name eq "e5-4"; + $yy -= 25 if $name eq "e11-1"; #$yy -= 14 if $name eq "e77-1"; #$yy -= 28 if $name eq "e79-1"; - $yy -= 15 if $name eq "e81-1"; + #$yy -= 15 if $name eq "e81-1"; #$yy -= 56 if $name eq "e83-1"; - } elsif ($name =~ /^creative(\d+)-(\d+)$/) { - my ($s, $n) = ($1, $2); - $x = 973 + 52 * $n; - $y = int(138 + 22.2 * $s); - $xx = $x + 52; - $yy = $y + 14; - - if ($s == 2 && $n == 1) { - $xx += 10; - } - if ($s == 3 && $n == 1) { - $xx += 20; + } elsif ($name =~ /^sw(\d+)-creativia$/) { + my ($s) = ($1); + $x = 1535; + $y = int(130 + 32.2 * $s); + $yy = $y + 20; + if ($s == 1) { + $xx = $x + 70; + } elsif ($s == 2) { + $xx = $x + 90; + } elsif ($s == 3) { + $xx = $x + 102; + } else { + $xx = $x + 142; } + } elsif ($name =~ /^crew(\d+)-(\d+)$/) { my ($s, $n) = ($1, $2); $x = 1023 + 45 * $n; @@ -73,7 +76,7 @@ while (<STDIN>) { $xx += 25; } } else { - die "Unknown switch: $name"; + next; } print "insert into placements select switch, box '(($x,$y),($xx,$yy))' from switches where sysname = '$name';\n"; |