| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Geo::Leaflet::polygon; |
|
2
|
2
|
|
|
2
|
|
14
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
80
|
|
|
3
|
2
|
|
|
2
|
|
39
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
115
|
|
|
4
|
2
|
|
|
2
|
|
28
|
use base qw{Geo::Leaflet::Objects}; |
|
|
2
|
|
|
|
|
25
|
|
|
|
2
|
|
|
|
|
606
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
7
|
|
|
|
|
|
|
our $PACKAGE = __PACKAGE__; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Geo::Leaflet::polygon - Leaflet polygon object |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Geo::Leaflet; |
|
16
|
|
|
|
|
|
|
my $map = Geo::Leaflet->new; |
|
17
|
|
|
|
|
|
|
my $polygon = $map->polygon( |
|
18
|
|
|
|
|
|
|
coordinates => [[$lat, $lon], ...] |
|
19
|
|
|
|
|
|
|
options => {}, |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This package constructs a Leaflet polygon object for use on a L map. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 PROPERTIES |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 coordinates |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub coordinates { |
|
33
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
|
34
|
1
|
50
|
|
|
|
5
|
$self->{'coordinates'} = shift if @_; |
|
35
|
1
|
50
|
|
|
|
4
|
die("Error: coordinates required") unless defined $self->{'coordinates'}; |
|
36
|
1
|
|
|
|
|
9
|
return $self->{'coordinates'}; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 options |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 popup |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 METHODS |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 stringify |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub stringify { |
|
50
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
51
|
|
|
|
|
|
|
# const polygon = L.polygon([ |
|
52
|
|
|
|
|
|
|
# [51.509, -0.08], |
|
53
|
|
|
|
|
|
|
# [51.503, -0.06], |
|
54
|
|
|
|
|
|
|
# [51.51, -0.047] |
|
55
|
|
|
|
|
|
|
# ]).addTo(map).bindPopup('I am a polygon.'); |
|
56
|
1
|
|
|
|
|
50
|
return $self->stringify_base($self->coordinates); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 AUTHOR |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Michael R. Davis |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Copyright (C) 2024 by Michael R. Davis |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
MIT LICENSE |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |