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