/usr/share/perl5/Geo/GoogleEarth/Pluggable/Plugin/Style.pm is in libgeo-googleearth-pluggable-perl 0.15-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | package Geo::GoogleEarth::Pluggable::Plugin::Style;
use Geo::GoogleEarth::Pluggable::Style;
use Geo::GoogleEarth::Pluggable::StyleMap;
use Scalar::Util qw{blessed};
use warnings;
use strict;
our $VERSION='0.14';
=head1 NAME
Geo::GoogleEarth::Pluggable::Plugin::Style - Geo::GoogleEarth::Pluggable Style Plugin Methods
=head1 SYNOPSIS
use Geo::GoogleEarth::Pluggable;
my $document=Geo::GoogleEarth::Pluggable->new; #ISA L<Geo::GoogleEarth::Pluggable>
my $style=$document->IconStyle(color=>{red=>255}); #ISA L<Geo::GoogleEarth::Pluggable::Style>
my $point=$document->Point(style=>$style); #ISA L<Geo::GoogleEarth::Pluggable::Contrib::Point>
print $document->render;
=head1 METHODS
Methods in this package are AUTOLOADed into the Geo::GoogleEarth::Pluggable::Folder namespace at runtime.
=head2 Style
Constructs a new Style object and appends it to the document object. Returns the Style object reference.
my $style=$folder->Style(
id => $id, #default is good
IconStyle => {},
LineStyle => {},
PolyStyle => {},
LabelStyle => {},
ListStyle => {},
);
my $style=$folder->Style(
IconStyle => $style1, #extracts IconStyle from $style1
LineStyle => $style2, #extracts LineStyle from $style2
PolyStyle => $style3, #extracts PolyStyle from $style3
);
=cut
sub Style {
my $self=shift;
my %data=@_;
foreach my $key (keys %data) {
next unless $key=~m/Style$/;
#Extracts the particular IconStyle, LineStyle, etc from an existing Style object
my $ref=$data{$key};
if (blessed($ref) and $ref->can("type") and $ref->type eq "Style") {
$data{$key}=$ref->{$key}; #allow Style to be blessed objects
}
}
my $obj=Geo::GoogleEarth::Pluggable::Style->new(
document=>$self->document,
%data,
);
$self->document->data($obj);
return $obj;
}
=head2 StyleMap
Constructs a new StyleMap object and appends it to the document object. Returns the StyleMap object reference.
my $stylemap=$document->StyleMap(
normal => $style1,
highlight => $style2,
);
=cut
sub StyleMap {
my $self=shift;
my %data=@_;
my $obj=Geo::GoogleEarth::Pluggable::StyleMap->new(
document=>$self->document,
%data,
);
$self->document->data($obj);
return $obj;
}
=head2 IconStyle
my $style=$folder->IconStyle(
color => $color,
scale => $scale,
href => $url,
);
=cut
sub IconStyle {
my $self=shift;
my %data=@_;
my $id=delete($data{"id"}); #undef is fine here...
return $self->Style(id=>$id, IconStyle=>\%data);
}
=head2 LineStyle
my $color={red=>255, green=>255, blue=>255, alpha=>255};
my $style=$folder->LineStyle(color=>$color);
=cut
sub LineStyle {
my $self=shift;
my %data=@_;
$data{"width"}=1 unless defined $data{"width"};
my $id=delete($data{"id"}); #undef is fine here...
return $self->Style(id=>$id, LineStyle=>\%data);
}
=head2 PolyStyle
my $color={red=>255, green=>255, blue=>255, alpha=>255};
my $style=$folder->PolyStyle(color=>$color);
=cut
sub PolyStyle {
my $self=shift;
my %data=@_;
my $id=delete($data{"id"}); #undef is fine here...
return $self->Style(id=>$id, PolyStyle=>\%data);
}
=head2 LabelStyle
my $style=$folder->LabelStyle(
color => $color,
scale => $scale,
);
=cut
sub LabelStyle {
my $self=shift;
my %data=@_;
my $id=delete($data{"id"}); #undef is fine here...
return $self->Style(id=>$id, LabelStyle=>\%data);
}
=head2 ListStyle
my $style=$folder->ListStyle(
href => $url,
);
=cut
sub ListStyle {
my $self=shift;
my %data=@_;
my $id=delete($data{"id"}); #undef is fine here...
return $self->Style(id=>$id, ListStyle=>\%data);
}
=head1 TODO
Need to determine what methods should be in the Folder package and what should be on the Plugin/Style package and why.
=head1 BUGS
Please log on RT and send to the geo-perl email list.
=head1 LIMITATIONS
This will construct 100 identical style objects
foreach (1 .. 100) {
$document->Point(style=>$document->IconStyle(color=>{red=>255}));
}
Do this instead
my $style=$document->IconStyle(color=>{red=>255});
foreach (1 .. 100) {
$document->Point(style=>$style);
}
=head1 SUPPORT
Try geo-perl email list.
=head1 AUTHOR
Michael R. Davis (mrdvt92)
CPAN ID: MRDVT
=head1 COPYRIGHT
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.
=head1 SEE ALSO
L<Geo::GoogleEarth::Pluggable> creates a GoogleEarth Document.
=cut
1;
|