line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::Google::StaticMaps::V2::Visible; |
2
|
10
|
|
|
10
|
|
59
|
use warnings; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
283
|
|
3
|
10
|
|
|
10
|
|
48
|
use strict; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
279
|
|
4
|
10
|
|
|
10
|
|
46
|
use base qw{Package::New}; |
|
10
|
|
|
|
|
13
|
|
|
10
|
|
|
|
|
4883
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
6
|
|
|
|
|
|
|
our $PACKAGE = __PACKAGE__; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Geo::Google::StaticMaps::V2::Visible - Generate Images from Google Static Maps V2 API |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Geo::Google::StaticMaps::V2; |
15
|
|
|
|
|
|
|
my $map=Geo::Google::StaticMaps::V2->new; |
16
|
|
|
|
|
|
|
my $visible=$map->visible(locations=>["Clifton, VA", "Pag, Croatia"]); #isa Geo::Google::StaticMaps::V2::Visible |
17
|
|
|
|
|
|
|
print $map->url, "\n"; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
The packages generates images from the Google Static Maps V2 API which can be saved locally for use in accordance with your license with Google. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 USAGE |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Geo::Google::StaticMaps::V2; |
26
|
|
|
|
|
|
|
my $map=Geo::Google::StaticMaps::V2->new; |
27
|
|
|
|
|
|
|
my $visible=$map->visible(location=>"Clifton, VA"); #isa Geo::Google::StaticMaps::V2::Visible |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 initialize |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Sets all passed in arguments and folds location parameter into the locations array. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub initialize { |
36
|
12
|
|
|
12
|
1
|
3760
|
my $self=shift; |
37
|
12
|
|
|
|
|
101
|
%$self=@_; |
38
|
12
|
100
|
|
|
|
91
|
$self->addLocation(delete $self->{"location"}) if exists $self->{"location"}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 stringify |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Handles various formats for locations seamlessly. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub stringify { |
48
|
50
|
|
|
50
|
1
|
71
|
my $self=shift; |
49
|
50
|
|
|
|
|
80
|
my @p=(); |
50
|
50
|
|
|
|
|
168
|
push @p, $self->_styles; |
51
|
50
|
|
|
|
|
162
|
foreach my $location ($self->locations) { |
52
|
141
|
|
|
|
|
167
|
my $string=""; |
53
|
141
|
100
|
|
|
|
316
|
if (ref($location) eq "HASH") { |
|
|
100
|
|
|
|
|
|
54
|
2
|
|
|
|
|
15
|
$string=sprintf("%0.6f,%0.6f", $location->{"lat"}, $location->{"lon"}); |
55
|
|
|
|
|
|
|
} elsif (ref($location) eq "ARRAY") { |
56
|
4
|
|
|
|
|
64
|
$string=sprintf("%0.6f,%0.6f", @$location); |
57
|
|
|
|
|
|
|
} else { |
58
|
135
|
|
|
|
|
183
|
$string="$location"; #or any object that overloads |
59
|
|
|
|
|
|
|
} |
60
|
141
|
|
|
|
|
259
|
push @p, $string; |
61
|
|
|
|
|
|
|
} |
62
|
50
|
|
|
|
|
299
|
return join "|", @p; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 locations |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Returns the locations array which can be set upon construction. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub locations { |
72
|
64
|
|
|
64
|
1
|
92
|
my $self=shift; |
73
|
64
|
100
|
|
|
|
298
|
$self->{"locations"}=[] unless ref($self->{"locations"}) eq "ARRAY"; |
74
|
64
|
100
|
|
|
|
159
|
return wantarray ? @{$self->{"locations"}} : $self->{"locations"}; |
|
50
|
|
|
|
|
167
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _styles { |
78
|
6
|
|
|
6
|
|
9
|
my $self=shift; |
79
|
6
|
|
|
|
|
9
|
my @styles=(); |
80
|
6
|
|
|
|
|
8
|
return @styles; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 METHODS |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 addLocation |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
$marker->addLocation("Clifton, VA"); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub addLocation { |
92
|
14
|
|
|
14
|
1
|
30
|
my $self=shift; |
93
|
14
|
|
|
|
|
25
|
push @{$self->locations}, @_; |
|
14
|
|
|
|
|
59
|
|
94
|
14
|
|
|
|
|
33
|
return $self; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 BUGS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Please log on RT and send an email to the author. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SUPPORT |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
DavisNetworks.com supports all Perl applications including this package. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 AUTHOR |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Michael R. Davis |
108
|
|
|
|
|
|
|
CPAN ID: MRDVT |
109
|
|
|
|
|
|
|
Satellite Tracking of People, LLC |
110
|
|
|
|
|
|
|
mdavis@stopllc.com |
111
|
|
|
|
|
|
|
http://www.stopllc.com/ |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 COPYRIGHT |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This program is free software licensed under the... |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
The General Public License (GPL) Version 2, June 1991 |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
The full text of the license can be found in the LICENSE file included with this module. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 SEE ALSO |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
L, L, L |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
1; |