Leaflet/polygon.pm

filter: Statementstmt 100% 18 / 18 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 93.1% 27 / 29 CC 3 SCAR 6.5
CC
3
Cov
91%
coordinates
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« Leaflet/circle.pm ↑ Summary Leaflet/tileLayer.pm »
1 package Geo::Leaflet::polygon;
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::Objects};
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::polygon - Leaflet polygon object
12  
13 =head1 SYNOPSIS
14  
15 use Geo::Leaflet;
16 my $map = Geo::Leaflet->new;
17 my $polygon = $map->polygon(
18 coordinates => [[$lat, $lon], ...]
19 options => {},
20 );
21  
22 =head1 DESCRIPTION
23  
24 This package constructs a Leaflet polygon object for use on a L<Geo::Leaflet> map.
25  
26 =head1 PROPERTIES
27  
28 =head2 coordinates
29  
30 =cut
31  
32 sub coordinates {
33 1 ▶ my $self = shift;
Subroutine coordinates: called CC=3 SCAR=11.4
Pod documented
34 1 ▶ $self->{'coordinates'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 1 1
35 1 ▶ die("Error: coordinates required") unless defined $self->{'coordinates'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"coordinates"} 0 1 1
36 1 return $self->{'coordinates'};
37 }
38  
39 =head2 options
40  
41 =head2 popup
42  
43 =head1 METHODS
44  
45 =head2 stringify
46  
47 =cut
48  
49 sub stringify {
50 1 ▶ my $self = shift;
Subroutine stringify: called CC=1 SCAR=0.0
Pod documented
51 # const polygon = L.polygon([
52 # [51.509, -0.08],
53 # [51.503, -0.06],
54 # [51.51, -0.047]
55 # ]).addTo(map).bindPopup('I am a polygon.');
56 1 return $self->stringify_base($self->coordinates);
57 }
58  
59 =head1 SEE ALSO
60  
61 =head1 AUTHOR
62  
63 Michael R. Davis
64  
65 =head1 COPYRIGHT AND LICENSE
66  
67 Copyright (C) 2024 by Michael R. Davis
68  
69 MIT LICENSE
70  
71 =cut
72  
73 2 1;
« Leaflet/circle.pm ↑ Summary Leaflet/tileLayer.pm »