-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathairspace_check.pl
More file actions
executable file
·82 lines (67 loc) · 1.41 KB
/
Copy pathairspace_check.pl
File metadata and controls
executable file
·82 lines (67 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/perl
#
# Check to see if a track violates airspace
#
# Needs to be quick/pruned somehow?
# Only check if 'nearby' / every 30 seconds?
#
# Geoff Wong 2008
#
require DBD::mysql;
use Airspace qw(:all);
use Data::Dumper;
use strict;
#
# Verify an entire task ...
#
if ($#ARGV < 0)
{
print "airspace_check <tasPk> [<traPk>]\n";
exit 1;
}
my $traPk;
my $tasPk = 0 + $ARGV[0];
if ($#ARGV == 1)
{
$traPk = 0 + $ARGV[1];
}
my $tracks;
my $airspace;
my $dist;
my $name;
my $space;
$Airspace::dbh = db_connect();
if ($traPk > 0)
{
$tracks = get_one_track($Airspace::dbh, $traPk);
}
else
{
$tracks = get_all_tracks($Airspace::dbh, $tasPk);
}
#$tracks = [ 13010 ];
#$airspace = find_nearby_airspace($regPk, 100000.0);
$airspace = find_task_airspace($Airspace::dbh, $tasPk);
print "Airspaces checked:\n";
foreach $space (@$airspace)
{
print " ", cln($space->{'name'}), " with base=", cln($space->{'base'}), "\n";
}
#print Dumper($airspace);
# Go through all the tracks ..
# might be more useful to print the names :-)
for my $track (keys %$tracks)
{
$dist = 0;
$name = $tracks->{$track}->{'pilFirstName'} . " " . $tracks->{$track}->{'pilLastName'};
print "\n$name ($track): ";
if (($dist = airspace_check($Airspace::dbh, $track,$airspace)) > 0)
{
print "\n Maximum violation of $dist metres ($name).";
}
else
{
print "No violation.";
}
}
print "\n";