line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::GoogleEarth::Pluggable::Folder; |
2
|
5
|
|
|
5
|
|
24
|
use base qw{Geo::GoogleEarth::Pluggable::Base}; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
2690
|
|
3
|
5
|
|
|
5
|
|
2321
|
use XML::LibXML::LazyBuilder qw{E}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use Scalar::Util qw{blessed}; |
5
|
|
|
|
|
|
|
use warnings; |
6
|
|
|
|
|
|
|
use strict; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Module::Pluggable search_path => "Geo::GoogleEarth::Pluggable::Plugin"; |
9
|
|
|
|
|
|
|
use base qw{Method::Autoload}; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Geo::GoogleEarth::Pluggable::NetworkLink; |
12
|
|
|
|
|
|
|
use Geo::GoogleEarth::Pluggable::LookAt; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION ='0.14'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Geo::GoogleEarth::Pluggable::Folder - Geo::GoogleEarth::Pluggable::Folder object |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Geo::GoogleEarth::Pluggable; |
23
|
|
|
|
|
|
|
my $document=Geo::GoogleEarth::Pluggable->new; |
24
|
|
|
|
|
|
|
my $folder=$document->Folder(name=>"My Folder"); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Geo::GoogleEarth::Pluggable::Folder is a L with a few other methods. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 USAGE |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $folder=$document->Folder(); #add folder to $document |
33
|
|
|
|
|
|
|
my $subfolder=$folder->Folder(); #add folder to $folder |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 initialize |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
We overide the default "initialize" method in order to append the "plugins" method from L on to the packages list of the L package. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
The "packages" property is what is needed by L package. The "plugins" method is what is provided by L. So, the Folder package now has available to it every method in the "Plugins" folder at runtime. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub initialize { |
48
|
|
|
|
|
|
|
my $self = shift(); |
49
|
|
|
|
|
|
|
%$self=@_; |
50
|
|
|
|
|
|
|
$self->pushPackages($self->plugins); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 Folder |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Constructs a new Folder object and appends it to the parent folder object. Returns the object reference if you need to make any setting changes after construction. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $folder=$folder->Folder(name=>"My Folder"); |
58
|
|
|
|
|
|
|
$folder->Folder(name=>"My Folder"); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub Folder { |
63
|
|
|
|
|
|
|
my $self=shift; |
64
|
|
|
|
|
|
|
my $obj=Geo::GoogleEarth::Pluggable::Folder->new(document=>$self->document, @_); |
65
|
|
|
|
|
|
|
$self->data($obj); |
66
|
|
|
|
|
|
|
return $obj; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 NetworkLink |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Constructs a new NetworkLink object and appends it to the parent folder object. Returns the object reference if you need to make any setting changes after construction. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
$folder->NetworkLink(name=>"My NetworkLink", url=>"./anotherdoc.kml"); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub NetworkLink { |
78
|
|
|
|
|
|
|
my $self=shift(); |
79
|
|
|
|
|
|
|
my $obj=Geo::GoogleEarth::Pluggable::NetworkLink->new(document=>$self->document, @_); |
80
|
|
|
|
|
|
|
$self->data($obj); |
81
|
|
|
|
|
|
|
return $obj; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 LookAt |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Constructs a new LookAt object and returns the object reference to assign to other object "lookat" properties. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
$document->LookAt( |
89
|
|
|
|
|
|
|
latitude => $lat, #decimal degrees |
90
|
|
|
|
|
|
|
longitude => $lon, #decimal degrees |
91
|
|
|
|
|
|
|
range => $range, #meters |
92
|
|
|
|
|
|
|
tilt => $tilt, #decimal degrees from veritical |
93
|
|
|
|
|
|
|
heading => $header, #decimal degrees from North |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub LookAt { |
99
|
|
|
|
|
|
|
my $self=shift(); |
100
|
|
|
|
|
|
|
my $obj=Geo::GoogleEarth::Pluggable::LookAt->new(document=>$self->document, @_); |
101
|
|
|
|
|
|
|
$self->data($obj); |
102
|
|
|
|
|
|
|
return $obj; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 type |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Returns the object type. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
my $type=$folder->type; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub type {"Folder"}; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 node |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub node { |
120
|
|
|
|
|
|
|
my $self=shift; |
121
|
|
|
|
|
|
|
my @data=(); |
122
|
|
|
|
|
|
|
push @data, E(name=>{}, $self->name) if defined $self->name; |
123
|
|
|
|
|
|
|
push @data, E(Snippet=>{maxLines=>scalar(@{$self->Snippet})}, join("\n", @{$self->Snippet})); |
124
|
|
|
|
|
|
|
push @data, E(description=>{}, $self->description) |
125
|
|
|
|
|
|
|
if defined $self->description; |
126
|
|
|
|
|
|
|
push @data, E(open=>{}, $self->open) if defined $self->open; |
127
|
|
|
|
|
|
|
my @style=(); |
128
|
|
|
|
|
|
|
my @stylemap=(); |
129
|
|
|
|
|
|
|
my @element=(); |
130
|
|
|
|
|
|
|
foreach my $obj ($self->data) { |
131
|
|
|
|
|
|
|
if (blessed($obj) and $obj->can("type") and $obj->type eq "Style") { |
132
|
|
|
|
|
|
|
push @style, $obj->node; |
133
|
|
|
|
|
|
|
} elsif (blessed($obj) and $obj->can("type") and $obj->type eq "StyleMap") { |
134
|
|
|
|
|
|
|
push @stylemap, $obj->node; |
135
|
|
|
|
|
|
|
} else { |
136
|
|
|
|
|
|
|
push @element, $obj->node; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
return E($self->type=>{}, @data, @style, @stylemap, @element); |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 data |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Pushes arguments onto data array and returns an array or reference that holds folder object content. This is a list of objects that supports a type and structure method. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
my $data=$folder->data; |
147
|
|
|
|
|
|
|
my @data=$folder->data; |
148
|
|
|
|
|
|
|
$folder->data($placemark); |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub data { |
153
|
|
|
|
|
|
|
my $self=shift(); |
154
|
|
|
|
|
|
|
$self->{'data'} = [] unless ref($self->{'data'}) eq "ARRAY"; |
155
|
|
|
|
|
|
|
my $data=$self->{'data'}; |
156
|
|
|
|
|
|
|
if (@_) { |
157
|
|
|
|
|
|
|
push @$data, @_; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
return wantarray ? @$data : $data; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 open |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub open {shift->{"open"}}; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 BUGS |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Please log on RT and send to the geo-perl email list. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 LIMITATIONS |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Due to limitations in Perl hashes, it is not possible to specify the order of certain elements and attributes in the XML. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 TODO |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 SUPPORT |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Try geo-perl email list. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 AUTHOR |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Michael R. Davis (mrdvt92) |
185
|
|
|
|
|
|
|
CPAN ID: MRDVT |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 COPYRIGHT |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
This program is free software licensed under the... |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
The BSD License |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
The full text of the license can be found in the |
194
|
|
|
|
|
|
|
LICENSE file included with this module. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head1 SEE ALSO |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
L, L L, L |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
1; |