line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Facebook::InstantArticle::Map; |
2
|
2
|
|
|
2
|
|
10
|
use Moose; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
15
|
|
3
|
2
|
|
|
2
|
|
15243
|
use namespace::autoclean; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
25
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'Facebook::InstantArticle::BaseElement'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'type' => ( |
8
|
|
|
|
|
|
|
isa => 'Str', |
9
|
|
|
|
|
|
|
is => 'rw', |
10
|
|
|
|
|
|
|
required => 0, |
11
|
|
|
|
|
|
|
default => 'Point', |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has 'latitude' => ( |
15
|
|
|
|
|
|
|
isa => 'Maybe[Num]', |
16
|
|
|
|
|
|
|
is => 'rw', |
17
|
|
|
|
|
|
|
required => 1, |
18
|
|
|
|
|
|
|
default => 0, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has 'longitude' => ( |
22
|
|
|
|
|
|
|
isa => 'Maybe[Num]', |
23
|
|
|
|
|
|
|
is => 'rw', |
24
|
|
|
|
|
|
|
required => 1, |
25
|
|
|
|
|
|
|
default => 0, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has 'is_valid' => ( |
29
|
|
|
|
|
|
|
isa => 'Bool', |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
lazy => 1, |
32
|
|
|
|
|
|
|
default => sub { |
33
|
|
|
|
|
|
|
my $self = shift; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
return ( defined $self->latitude && defined $self->longitude ) ? 1 : 0; |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has 'as_xml_gen' => ( |
40
|
|
|
|
|
|
|
isa => 'Object', |
41
|
|
|
|
|
|
|
is => 'ro', |
42
|
|
|
|
|
|
|
lazy => 1, |
43
|
|
|
|
|
|
|
builder => '_build_as_xml_gen', |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _build_as_xml_gen { |
47
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
4
|
my $gen = XML::Generator->new( ':pretty' ); |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
151
|
return $gen->figure( |
52
|
|
|
|
|
|
|
{ class => 'op-map' }, |
53
|
|
|
|
|
|
|
$gen->script( |
54
|
|
|
|
|
|
|
{ type => 'application/json', class => 'op-geotag' }, |
55
|
|
|
|
|
|
|
'{ |
56
|
|
|
|
|
|
|
"type": "Feature", |
57
|
|
|
|
|
|
|
"geometry": |
58
|
|
|
|
|
|
|
{ |
59
|
|
|
|
|
|
|
"type": "' . $self->type . '", |
60
|
|
|
|
|
|
|
"coordinates": [' . $self->latitude . ', ' . $self->longitude . '] |
61
|
|
|
|
|
|
|
}, |
62
|
|
|
|
|
|
|
"properties": |
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
"title": "", |
65
|
|
|
|
|
|
|
"radius": 350000, |
66
|
|
|
|
|
|
|
"pivot": true, |
67
|
|
|
|
|
|
|
"style": "satellite", |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
}', |
70
|
|
|
|
|
|
|
), |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |