Pluggable/Contrib/MultiPolygon.pm

filter: Statementstmt 100% 31 / 31 Branchbran 50.0% 6 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 87.7% 43 / 49 CC 9 SCAR 19.5
CC
9
Cov
86%
subnode
9.7
BEGIN
1.0
BEGIN
1.0
CRAP 7.0
« Pluggable/Folder.pm ↑ Summary Pluggable/StyleBase.pm »
1 package Geo::GoogleEarth::Pluggable::Contrib::MultiPolygon;
2 5 ▶use base qw{Geo::GoogleEarth::Pluggable::Placemark};
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use XML::LibXML::LazyBuilder qw{E};
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 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<Geo::GoogleEarth::Pluggable::Placemark>.
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 1 ▶sub subnode {
Subroutine subnode: called CC=9 SCAR=22.7
Pod documented
55 1 my $self = shift;
56 1 my %data = %$self;
57 1 ▶ $data{"tessellate"} = 1 unless defined $data{"tessellate"};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data{"tessellate"} 1 0 1
58 1 ▶ my $multipolygon = $data{"coordinates"} or die("Error: MultiPolygon coordinates required");
Branch: 1 branch
BranchTrueFalseTotal
my $multipolygon = $data{"coordinates"} or die "Error: MultiPolygon coordinates required" 1 0 1
59 1 ▶ die("Error: MultiPolygon coordinates must be an array reference") unless ref($multipolygon) eq "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $multipolygon eq "ARRAY" 0 1 1
60 1 my @elements = ();
61 1 foreach my $polygon (@$multipolygon) {
62 2 ▶ die("Error: MultiPolygon coordinates polygon must be an array reference") unless ref($polygon) eq "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $polygon eq "ARRAY" 0 2 2
63 2 my @polygon_element = (E(tessellate=>{}, $data{"tessellate"}));
64 2 my $first = 1;
65 2 foreach my $boundary (@$polygon) {
66 2 ▶ die("Error: MultiPolygon coordinates polygon first boundary (outerBoundaryIs) must be an array reference") unless ref($boundary) eq "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $boundary eq "ARRAY" 0 2 2
67 2 my $string = $self->coordinates_stringify($boundary);
68 2 ▶ push @polygon_element, E(($first ? "outerBoundaryIs" : "innerBoundaryIs"), {}, E(LinearRing=>{}, E(coordinates=>{}, $string)));
Branch: 1 branch
BranchTrueFalseTotal
$first ? : 2 0 2
69 2 $first = 0;
70 }
71 2 push @elements, E(Polygon => {}, @polygon_element);
72 }
73 1 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<Geo::GoogleEarth::Pluggable>, L<XML::LibXML::LazyBuilder>, L<Geo::GoogleEarth::Pluggable::Placemark>
100  
101 =cut
102  
103 5 1;
« Pluggable/Folder.pm ↑ Summary Pluggable/StyleBase.pm »