| Geo-GoogleEarth-Pluggable documentation | Contained in the Geo-GoogleEarth-Pluggable distribution. |
Geo::GoogleEarth::Pluggable::Folder - Geo::GoogleEarth::Pluggable::Folder object
use Geo::GoogleEarth::Pluggable; my $document=Geo::GoogleEarth::Pluggable->new; my $folder=$document->Folder(name=>"My Folder");
Geo::GoogleEarth::Pluggable::Folder is a Geo::GoogleEarth::Pluggable::Base with a few other methods.
my $folder=$document->Folder(); #add folder to $document my $subfolder=$folder->Folder(); #add folder to $folder
We overide the default "initialize" method in order to append the "plugins" method from Module::Pluggable on to the packages list of the Method::Autoload package.
The "packages" property is what is needed by Method::Autoload package. The "plugins" method is what is provided by Module::Pluggable. So, the Folder package now has available to it every method in the "Plugins" folder at runtime.
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.
my $folder=$folder->Folder(name=>"My Folder"); $folder->Folder(name=>"My Folder");
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.
$folder->NetworkLink(name=>"My NetworkLink", url=>"./anotherdoc.kml");
Constructs a new LookAt object and returns the object reference to assign to other object "lookat" properties.
$document->LookAt(
latitude => $lat, #decimal degrees
longitude => $lon, #decimal degrees
range => $range, #meters
tilt => $tilt, #decimal degrees from veritical
heading => $header, #decimal degrees from North
);
Returns the object type.
my $type=$folder->type;
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.
my $data=$folder->data; my @data=$folder->data; $folder->data($placemark);
Please log on RT and send to the geo-perl email list.
Due to limitations in Perl hashes, it is not possible to specify the order of certain elements and attributes in the XML.
Try geo-perl email list.
Michael R. Davis (mrdvt92) CPAN ID: MRDVT
This program is free software licensed under the...
The BSD License
The full text of the license can be found in the LICENSE file included with this module.
| Geo-GoogleEarth-Pluggable documentation | Contained in the Geo-GoogleEarth-Pluggable distribution. |
package Geo::GoogleEarth::Pluggable::Folder; use base qw{Geo::GoogleEarth::Pluggable::Base}; use XML::LibXML::LazyBuilder qw{E}; use Scalar::Util qw{blessed}; use warnings; use strict; use Module::Pluggable search_path => "Geo::GoogleEarth::Pluggable::Plugin"; use base qw{Method::Autoload}; use Geo::GoogleEarth::Pluggable::NetworkLink; use Geo::GoogleEarth::Pluggable::LookAt; our $VERSION ='0.14';
sub initialize { my $self = shift(); %$self=@_; $self->pushPackages($self->plugins); }
sub Folder { my $self=shift; my $obj=Geo::GoogleEarth::Pluggable::Folder->new(document=>$self->document, @_); $self->data($obj); return $obj; }
sub NetworkLink { my $self=shift(); my $obj=Geo::GoogleEarth::Pluggable::NetworkLink->new(document=>$self->document, @_); $self->data($obj); return $obj; }
sub LookAt { my $self=shift(); my $obj=Geo::GoogleEarth::Pluggable::LookAt->new(document=>$self->document, @_); $self->data($obj); return $obj; }
sub type {"Folder"};
sub node { my $self=shift; my @data=(); push @data, E(name=>{}, $self->name) if defined $self->name; push @data, E(Snippet=>{maxLines=>scalar(@{$self->Snippet})}, join("\n", @{$self->Snippet})); push @data, E(description=>{}, $self->description) if defined $self->description; push @data, E(open=>{}, $self->open) if defined $self->open; my @style=(); my @stylemap=(); my @element=(); foreach my $obj ($self->data) { if (blessed($obj) and $obj->can("type") and $obj->type eq "Style") { push @style, $obj->node; } elsif (blessed($obj) and $obj->can("type") and $obj->type eq "StyleMap") { push @stylemap, $obj->node; } else { push @element, $obj->node; } } return E($self->type=>{}, @data, @style, @stylemap, @element); }
sub data { my $self=shift(); $self->{'data'} = [] unless ref($self->{'data'}) eq "ARRAY"; my $data=$self->{'data'}; if (@_) { push @$data, @_; } return wantarray ? @$data : $data; }
sub open {shift->{"open"}};
1;