Diff for /register/prgsrc/updatemap.pl between versions 1.1 and 1.2

version 1.1, 2001/10/13 21:48:05 version 1.2, 2001/10/13 23:39:44
Line 30  $Date$ Line 30  $Date$
 $Revision$  $Revision$
   
 =cut  =cut
   
       use strict;
   use DBI;
   my $dbh;
   $dbh = DBI->connect("DBI:mysql:chgk", "piataev", "") or 
       die ($dbh->errstr);
   my $width=640;
   my $height=320;
   my $offset=160;
   #######################################################
   # Opening the files
   #######################################################
   open (INCLUDE, ">regions.html");
   open (GNU, ">regions.gnu");
   open (DAT, ">regions.dat");
   
   print GNU <<END;
    set term png medium color
    set ou "regions.png"
    set noborder
    set nokey
    set size ratio 0.5 1, 1
    set tmargin 0
    set bmargin 0
    set lmargin 0
    set rmargin 0
    set noyzeroaxis
    set noxtics
    set noytics
    set xrange [-180:180]
    set yrange [-90:90]
   END
   print INCLUDE <<END;
    <map name="regions">
   END
   
   ##########################################################
   # Writing clubs coordinates
   ##########################################################
   
   my $sth = $dbh->prepare ("
   SELECT rid,Name,Lon,Lat from Regions 
   where NOT ISNULL(Lat) and NOT ISNULL(Lon)");
   $sth->execute;
   while (my ($rid,$Name,$Lon,$Lat) = $sth->fetchrow_array) {
       print DAT <<END;
    $Lon, $Lat
   END
       my $x=int($width*($Lon+180)/360);
       my $y=int($height*(90-$Lat)/180);
       print INCLUDE <<END;
    <area shape="circle" coords="$x, $y, 3" 
    href="/znatoki/cgi-bin/register.cgi?rid=$rid&clubs=1&level=10000" 
    alt="$Name">
   END
   }
   
   ##########################################################
   # Finishing up
   ##########################################################
   print INCLUDE <<END;
    </map>
    <img usemap="#regions" src="../images/regions.gif"
    alt="Карта клубов" width=$width height=$height>
   END
   print GNU <<END;
    plot 'world.dat'  with lines 3 4, 'regions.dat' with points 1
   END
   close GNU;
   close INCLUDE;
   close DAT;
   `gnuplot regions.gnu`;
   my $dim=$width.'x'.$height.'+0+'.$offset;
   `convert -crop $dim regions.png gif:regions.tmp`;
   `giftrans -t '#ffffff' regions.tmp> regions.gif`;
   exit 0;

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>