Leaflet/Polygon.pm

filter: Statementstmt 100% 19 / 19 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 93.5% 29 / 31 CC 3 SCAR 5.9
CC
3
Cov
91%
coordinates
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« 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.04';
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 1 ▶sub coordinates {
Subroutine coordinates: called CC=3 SCAR=11.4
Pod documented
33 1 my $self = shift;
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 1 ▶sub _method_name {'polygon'};
Subroutine _method_name: called CC=1 SCAR=0.0
50  
51 1 ▶sub stringify {
Subroutine stringify: called CC=1 SCAR=0.0
Pod documented
52 1 my $self = shift;
53 # const polygon = L.polygon([
54 # [51.509, -0.08],
55 # [51.503, -0.06],
56 # [51.51, -0.047]
57 # ]).addTo(map).bindPopup('I am a polygon.');
58 1 return $self->stringify_base($self->coordinates);
59 }
60  
61 =head1 SEE ALSO
62  
63 =head1 AUTHOR
64  
65 Michael R. Davis
66  
67 =head1 COPYRIGHT AND LICENSE
68  
69 Copyright (C) 2024 by Michael R. Davis
70  
71 MIT LICENSE
72  
73 =cut
74  
75 2 1;
« Leaflet/Circle.pm ↑ Summary Leaflet/TileLayer.pm »