| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Geo::Leaflet::Icon; |
|
2
|
2
|
|
|
2
|
|
13
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
89
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
87
|
|
|
4
|
2
|
|
|
2
|
|
7
|
use base qw{Package::New}; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
153
|
|
|
5
|
2
|
|
|
2
|
|
7
|
use JSON::XS; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
2559
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
|
8
|
|
|
|
|
|
|
our $PACKAGE = __PACKAGE__; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Geo::Leaflet::Icon - Leaflet icon object |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Geo::Leaflet; |
|
17
|
|
|
|
|
|
|
my $map = Geo::Leaflet->new; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This package constructs a Leaflet icon object for use in a L object. |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 CONSTRUCTORS |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 new |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 PROPERTIES |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 name |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
The JavaScript name for the icon object. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Default: iconNNN |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
our $NAME_PREFIX = 'icon'; |
|
38
|
|
|
|
|
|
|
our $NAME_INDEX = 1; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub name { |
|
41
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
42
|
0
|
0
|
|
|
|
|
$self->{'name'} = shift if @_; |
|
43
|
0
|
|
0
|
|
|
|
$self->{'name'} ||= sprintf(sprintf('%s%d', $NAME_PREFIX, $NAME_INDEX++)); |
|
44
|
0
|
0
|
|
|
|
|
die("Error: $PACKAGE name invaild variable name") unless $self->{'name'} =~ m/\A[a-z_][a-z0-9_]*\Z/i; |
|
45
|
0
|
|
|
|
|
|
return $self->{'name'}; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 options |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub options { |
|
53
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
54
|
0
|
0
|
|
|
|
|
$self->{'options'} = shift if @_; |
|
55
|
0
|
0
|
|
|
|
|
$self->{'options'} = {} unless $self->{'options'}; |
|
56
|
0
|
0
|
|
|
|
|
die("Error: $PACKAGE options must be a hash") unless ref($self->{'options'}) eq 'HASH'; |
|
57
|
0
|
|
|
|
|
|
return $self->{'options'}; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 METHODS |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 stringify |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
|
|
sub _method_name {'icon'}; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub stringify { |
|
69
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
70
|
|
|
|
|
|
|
# var icon_name = L.icon({ |
|
71
|
|
|
|
|
|
|
# iconUrl: 'my-icon.png', |
|
72
|
|
|
|
|
|
|
# iconSize: [38, 95], |
|
73
|
|
|
|
|
|
|
# iconAnchor: [22, 94], |
|
74
|
|
|
|
|
|
|
# popupAnchor: [-3, -76], |
|
75
|
|
|
|
|
|
|
# shadowUrl: 'my-icon-shadow.png', |
|
76
|
|
|
|
|
|
|
# shadowSize: [68, 95], |
|
77
|
|
|
|
|
|
|
# shadowAnchor: [22, 94] |
|
78
|
|
|
|
|
|
|
# }); |
|
79
|
0
|
|
|
|
|
|
return sprintf(q{L.%s(%s);}, $self->_method_name, $self->JSON->encode($self->options)); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 JSON |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub JSON { |
|
87
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
88
|
0
|
|
|
|
|
|
$self->{'JSON'} = JSON::XS->new->allow_nonref; |
|
89
|
0
|
|
|
|
|
|
return $self->{'JSON'}; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 AUTHOR |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Michael R. Davis |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Copyright (C) 2024 by Michael R. Davis |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
MIT LICENSE |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |