line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::JSON::Base; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.007'; |
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
3008
|
use Moo; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
33
|
|
6
|
|
|
|
|
|
|
with 'Geo::JSON::Role::ToJson'; |
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
1875
|
use Carp; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
335
|
|
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
1012
|
use Geo::JSON; |
|
6
|
|
|
|
|
68
|
|
|
6
|
|
|
|
|
166
|
|
11
|
6
|
|
|
6
|
|
28
|
use Geo::JSON::Types -types; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
44
|
|
12
|
6
|
|
|
6
|
|
6643
|
use Geo::JSON::Utils; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
260
|
|
13
|
|
|
|
|
|
|
|
14
|
6
|
|
|
6
|
|
28
|
use Types::Standard -types; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
39
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has type => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
isa => Str, |
19
|
|
|
|
|
|
|
default => sub { ( ( ref $_[0] ) =~ m/::(\w+)$/ )[0] }, |
20
|
|
|
|
|
|
|
required => 1, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has crs => ( is => 'ro', isa => Maybe [CRS], coerce => CRS->coercion ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has bbox => ( is => 'rw', isa => Maybe [ ArrayRef [Num] ] ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# used by JSON 'convert_blessed' |
28
|
|
|
|
|
|
|
sub TO_JSON { |
29
|
30
|
|
|
30
|
0
|
45
|
my $self = $_[0]; |
30
|
|
|
|
|
|
|
|
31
|
30
|
|
|
|
|
153
|
my %output = ( |
32
|
|
|
|
|
|
|
type => $self->type, |
33
|
30
|
|
|
|
|
142
|
%{$self}, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# prevent empty 'crs' key |
37
|
30
|
100
|
|
|
|
116
|
delete $output{crs} |
38
|
|
|
|
|
|
|
unless defined $output{crs}; |
39
|
|
|
|
|
|
|
|
40
|
30
|
|
|
|
|
447
|
return \%output; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub compute_bbox { |
44
|
7
|
|
|
7
|
1
|
9056
|
return Geo::JSON::Utils::compute_bbox( shift->all_positions ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub all_positions { |
48
|
4
|
|
|
4
|
1
|
25
|
return shift->coordinates; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |