#!/usr/bin/perl
# make Fig file from HTML generated by kh2html.pl
# (Google satellite photos)
# Andrew Daviel, April 2005
$html = shift ;
$size = 15 * 256 ; # 15 * pixelwidth
$base = "http://kh.google.com" ;
$pdepth = 40 ;
print<) {
chomp ;
# if (/src="(.*&t=)([\w]+)"/) {
while (/src="([^"]+&t=)(\w+)"/g) {
$opt = $1 ; $file = $2 ;
$url = "$base$opt$file" ;
if (/title="([\w\s\.]+)"/) {
$title = $1 ; print "# $title\n" ;
}
# print "get $url\n" ;
$jpg = "$file.jpg" ;
unless (-r $jpg) {
system ("wget -O $jpg \"$url\"") ;
}
$x1 = $nc * $size ; $x2 = $x1 + $size ;
$y1 = $nr * $size ; $y2 = $y1 + $size ;
print "2 5 0 1 0 -1 $pdepth -1 -1 0.000 0 0 -1 0 0 5\n" ;
print "\t0 $jpg\n" ;
print "\t$x1 $y1 $x2 $y1 $x2 $y2 $x1 $y2 $x1 $y1\n" ;
$nc++ ;
}
if (/
/i) { $nr++ ; $nc = 0 ;}
}