Leaflet/TileLayer.pm

filter: Statementstmt 100% 21 / 21 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 94.2% 33 / 35 CC 3 SCAR 5.4
CC
3
Cov
92%
url
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« 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.04';
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 2 ▶sub osm {
Subroutine osm: called CC=1 SCAR=0.0
Pod documented
44 2 my $self = shift;
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 1 ▶sub url {
Subroutine url: called CC=3 SCAR=11.4
Pod documented
62 1 my $self = shift;
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 1 ▶sub _method_name {'tileLayer'};
Subroutine _method_name: called CC=1 SCAR=0.0
75  
76 1 ▶sub stringify {
Subroutine stringify: called CC=1 SCAR=0.0
Pod documented
77 1 my $self = shift;
78 #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);
79 1 return $self->stringify_base($self->url);
80 }
81  
82 =head1 SEE ALSO
83  
84 =head1 AUTHOR
85  
86 Michael R. Davis
87  
88 =head1 COPYRIGHT AND LICENSE
89  
90 Copyright (C) 2024 by Michael R. Davis
91  
92 MIT LICENSE
93  
94 =cut
95  
96 2 1;
« Leaflet/Polygon.pm ↑ Summary Leaflet/Objects.pm »