line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::JSON::Base; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.006'; # VERSION |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: Base class for Geo::JSON objects |
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
4514
|
use Moo; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
40
|
|
8
|
|
|
|
|
|
|
with 'Geo::JSON::Role::ToJson'; |
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
2415
|
use Carp; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
436
|
|
11
|
|
|
|
|
|
|
|
12
|
6
|
|
|
6
|
|
1774
|
use Geo::JSON; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
214
|
|
13
|
6
|
|
|
6
|
|
41
|
use Geo::JSON::Types -types; |
|
6
|
|
|
|
|
52
|
|
|
6
|
|
|
|
|
65
|
|
14
|
6
|
|
|
6
|
|
10391
|
use Geo::JSON::Utils; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
322
|
|
15
|
|
|
|
|
|
|
|
16
|
6
|
|
|
6
|
|
37
|
use Types::Standard -types; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
59
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has type => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
isa => Str, |
21
|
|
|
|
|
|
|
default => sub { ( ( ref $_[0] ) =~ m/::(\w+)$/ )[0] }, |
22
|
|
|
|
|
|
|
required => 1, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has crs => ( is => 'ro', isa => Maybe [CRS], coerce => CRS->coercion ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has bbox => ( is => 'rw', isa => Maybe [ ArrayRef [Num] ] ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# used by JSON 'convert_blessed' |
31
|
|
|
|
|
|
|
sub TO_JSON { |
32
|
30
|
|
|
30
|
0
|
58
|
my $self = $_[0]; |
33
|
|
|
|
|
|
|
|
34
|
30
|
|
|
|
|
187
|
my %output = ( |
35
|
|
|
|
|
|
|
type => $self->type, |
36
|
30
|
|
|
|
|
148
|
%{$self}, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# prevent empty 'crs' key |
40
|
30
|
100
|
|
|
|
135
|
delete $output{crs} |
41
|
|
|
|
|
|
|
unless defined $output{crs}; |
42
|
|
|
|
|
|
|
|
43
|
30
|
|
|
|
|
432
|
return \%output; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub compute_bbox { |
48
|
7
|
|
|
7
|
1
|
10548
|
return Geo::JSON::Utils::compute_bbox( shift->all_positions ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub all_positions { |
52
|
4
|
|
|
4
|
1
|
31
|
return shift->coordinates; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |