]> dxcluster.net Git - spider.git/commitdiff
added sh/qra
authordjk <djk>
Sun, 6 Dec 1998 14:59:37 +0000 (14:59 +0000)
committerdjk <djk>
Sun, 6 Dec 1998 14:59:37 +0000 (14:59 +0000)
cmd/show/qra.pl [new file with mode: 0644]

diff --git a/cmd/show/qra.pl b/cmd/show/qra.pl
new file mode 100644 (file)
index 0000000..8e91cf5
--- /dev/null
@@ -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);