X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fheading.pl;h=353a0477761628582b30f03153e3f07480198115;hb=refs%2Fheads%2Fnewusers;hp=9273243504e0a7b6c73b782f68addfae4546c004;hpb=bdfc958f3d0fa912d20a020ac1a6cd2c79a22729;p=spider.git diff --git a/cmd/show/heading.pl b/cmd/show/heading.pl index 92732435..353a0477 100644 --- a/cmd/show/heading.pl +++ b/cmd/show/heading.pl @@ -1,25 +1,35 @@ # -# show the dxcc number for each callsign or prefix entered +# show the heading and distance for each callsign or prefix entered # -# $Id$ # - +# +# AK1A-compatible output Iain Philipps, G0RDI 16-Dec-1998 +# my ($self, $line) = @_; -my @list = split /\s+/, $line; # generate a list of callsigns +my @list = split /\s+/, $line; # generate a list of callsigns my $l; my @out; +my $lat = $self->user->lat; +my $long = $self->user->long; +if (!$long && !$lat) { + push @out, $self->msg('heade1'); + $lat = $main::mylatitude; + $long = $main::mylongitude; +} -print "line: $line\n"; foreach $l (@list) { - my @ans = Prefix::extract($l); - print "ans:", @ans, "\n"; - next if !@ans; - my $pre = shift @ans; - my $a; - foreach $a (@ans) { - push @out, sprintf "%s DXCC: %3d ITU: %3d CQ: %3d (%s, %s)", uc $l, $a->dxcc(), $a->itu(), $a->cq(), $pre, $a->name(); - } + # prefixes ---> + my @ans = Prefix::extract($l); + next if !@ans; + my $pre = shift @ans; + my $a; + foreach $a (@ans) { + my ($b, $dx) = DXBearing::bdist($lat, $long, $a->{lat}, $a->{long}); + my ($r, $rdx) = DXBearing::bdist($a->{lat}, $a->{long}, $lat, $long); + push @out, sprintf "%-2s %s: %.0f degs - dist: %.0f mi, %.0f km Reciprocal heading: %.0f degs", $pre, $a->name(), $b, $dx * 0.62133785, $dx, $r; + $l = ""; + } } return (1, @out);