/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Utilities/ReleaseScripts/ignominy/map2html
32 строки
808 B
Giulio Eulisse
Snapshot of CMSSW_6_2_0_pre8.
26 июн 2013, 18:12
26 июн 2013, 18:12
214ab73
Код
Авторство
О чём код?
#!/usr/bin/env perl use warnings; use strict; my $usage = "$0 NAME SCALE Y-CROP X-CROP FILE"; die "$usage\n" if @ARGV != 5; my ($name, $scale, $ycrop, $xcrop, $file) = @ARGV; # $scale *= .75; open(IN, "< $file") || die "$file: cannot read\n"; print "<MAP NAME='$name'>\n"; while (<IN>) { chomp; s/^#.*//; s/base referer//; next if /^\s*$/; if (/^(rect)\s+(\S+)\s+(\d+),(\d+)\s+(\d+),(\d+)\s*$/) { my @bbox = ($3, $4, $5, $6); $bbox[0] = int($3 * $scale - $xcrop); $bbox[1] = int($6 * $scale - $ycrop); $bbox[2] = int($5 * $scale - $xcrop + .5); $bbox[3] = int($4 * $scale - $ycrop + .5); print "<AREA HREF='$2' SHAPE='$1' COORDS='" . join(",", @bbox) . "'>\n"; } else { print STDERR "$file:$.: unrecognised line `$_'\n"; } } print "</MAP>\n"; close(IN);