From e853e515f070fdf091235fdd7428c760d2b5bb86 Mon Sep 17 00:00:00 2001 From: djk Date: Sun, 6 Dec 1998 14:59:37 +0000 Subject: [PATCH] added sh/qra --- cmd/show/qra.pl | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cmd/show/qra.pl diff --git a/cmd/show/qra.pl b/cmd/show/qra.pl new file mode 100644 index 00000000..8e91cf5f --- /dev/null +++ b/cmd/show/qra.pl @@ -0,0 +1,33 @@ +# +# show the distance and bearing each QRA locator +# +# $Id$ +# + +my ($self, $line) = @_; +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::mylat; + $long = $main::mylong; +} + +foreach $l (@list) { + # locators ---> + if (DXBearing::is_qra($l) || $l =~ /^[A-Za-z][A-Za-z]\d\d$/) { + my $qra = uc $l; + $qra .= 'MM' if $l =~ /^[A-Za-z][A-Za-z]\d\d$/; + + my ($qlat, $qlong) = DXBearing::qratoll($qra); + my ($b, $dx) = DXBearing::bdist($lat, $long, $qlat, $qlong); + my ($r, $rdx) = DXBearing::bdist($qlat, $qlong, $lat, $long); + push @out, sprintf "%-9s Bearing: %.0f Recip: %.0f %.0fKm %.0fMi", $qra, $b, $r, $dx, $dx * 0.62133785; + } +} + +return (1, @out); -- 2.43.0