package dude; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(%states %states_ %abbrs @formats $docroot $date $author $hostname $site $pwd $cwd $wd $title $title_ $state $state_ $font $fontt $sample @letters makeBanner setTitle %quads %names readpl slurpList doCommand zoom_to); @EXPORT_OK = qw(); BEGIN { %states = ( "AL", "Alabama", "AK", "Alaska", "WA", "Washington", "WV", "West_Virginia", "WI", "Wisconsin", "WY", "Wyoming" ); $category{"Topographic.7.5'.1:20,000"} = 'r'; $category{"Topographic.7.5'.1:24,000"} = 'o'; $category{"Topographic -- Provisional.7.5'.1:24,000"} = 'o'; $category{"Topographic and Bathymetric.7.5'.1:24,000"} = 'o'; $category{"Topographic and Bathymetric.7.5'x15'.1:24,000"} = 'o'; $category{"Mineral Management Status.7.5'.1:24,000"} = 'm'; $category{"Orthophotomap.7.5'.1:24,000"} = 'p'; $category{"Topographic.7.5'.1:25,000"} = 'l'; $category{"Topographic.7.5'.1:30,000"} = 'j'; $category{"Topographic.7.5'x15'.1:24,000"} = 'k'; $category{"Topographic.7.5'x15'.1:25,000"} = 'k'; $category{"Topographic.Alaska.1:63,360"} = 'i'; $category{"Planimetric.30'x60'.1:100,000"} = 'g'; $category{"Topographic.30'x60'.1:100,000"} = 'f'; $category{"Topographic.1x2degree.1:250,000"} = 'c'; $series{"r"} = "Topographic 7.5' 1:20,000"; $series{"o"} = "Topographic 7.5' 1:24,000"; $series{"p"} = "Orthophotomap 7.5' 1:24,000"; $series{"l"} = "Topographic 7.5' 1:25,000"; $series{"j"} = "Topographic 7.5' 1:30,000"; $series{"k"} = "Topographic 7.5'x15' 1:25,000"; $series{"i"} = "Topographic Alaska 1:63,360"; $series{"g"} = "Planimetric 30'x60' 1:100,000"; $series{"f"} = "Topographic 30'x60' 1:100,000"; $series{"c"} = "Topographic 1x2degree 1:250,000"; ($::prog) = reverse split ("/", $0); chomp ($pwd =`pwd`); @pwdparts = split ("/", $pwd); # state and title and var cwd are set here to the tail of `pwd` $state_ = $state = $title = $title_ = $cwd = $pwdparts[$#pwdparts]; $state_ = $state = $pwdparts[$#pwdparts - 1] if ($state eq "Places"); $title =~ s/_/\ /g; $state_ =~ s/_/\ /g; # for this var the underscore paradigm is backwards # why do we need three shifts here instead of two? shift @pwdparts; shift @pwdparts; shift @pwdparts; $wd = join ("/", @pwdparts); $title = join (" ", @pwdparts); chomp ($date = `date`); chomp ($author= `id | awk '{print \$1}' |sed -e 's/^....//' |tr -dc "a-z"`); chomp ($hostname = `hostname`); $www = "http://www.topolabs.com"; $site = $server = "http://$hostname"; @letters = ('a' .. 'h'); $abbrs{$states{$_}} = $_ foreach (keys %states); $font= "-b&h-lucida sans-medium-r-normal-sans-8-0-100-72-p-140-iso8859-1"; $fontt="-b&h-lucida sans-medium-r-normal-sans-10-0-100-72-p-140-iso8859-1"; $ifont ="-b&h-lucida sans-medium-i-normal-sans-10-0-100-72-p-140-iso8859-1"; $font ="-b&h-lucida-medium-r-normal-sans-10-100-75-75-p-58-iso8859-1"; # some fonts for use on webpages $degree_font = "helvB12.bdf"; $status_font = "helvB08.bdf"; $quadname_font = "helvR10.bdf"; $placenamesURL = "http://mapping.usgs.gov/www/gnis/gnisftp.html"; $listURL = 'http://mac.usgs.gov/mac/maplists/mlp001.cgi?scale=C&initial=A&state=STATE&listtype=f'; $sample200 = "/California/37122/o37122g4.200.png"; $sample250 = "/Wyoming/44110/o44110a1.250.png"; } sub new { my $type = shift; my $self = {}; $self->{hilong} = $self->{hilat} = 0; $self->{lowlong} = $self->{lowlat} = 999; $self->{projection} = "UTM"; $self->{datum} = "NAD27"; $self->{minDPI} = 25; $self->{maxDPI} = 250; $self->{origDPI} = 250; $self->{defaultDPI} = 25; $self->{filetypes} = ["tif", "tfw"]; $self->{indexW} = 60; $self->{indexH} = 72; $self->{sorts} = ["name", "index"]; $self->{formats} = ["png"]; $self->{defaultFormat} = "png"; $self->{flavor} = "coverage"; $self->{map} = "/map"; $self->{tile} = "/tile"; $self->{category}=("o"); #$self->{scales}=("24", "100", "250", "500"); #$scale="24"; #$self->{letters24} = ('a' .. 'h'); #$self->{letters100} = ('a', 'e'); #$self->{prefix}{"24"} = "o"; #$self->{prefix}{"100"} = "f"; #$self->{prefix}{"250"} = "c"; #$self->{high}{"24"} = "7"; #$self->{high}{"100"} = "1"; return bless $self, $type; } sub setTitle { $title = shift; makeBanner($title) unless defined $::noImages; $title_ = $title; $title_ =~ s/\ /_/g; } sub deval { $command = shift; print "$command\n" if ((defined $::verbose) or (defined $::noexec)); eval $command unless (defined $::noexec); } sub doCommand { $command = shift; print "$command\n" if (defined $::verbose or defined $::debug or defined $::noexec); system($command) unless ((defined $::noexec) and ($::noexec ne "")); my $sta = $?; my $actual = $sta % 255 ; my $sig = $sta & 255 ; print "doCommand: status=$sta, actual=$actual, signal=$sig\n" if $::debug; } # slurpList replaces readpl which was developed to work on the file # cdsort.pl which was derived from cdsort.htm which was a teale thing sub slurpList { ($self, $all) = @_; open(INPUT, "<$state.list") or die "can't get $state.list"; $self->{total} = 0; print "all \n" if ((defined $all) and ("$all" eq "all")); # at the second instance of the word Scale we cease extracting 24k maps $lastletter = ""; while () { if (/Scale/) { $theScale = $_; $theScale =~ s/<.*><.*><.>//; # remove part up to scale ($scale, $theWordScale) = split (" ",$theScale); # I don't understand "1:24,000/1:25,000" so just chop it after the / $scale =~ s/\/.*$//; print "$scale...\n" unless defined $::quiet; } next unless (defined $scale); next unless (($scale =~ /24.000/) or ($scale =~ /25.000/)); next if (! /^