line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Location::GeoTool::Plugin::GridLocator; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
5
|
1
|
|
|
1
|
|
3
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
6
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
7
|
|
|
|
|
|
|
$VERSION = 0.02000; |
8
|
1
|
|
|
1
|
|
11
|
use Location::GeoTool; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
9
|
|
9
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
491
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import { |
12
|
0
|
|
|
0
|
|
0
|
__PACKAGE__->setup(); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Thanks for site: |
16
|
|
|
|
|
|
|
# http://www.jarl.or.jp/Japanese/1_Tanoshimo/1-2_Award/gl.htm |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub setup { |
19
|
|
|
|
|
|
|
Location::GeoTool->set_original_code( |
20
|
|
|
|
|
|
|
"gridlocator", |
21
|
|
|
|
|
|
|
[ |
22
|
|
|
|
|
|
|
sub { |
23
|
0
|
|
|
0
|
|
0
|
croak("Cannot create Location::GeoTool object from GridLocator"); |
24
|
|
|
|
|
|
|
}, |
25
|
|
|
|
|
|
|
sub { |
26
|
5
|
|
|
5
|
|
8
|
my $self = shift; |
27
|
5
|
|
|
|
|
33
|
my ($lat,$long) = $self->format_degree->array; |
28
|
5
|
|
|
|
|
26
|
my @res; |
29
|
|
|
|
|
|
|
|
30
|
5
|
|
|
|
|
11
|
$lat = ($lat+90)/10; |
31
|
5
|
|
|
|
|
10
|
$long = ($long+180)/20; |
32
|
|
|
|
|
|
|
|
33
|
5
|
|
|
|
|
21
|
$res[1] = pack "C", 65+int($lat); |
34
|
5
|
|
|
|
|
13
|
$res[0] = pack "C", 65+int($long); |
35
|
|
|
|
|
|
|
|
36
|
5
|
|
|
|
|
11
|
$res[3] = int($lat*10) % 10; |
37
|
5
|
|
|
|
|
8
|
$res[2] = int($long*10) % 10; |
38
|
|
|
|
|
|
|
|
39
|
5
|
|
|
|
|
16
|
$res[5] = pack "C", 65+int(($lat*10 - int($lat*10)) * 24); |
40
|
5
|
|
|
|
|
14
|
$res[4] = pack "C", 65+int(($long*10 - int($long*10)) * 24); |
41
|
|
|
|
|
|
|
|
42
|
5
|
|
|
|
|
35
|
join "",@res; |
43
|
|
|
|
|
|
|
}, |
44
|
1
|
|
|
1
|
0
|
8
|
] |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
__END__ |