line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::GoogleEarth::Pluggable::Contrib::MultiPolygon; |
2
|
5
|
|
|
5
|
|
870
|
use base qw{Geo::GoogleEarth::Pluggable::Placemark}; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
431
|
|
3
|
5
|
|
|
5
|
|
30
|
use XML::LibXML::LazyBuilder qw{E}; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
179
|
|
4
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
115
|
|
5
|
5
|
|
|
5
|
|
25
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
1199
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION='0.17'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Geo::GoogleEarth::Pluggable::Contrib::MultiPolygon - Geo::GoogleEarth::Pluggable MultiPolygon Object |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Geo::GoogleEarth::Pluggable; |
16
|
|
|
|
|
|
|
my $document=Geo::GoogleEarth::Pluggable->new(); |
17
|
|
|
|
|
|
|
$document->MultiPolygon(); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Geo::GoogleEarth::Pluggable::Contrib::MultiPolygon is a L. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 USAGE |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#Note: lon, lat, alt like GeoJSON. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $placemark=$document->MultiPolygon( |
28
|
|
|
|
|
|
|
name => "MultiPolygon Name", |
29
|
|
|
|
|
|
|
coordinates => [ |
30
|
|
|
|
|
|
|
[ #outerBoundaryIs |
31
|
|
|
|
|
|
|
[lon, lat ,alt], |
32
|
|
|
|
|
|
|
[lon, lat ,alt], |
33
|
|
|
|
|
|
|
[lon, lat ,alt], |
34
|
|
|
|
|
|
|
... |
35
|
|
|
|
|
|
|
], |
36
|
|
|
|
|
|
|
[ #innerBoundaryIs |
37
|
|
|
|
|
|
|
[lon, lat ,alt], |
38
|
|
|
|
|
|
|
[lon, lat ,alt], |
39
|
|
|
|
|
|
|
[lon, lat ,alt], |
40
|
|
|
|
|
|
|
] |
41
|
|
|
|
|
|
|
], |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $placemark=$document->MultiPolygon(); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 METHODS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 subnode |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub subnode { |
55
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
56
|
1
|
|
|
|
|
5
|
my %data = %$self; |
57
|
1
|
50
|
|
|
|
5
|
$data{"tessellate"} = 1 unless defined $data{"tessellate"}; |
58
|
1
|
50
|
|
|
|
8
|
my $multipolygon = $data{"coordinates"} or die("Error: MultiPolygon coordinates required"); |
59
|
1
|
50
|
|
|
|
4
|
die("Error: MultiPolygon coordinates must be an array reference") unless ref($multipolygon) eq "ARRAY"; |
60
|
1
|
|
|
|
|
3
|
my @elements = (); |
61
|
1
|
|
|
|
|
2
|
foreach my $polygon (@$multipolygon) { |
62
|
2
|
50
|
|
|
|
12
|
die("Error: MultiPolygon coordinates polygon must be an array reference") unless ref($polygon) eq "ARRAY"; |
63
|
2
|
|
|
|
|
6
|
my @polygon_element = (E(tessellate=>{}, $data{"tessellate"})); |
64
|
2
|
|
|
|
|
24
|
my $first = 1; |
65
|
2
|
|
|
|
|
4
|
foreach my $boundary (@$polygon) { |
66
|
2
|
50
|
|
|
|
5
|
die("Error: MultiPolygon coordinates polygon first boundary (outerBoundaryIs) must be an array reference") unless ref($boundary) eq "ARRAY"; |
67
|
2
|
|
|
|
|
9
|
my $string = $self->coordinates_stringify($boundary); |
68
|
2
|
50
|
|
|
|
10
|
push @polygon_element, E(($first ? "outerBoundaryIs" : "innerBoundaryIs"), {}, E(LinearRing=>{}, E(coordinates=>{}, $string))); |
69
|
2
|
|
|
|
|
63
|
$first = 0; |
70
|
|
|
|
|
|
|
} |
71
|
2
|
|
|
|
|
7
|
push @elements, E(Polygon => {}, @polygon_element); |
72
|
|
|
|
|
|
|
} |
73
|
1
|
|
|
|
|
10
|
return E(MultiGeometry=>{}, @elements); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 BUGS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Please log on RT and send to the geo-perl email list. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SUPPORT |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Try geo-perl email list. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHOR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Michael R. Davis (mrdvt92) |
87
|
|
|
|
|
|
|
CPAN ID: MRDVT |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 COPYRIGHT |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This program is free software licensed under the... |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The BSD License |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
The full text of the license can be found in the LICENSE file included with this module. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 SEE ALSO |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
L, L, L |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |