line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GIS::Distance::GeoEllipsoid; |
2
|
1
|
|
|
1
|
|
1127
|
use 5.008001; |
|
1
|
|
|
|
|
4
|
|
3
|
1
|
|
|
1
|
|
9
|
use strictures 2; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
44
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
664
|
use parent 'GIS::Distance::Formula'; |
|
1
|
|
|
|
|
297
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
34432
|
use Geo::Ellipsoid; |
|
1
|
|
|
|
|
18023
|
|
|
1
|
|
|
|
|
34
|
|
9
|
1
|
|
|
1
|
|
7
|
use namespace::clean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
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
|
|
9
|
$default ||= Geo::Ellipsoid->new( %$ellipsoid_args ); |
24
|
1
|
|
|
|
|
154
|
return $default; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub BUILDARGS { |
29
|
1
|
|
|
1
|
0
|
38
|
my $class = shift; |
30
|
|
|
|
|
|
|
|
31
|
1
|
50
|
33
|
|
|
7
|
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
|
21
|
my ($self) = @_; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
33
|
|
|
9
|
$self->{ellipsoid} ||= _default_ellipsoid(); |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
3
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _distance { |
52
|
5
|
|
|
5
|
|
9484
|
my $self = $GIS::Distance::Formula::SELF; |
53
|
|
|
|
|
|
|
|
54
|
5
|
50
|
|
|
|
16
|
my $ellipsoid = $self ? $self->{ellipsoid} : _default_ellipsoid(); |
55
|
|
|
|
|
|
|
|
56
|
5
|
|
|
|
|
18
|
return $ellipsoid->range( @_ ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
__END__ |