Leaflet/tileLayer.pm

filter: Statementstmt 100% 20 / 20 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 3 / 3 totaltotal 93.9% 31 / 33 CC 3 SCAR 5.9
CC
3
Cov
92%
url
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Leaflet/polygon.pm ↑ Summary Leaflet/Objects.pm »
1 package Geo::Leaflet::tileLayer;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use base qw{Geo::Leaflet::Base};
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '0.03';
7 2 our $PACKAGE = __PACKAGE__;
8  
9 =head1 NAME
10  
11 Geo::Leaflet::tileLayer - Leaflet tileLayer Object
12  
13 =head1 SYNOPSIS
14  
15 use Geo::Leaflet;
16 my $map = Geo::Leaflet->new;
17 my $tileLayer = $map->tileLayer(
18 url => 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
19 options => {
20 maxZoom => 19,
21 attribution => '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
22 }
23 );
24  
25 =head1 DESCRIPTION
26  
27 This package constructs a Leaflet tileLayer object for use on a L<Geo::Leaflet> map.
28  
29 =head1 CONSTRUCTORS
30  
31 =head2 new
32  
33 Returns a tileLayer object
34  
35 =head2 osm
36  
37 Returns the default OpenStreetMaps.org tileLayer.
38  
39 my $tileLayer = Geo::Leaflet::tileLayer->osm;
40  
41 =cut
42  
43 sub osm {
44 2 ▶ my $self = shift;
Subroutine osm: called CC=1 SCAR=0.0
Pod documented
45 2 return $self->new(
46 url => 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
47 options => {
48 maxZoom => 19,
49 attribution => '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
50 },
51 @_,
52 );
53 }
54  
55 =head1 PROPERTIES
56  
57 =head2 url
58  
59 =cut
60  
61 sub url {
62 1 ▶ my $self = shift;
Subroutine url: called CC=3 SCAR=11.4
Pod documented
63 1 ▶ $self->{'url'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 1 1
64 1 ▶ die("Error: url required") unless $self->{'url'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"url"} 0 1 1
65 1 return $self->{'url'};
66 }
67  
68 =head1 METHODS
69  
70 =head2 stringify
71  
72 =cut
73  
74 sub stringify {
75 1 ▶ my $self = shift;
Subroutine stringify: called CC=1 SCAR=0.0
Pod documented
76 #L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);
77 1 return $self->stringify_base($self->url);
78 }
79  
80 =head1 SEE ALSO
81  
82 =head1 AUTHOR
83  
84 Michael R. Davis
85  
86 =head1 COPYRIGHT AND LICENSE
87  
88 Copyright (C) 2024 by Michael R. Davis
89  
90 MIT LICENSE
91  
92 =cut
93  
94 2 1;
« Leaflet/polygon.pm ↑ Summary Leaflet/Objects.pm »