File Coverage

blib/lib/Geo/GoogleEarth/Pluggable/Plugin/Styles.pm
Criterion Covered Total %
statement 6 182 3.3
branch n/a
condition 0 6 0.0
subroutine 2 61 3.2
pod 59 59 100.0
total 67 308 21.7


line stmt bran cond sub pod time code
1             package Geo::GoogleEarth::Pluggable::Plugin::Styles;
2 1     1   21527 use warnings;
  1         2  
  1         29  
3 1     1   6 use strict;
  1         1  
  1         2940  
4              
5             our $VERSION='0.02';
6              
7             =head1 NAME
8              
9             Geo::GoogleEarth::Pluggable::Plugin::Styles - Pre-loaded Styles for Geo::GoogleEarth::Pluggable
10              
11             =head1 SYNOPSIS
12              
13             use Geo::GoogleEarth::Pluggable;
14             my $docuemnt=Geo::GoogleEarth::Pluggable->new;
15             my $style=$document->IconStyleRedDot;
16              
17             =head1 DESCRIPTION
18              
19             This package provides methods that when called from a Geo::GoogleEarth::Pluggable document or folder object will be autoloaded and available for use.
20              
21             If you do not like my colors you can simply at the bottom of your script.
22              
23             package Geo::GoogleEarth::Pluggable::Plugin::Styles;
24             use base qw{Geo::GoogleEarth::Pluggable::Plugin::Styles};
25             sub red {return {red=>255,green=>0, blue=0, alpha=>"95%"}};
26             sub blue {return {red=>0, green=>0, blue=255,alpha=>"95%"}};
27             sub green {return {red=>0, green=>255,blue=0, alpha=>"95%"}};
28              
29             =head1 USAGE
30              
31             =head1 Styles
32              
33             =head2 IconStyles
34              
35             my $style=$document->IconStyleRed(alpha=>"90%");
36              
37             =head3 IconStyleRed
38              
39             =cut
40              
41             sub IconStyleRed {
42 0     0 1   my $self=shift;
43 0           my $opt={@_};
44 0           return $self->IconStyle(color=>$self->red(alpha=>$opt->{"alpha"}));
45             }
46              
47             =head3 IconStyleOrange
48              
49             =cut
50              
51             sub IconStyleOrange {
52 0     0 1   my $self=shift;
53 0           my $opt={@_};
54 0           return $self->IconStyle(color=>$self->orange(alpha=>$opt->{"alpha"}));
55             }
56              
57             =head3 IconStyleYellow
58              
59             =cut
60              
61             sub IconStyleYellow {
62 0     0 1   my $self=shift;
63 0           my $opt={@_};
64 0           return $self->IconStyle(color=>$self->yellow(alpha=>$opt->{"alpha"}));
65             }
66              
67             =head3 IconStyleGreen
68              
69             =cut
70              
71             sub IconStyleGreen {
72 0     0 1   my $self=shift;
73 0           my $opt={@_};
74 0           return $self->IconStyle(color=>$self->green(alpha=>$opt->{"alpha"}));
75             }
76              
77             =head3 IconStyleBlue
78              
79             =cut
80              
81             sub IconStyleBlue {
82 0     0 1   my $self=shift;
83 0           my $opt={@_};
84 0           return $self->IconStyle(color=>$self->blue(alpha=>$opt->{"alpha"}));
85             }
86              
87             =head3 IconStylePurple
88              
89             =cut
90              
91             sub IconStylePurple {
92 0     0 1   my $self=shift;
93 0           my $opt={@_};
94 0           return $self->IconStyle(color=>$self->purple(alpha=>$opt->{"alpha"}));
95             }
96              
97             =head3 IconStyleWhite
98              
99             =cut
100              
101             sub IconStyleWhite {
102 0     0 1   my $self=shift;
103 0           my $opt={@_};
104 0           return $self->IconStyle(color=>$self->white(alpha=>$opt->{"alpha"}));
105             }
106              
107             =head3 IconStyleGray
108              
109             =cut
110              
111             sub IconStyleGray {
112 0     0 1   my $self=shift;
113 0           my $opt={@_};
114 0           return $self->IconStyle(color=>$self->gray(alpha=>$opt->{"alpha"}));
115             }
116              
117             =head3 IconStyleBlack
118              
119             =cut
120              
121             sub IconStyleBlack {
122 0     0 1   my $self=shift;
123 0           my $opt={@_};
124 0           return $self->IconStyle(color=>$self->black(alpha=>$opt->{"alpha"}));
125             }
126              
127             =head3 IconStyleRedDot
128              
129             my $style=$document->IconStyleRedDot(alpha=>"90%"); #Typical call
130              
131             =cut
132              
133             sub IconStyleRedDot {
134 0     0 1   my $self=shift;
135 0           my $opt={@_};
136 0           return $self->IconStyle(color=>$self->red(alpha=>$opt->{"alpha"}), href=>$self->dot);
137             }
138              
139             =head3 IconStyleOrangeDot
140              
141             =cut
142              
143             sub IconStyleOrangeDot {
144 0     0 1   my $self=shift;
145 0           my $opt={@_};
146 0           return $self->IconStyle(color=>$self->orange(alpha=>$opt->{"alpha"}), href=>$self->dot);
147             }
148              
149             =head3 IconStyleYellowDot
150              
151             =cut
152              
153             sub IconStyleYellowDot {
154 0     0 1   my $self=shift;
155 0           my $opt={@_};
156 0           return $self->IconStyle(color=>$self->yellow(alpha=>$opt->{"alpha"}), href=>$self->dot);
157             }
158              
159             =head3 IconStyleGreenDot
160              
161             =cut
162              
163             sub IconStyleGreenDot {
164 0     0 1   my $self=shift;
165 0           my $opt={@_};
166 0           return $self->IconStyle(color=>$self->green(alpha=>$opt->{"alpha"}), href=>$self->dot);
167             }
168              
169             =head3 IconStyleBlueDot
170              
171             =cut
172              
173             sub IconStyleBlueDot {
174 0     0 1   my $self=shift;
175 0           my $opt={@_};
176 0           return $self->IconStyle(color=>$self->blue(alpha=>$opt->{"alpha"}), href=>$self->dot);
177             }
178              
179             =head3 IconStylePurpleDot
180              
181             =cut
182              
183             sub IconStylePurpleDot {
184 0     0 1   my $self=shift;
185 0           my $opt={@_};
186 0           return $self->IconStyle(color=>$self->purple(alpha=>$opt->{"alpha"}), href=>$self->dot);
187             }
188              
189             =head3 IconStyleWhiteDot
190              
191             =cut
192              
193             sub IconStyleWhiteDot {
194 0     0 1   my $self=shift;
195 0           my $opt={@_};
196 0           return $self->IconStyle(color=>$self->white(alpha=>$opt->{"alpha"}), href=>$self->dot);
197             }
198              
199             =head3 IconStyleGrayDot
200              
201             =cut
202              
203             sub IconStyleGrayDot {
204 0     0 1   my $self=shift;
205 0           my $opt={@_};
206 0           return $self->IconStyle(color=>$self->gray(alpha=>$opt->{"alpha"}), href=>$self->dot);
207             }
208              
209             =head3 IconStyleBlackDot
210              
211             =cut
212              
213             sub IconStyleBlackDot {
214 0     0 1   my $self=shift;
215 0           my $opt={@_};
216 0           return $self->IconStyle(color=>$self->black(alpha=>$opt->{"alpha"}), href=>$self->dot);
217             }
218              
219             =head3 IconStylePaddle
220              
221             my $style=$document->IconStylePaddle("paddle-type"); #see paddle method
222              
223             =cut
224              
225             sub IconStylePaddle {
226 0     0 1   my $self=shift;
227 0           my $type=shift;
228 0           return $self->IconStyle(href=>$self->paddle($type));
229             }
230              
231             =head2 LineStyles
232              
233             =head3 LineStyleRed
234              
235             my $style=$document->LineStyleRed(width=>2,
236             alpha=>"90%");
237              
238             =cut
239              
240             sub LineStyleRed {
241 0     0 1   my $self=shift;
242 0           my $opt={@_};
243 0           return $self->LineStyle(width=>$opt->{"width"},
244             color=>$self->red(alpha=>$opt->{"alpha"}));
245             }
246              
247             =head3 LineStyleOrange
248              
249             =cut
250              
251             sub LineStyleOrange {
252 0     0 1   my $self=shift;
253 0           my $opt={@_};
254 0           return $self->LineStyle(width=>$opt->{"width"},
255             color=>$self->orange(alpha=>$opt->{"alpha"}));
256             }
257              
258             =head3 LineStyleYellow
259              
260             =cut
261              
262             sub LineStyleYellow {
263 0     0 1   my $self=shift;
264 0           my $opt={@_};
265 0           return $self->LineStyle(width=>$opt->{"width"},
266             color=>$self->yellow(alpha=>$opt->{"alpha"}));
267             }
268              
269             =head3 LineStyleGreen
270              
271             =cut
272              
273             sub LineStyleGreen {
274 0     0 1   my $self=shift;
275 0           my $opt={@_};
276 0           return $self->LineStyle(width=>$opt->{"width"},
277             color=>$self->green(alpha=>$opt->{"alpha"}));
278             }
279              
280             =head3 LineStyleBlue
281              
282             =cut
283              
284             sub LineStyleBlue {
285 0     0 1   my $self=shift;
286 0           my $opt={@_};
287 0           return $self->LineStyle(width=>$opt->{"width"},
288             color=>$self->blue(alpha=>$opt->{"alpha"}));
289             }
290              
291             =head3 LineStylePurple
292              
293             =cut
294              
295             sub LineStylePurple {
296 0     0 1   my $self=shift;
297 0           my $opt={@_};
298 0           return $self->LineStyle(width=>$opt->{"width"},
299             color=>$self->purple(alpha=>$opt->{"alpha"}));
300             }
301              
302             =head3 LineStyleWhite
303              
304             =cut
305              
306             sub LineStyleWhite {
307 0     0 1   my $self=shift;
308 0           my $opt={@_};
309 0           return $self->LineStyle(width=>$opt->{"width"},
310             color=>$self->white(alpha=>$opt->{"alpha"}));
311             }
312              
313             =head3 LineStyleGray
314              
315             =cut
316              
317             sub LineStyleGray {
318 0     0 1   my $self=shift;
319 0           my $opt={@_};
320 0           return $self->LineStyle(width=>$opt->{"width"},
321             color=>$self->gray(alpha=>$opt->{"alpha"}));
322             }
323              
324             =head3 LineStyleBlack
325              
326             =cut
327              
328             sub LineStyleBlack {
329 0     0 1   my $self=shift;
330 0           my $opt={@_};
331 0           return $self->LineStyle(width=>$opt->{"width"},
332             color=>$self->black(alpha=>$opt->{"alpha"}));
333             }
334              
335             =head2 PolyStyles
336              
337             PolyStyles are AreaStyles with a LineStyle
338              
339             =head3 AreaStyleRed
340              
341             my $style=$document->AreaStyleRed(alpha=>"90%");
342              
343             =cut
344              
345             sub AreaStyleRed {
346 0     0 1   my $self=shift;
347 0           my $opt={@_};
348 0           return $self->PolyStyle(color=>$self->red(alpha=>$opt->{"alpha"}));
349             }
350              
351             =head3 PolyStyleRed
352              
353             my $style=$document->AreaStyleRed(width=>2,
354             alpha=>"90%");
355              
356             =cut
357              
358             sub PolyStyleRed {
359 0     0 1   my $self=shift;
360 0           my $opt={@_};
361 0           return $self->Style(
362             PolyStyle=>$self->AreaStyleRed(alpha=>$opt->{"alpha"}),
363             LineStyle=>$self->LineStyleWhite(width=>$opt->{"width"}),
364             );
365             }
366              
367             =head3 AreaStyleOrange
368              
369             =cut
370              
371             sub AreaStyleOrange {
372 0     0 1   my $self=shift;
373 0           my $opt={@_};
374 0           return $self->PolyStyle(color=>$self->orange(alpha=>$opt->{"alpha"}));
375             }
376              
377             =head3 PolyStyleOrange
378              
379             =cut
380              
381             sub PolyStyleOrange {
382 0     0 1   my $self=shift;
383 0           my $opt={@_};
384 0           return $self->Style(
385             PolyStyle=>$self->AreaStyleOrange(alpha=>$opt->{"alpha"}),
386             LineStyle=>$self->LineStyleWhite(width=>$opt->{"width"}),
387             );
388             }
389              
390             =head3 AreaStyleYellow
391              
392             =cut
393              
394             sub AreaStyleYellow {
395 0     0 1   my $self=shift;
396 0           my $opt={@_};
397 0           return $self->PolyStyle(color=>$self->yellow(alpha=>$opt->{"alpha"}));
398             }
399              
400             =head3 PolyStyleYellow
401              
402             =cut
403              
404             sub PolyStyleYellow {
405 0     0 1   my $self=shift;
406 0           my $opt={@_};
407 0           return $self->Style(
408             PolyStyle=>$self->AreaStyleYellow(alpha=>$opt->{"alpha"}),
409             LineStyle=>$self->LineStyleWhite(width=>$opt->{"width"}),
410             );
411             }
412              
413             =head3 AreaStyleGreen
414              
415             =cut
416              
417             sub AreaStyleGreen {
418 0     0 1   my $self=shift;
419 0           my $opt={@_};
420 0           return $self->PolyStyle(color=>$self->green(alpha=>$opt->{"alpha"}));
421             }
422              
423             =head3 PolyStyleGreen
424              
425             =cut
426              
427             sub PolyStyleGreen {
428 0     0 1   my $self=shift;
429 0           my $opt={@_};
430 0           return $self->Style(
431             PolyStyle=>$self->AreaStyleGreen(alpha=>$opt->{"alpha"}),
432             LineStyle=>$self->LineStyleWhite(width=>$opt->{"width"}),
433             );
434             }
435              
436             =head3 AreaStyleBlue
437              
438             =cut
439              
440             sub AreaStyleBlue {
441 0     0 1   my $self=shift;
442 0           my $opt={@_};
443 0           return $self->PolyStyle(color=>$self->blue(alpha=>$opt->{"alpha"}));
444             }
445              
446             =head3 PolyStyleBlue
447              
448             =cut
449              
450             sub PolyStyleBlue {
451 0     0 1   my $self=shift;
452 0           my $opt={@_};
453 0           return $self->Style(
454             PolyStyle=>$self->AreaStyleBlue(alpha=>$opt->{"alpha"}),
455             LineStyle=>$self->LineStyleWhite(width=>$opt->{"width"}),
456             );
457             }
458              
459             =head3 AreaStylePurple
460              
461             =cut
462              
463             sub AreaStylePurple {
464 0     0 1   my $self=shift;
465 0           my $opt={@_};
466 0           return $self->PolyStyle(color=>$self->purple(alpha=>$opt->{"alpha"}));
467             }
468              
469             =head3 PolyStylePurple
470              
471             =cut
472              
473             sub PolyStylePurple {
474 0     0 1   my $self=shift;
475 0           my $opt={@_};
476 0           return $self->Style(
477             PolyStyle=>$self->AreaStylePurple(alpha=>$opt->{"alpha"}),
478             LineStyle=>$self->LineStyleWhite(width=>$opt->{"width"}),
479             );
480             }
481              
482             =head3 AreaStyleWhite
483              
484             =cut
485              
486             sub AreaStyleWhite {
487 0     0 1   my $self=shift;
488 0           my $opt={@_};
489 0           return $self->PolyStyle(color=>$self->white(alpha=>$opt->{"alpha"}));
490             }
491              
492             =head3 PolyStyleWhite
493              
494             =cut
495              
496             sub PolyStyleWhite {
497 0     0 1   my $self=shift;
498 0           my $opt={@_};
499 0           return $self->Style(
500             PolyStyle=>$self->AreaStyleWhite(alpha=>$opt->{"alpha"}),
501             LineStyle=>$self->LineStyleWhite(width=>$opt->{"width"}),
502             );
503             }
504              
505             =head3 AreaStyleGray
506              
507             =cut
508              
509             sub AreaStyleGray {
510 0     0 1   my $self=shift;
511 0           my $opt={@_};
512 0           return $self->PolyStyle(color=>$self->gray(alpha=>$opt->{"alpha"}));
513             }
514              
515             =head3 PolyStyleGray
516              
517             =cut
518              
519             sub PolyStyleGray {
520 0     0 1   my $self=shift;
521 0           my $opt={@_};
522 0           return $self->Style(
523             PolyStyle=>$self->AreaStyleGray(alpha=>$opt->{"alpha"}),
524             LineStyle=>$self->LineStyleWhite(width=>$opt->{"width"}),
525             );
526             }
527              
528             =head3 AreaStyleBlack
529              
530             =cut
531              
532             sub AreaStyleBlack {
533 0     0 1   my $self=shift;
534 0           my $opt={@_};
535 0           return $self->PolyStyle(color=>$self->black(alpha=>$opt->{"alpha"}));
536             }
537              
538             =head3 PolyStyleBlack
539              
540             =cut
541              
542             sub PolyStyleBlack {
543 0     0 1   my $self=shift;
544 0           my $opt={@_};
545 0           return $self->Style(
546             PolyStyle=>$self->AreaStyleBlack(alpha=>$opt->{"alpha"}),
547             LineStyle=>$self->LineStyleWhite(width=>$opt->{"width"}),
548             );
549             }
550              
551             =head2 Colors
552              
553             All color methods return a hash reference {red=>$R, green=>$G, blue=>$B, alpha=>$A}
554              
555             =head3 red
556              
557             my $color=$document->red(alpha=>"90%"); #Typical call
558              
559             =cut
560              
561             sub red {
562 0     0 1   my $self=shift;
563 0           my $opt={@_};
564 0           return {red=>192, green=>0, blue=>0, alpha=>$opt->{"alpha"}};
565             }
566              
567             =head3 orange
568              
569             =cut
570              
571             sub orange {
572 0     0 1   my $self=shift;
573 0           my $opt={@_};
574 0           return {red=>255, green=>127, blue=>0, alpha=>$opt->{"alpha"}};
575             }
576              
577             =head3 yellow
578              
579             =cut
580              
581             sub yellow {
582 0     0 1   my $self=shift;
583 0           my $opt={@_};
584 0           return {red=>255, green=>255, blue=>0, alpha=>$opt->{"alpha"}};
585             }
586              
587             =head3 green
588              
589             =cut
590              
591             sub green {
592 0     0 1   my $self=shift;
593 0           my $opt={@_};
594 0           return {red=>0, green=>192, blue=>0, alpha=>$opt->{"alpha"}};
595             }
596              
597             =head3 blue
598              
599             =cut
600              
601             sub blue {
602 0     0 1   my $self=shift;
603 0           my $opt={@_};
604 0           return {red=>0, green=>0, blue=>192, alpha=>$opt->{"alpha"}};
605             }
606              
607             =head3 purple
608              
609             =cut
610              
611             sub purple {
612 0     0 1   my $self=shift;
613 0           my $opt={@_};
614 0           return {red=>127, green=>0, blue=>127, alpha=>$opt->{"alpha"}};
615             }
616              
617             =head3 white
618              
619             =cut
620              
621             sub white {
622 0     0 1   my $self=shift;
623 0           my $opt={@_};
624 0           return {red=>255, green=>255, blue=>255, alpha=>$opt->{"alpha"}};
625             }
626              
627             =head3 gray
628              
629             =cut
630              
631             sub gray {
632 0     0 1   my $self=shift;
633 0           my $opt={@_};
634 0           return {red=>192, green=>192, blue=>192, alpha=>$opt->{"alpha"}};
635             }
636              
637             =head3 black
638              
639             =cut
640              
641             sub black {
642 0     0 1   my $self=shift;
643 0           my $opt={@_};
644 0           return {red=>0, green=>0, blue=>0, alpha=>$opt->{"alpha"}};
645             }
646              
647             =head2 Icon URLs
648              
649             All icon methods return a fully qualified url.
650              
651             =head3 dot
652              
653             my $url=$folder->dot;
654              
655             =cut
656              
657             sub dot {
658 0     0 1   my $self=shift;
659 0           return $self->shape("shaded_dot");
660             }
661              
662             =head3 paddle
663              
664             my $url=$folder->paddle;
665             my $url=$folder->paddle("red-circle"); #default
666             my $url=$folder->paddle("A");
667             my $url=$folder->paddle("1");
668             my $url=$folder->paddle("blu-blank");
669              
670             =cut
671              
672             sub paddle {
673 0     0 1   my $self=shift;
674 0   0       my $type=shift || 'red-circle';
675 0           return sprintf("http://maps.google.com/mapfiles/kml/paddle/%s.png", $type);
676             }
677              
678             =head3 shape
679              
680             my $url=$folder->shape;
681             my $url=$folder->shape("placemark_circle"); #default
682              
683             =cut
684              
685             sub shape {
686 0     0 1   my $self=shift;
687 0   0       my $type=shift || 'placemark_circle';
688 0           return sprintf("http://maps.google.com/mapfiles/kml/shapes/%s.png", $type);
689             }
690              
691             =head3 pin
692              
693             my $url=$folder->pin;
694             my $url=$folder->pin("ylw"); #default
695             my $url=$folder->pin("blue");
696             my $url=$folder->pin("grn");
697             my $url=$folder->pin("red");
698              
699             =cut
700              
701             sub pin {
702 0     0 1   my $self=shift;
703 0   0       my $type=shift || 'ylw';
704 0           return sprintf("http://maps.google.com/mapfiles/kml/pushpin/%s-pushpin.png", $type);
705             }
706              
707             =head1 BUGS
708              
709             =head1 SUPPORT
710              
711             Try geo-perl email list
712              
713             =head1 AUTHOR
714              
715             Michael R. Davis
716             CPAN ID: MRDVT
717             STOP, LLC
718             domain=>michaelrdavis,tld=>com,account=>perl
719             http://www.stopllc.com/
720              
721             =head1 COPYRIGHT
722              
723             This program is free software licensed under the...
724              
725             The BSD License
726              
727             The full text of the license can be found in the LICENSE file included with this module.
728              
729             =head1 SEE ALSO
730              
731             L
732              
733             =cut
734              
735             1;