line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GIS::Distance::GeoEllipsoid; |
2
|
1
|
|
|
1
|
|
988
|
use 5.008001; |
|
1
|
|
|
|
|
3
|
|
3
|
1
|
|
|
1
|
|
4
|
use strictures 2; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
33
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.13'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
600
|
use parent 'GIS::Distance::Formula'; |
|
1
|
|
|
|
|
263
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
30434
|
use Geo::Ellipsoid; |
|
1
|
|
|
|
|
16027
|
|
|
1
|
|
|
|
|
28
|
|
9
|
1
|
|
|
1
|
|
5
|
use namespace::clean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $ellipsoid_args = { |
12
|
|
|
|
|
|
|
ellipsoid => 'WGS84', |
13
|
|
|
|
|
|
|
units => 'degrees' , |
14
|
|
|
|
|
|
|
distance_units => 'kilometer', |
15
|
|
|
|
|
|
|
longitude => 0, |
16
|
|
|
|
|
|
|
bearing => 0, |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
{ |
20
|
|
|
|
|
|
|
my $default; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _default_ellipsoid { |
23
|
1
|
|
33
|
1
|
|
7
|
$default ||= Geo::Ellipsoid->new( %$ellipsoid_args ); |
24
|
1
|
|
|
|
|
140
|
return $default; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub BUILDARGS { |
29
|
1
|
|
|
1
|
0
|
34
|
my $class = shift; |
30
|
|
|
|
|
|
|
|
31
|
1
|
50
|
33
|
|
|
6
|
if (@_ == 1 and !ref($_[0])) { |
32
|
|
|
|
|
|
|
return { |
33
|
0
|
|
|
|
|
0
|
ellipsoid => Geo::Ellipsoid->new( |
34
|
|
|
|
|
|
|
%$ellipsoid_args, |
35
|
|
|
|
|
|
|
ellipsoid => $_[0], |
36
|
|
|
|
|
|
|
), |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
5
|
return $class->SUPER::BUILDARGS( @_ ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub BUILD { |
44
|
1
|
|
|
1
|
0
|
19
|
my ($self) = @_; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
33
|
|
|
8
|
$self->{ellipsoid} ||= _default_ellipsoid(); |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
3
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _distance { |
52
|
5
|
|
|
5
|
|
7101
|
my $self = $GIS::Distance::Formula::SELF; |
53
|
|
|
|
|
|
|
|
54
|
5
|
50
|
|
|
|
11
|
my $ellipsoid = $self ? $self->{ellipsoid} : _default_ellipsoid(); |
55
|
|
|
|
|
|
|
|
56
|
5
|
|
|
|
|
15
|
return $ellipsoid->range( @_ ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
__END__ |