Leaflet/Circle.pm

filter: Statementstmt 100% 28 / 28 Branchbran 50.0% 6 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 4 / 4 totaltotal 88.4% 46 / 52 CC 7 SCAR 7.9
CC
7
Cov
85%
lat
3.1
lon
3.1
radius
2.0
CRAP 2.2
« Leaflet/Marker.pm ↑ Summary Leaflet/Polygon.pm »
1 package Geo::Leaflet::Circle;
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::Circle - Leaflet circle object
12  
13 =head1 SYNOPSIS
14  
15 use Geo::Leaflet;
16 my $map = Geo::Leaflet->new;
17 my $circle = $map->circle(
18 lat => $lat,
19 lon => $lon,
20 radius => $radius,
21 options => {},
22 );
23  
24 =head1 DESCRIPTION
25  
26 This package constructs a Leaflet circle object for use on a L<Geo::Leaflet> map.
27  
28 =head1 PROPERTIES
29  
30 =head2 lat
31  
32 =cut
33  
34 1 ▶sub lat {
Subroutine lat: called CC=3 SCAR=11.4
Pod documented
35 1 my $self = shift;
36 1 ▶ $self->{'lat'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 1 1
37 1 ▶ die("Error: lat required") unless defined $self->{'lat'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"lat"} 0 1 1
38 1 return $self->{'lat'};
39 }
40  
41 =head2 lon
42  
43 =cut
44  
45 1 ▶sub lon {
Subroutine lon: called CC=3 SCAR=11.4
Pod documented
46 1 my $self = shift;
47 1 ▶ $self->{'lon'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 1 1
48 1 ▶ die("Error: lon required") unless defined $self->{'lon'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"lon"} 0 1 1
49 1 return $self->{'lon'};
50 }
51  
52 =head2 radius
53  
54 =cut
55  
56 2 ▶sub radius {
Subroutine radius: called CC=2 SCAR=7.1
Pod documented
57 2 my $self = shift;
58 2 ▶ $self->{'radius'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
59 2 return $self->{'radius'};
60 }
61  
62 =head2 options
63  
64 =head1 METHODS
65  
66 =head2 stringify
67  
68 =cut
69  
70 1 ▶sub _method_name {'circle'};
Subroutine _method_name: called CC=1 SCAR=0.0
71  
72 1 ▶sub stringify {
Subroutine stringify: called CC=2 SCAR=7.0
Pod documented
73 1 my $self = shift;
74 1 my $options = $self->options;
75 1 ▶ $options->{'radius'} = $self->radius if defined $self->radius; #radius is set in options
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->radius 1 0 1
76 1 return $self->stringify_base([$self->lat, $self->lon]);
77 }
78  
79 =head1 SEE ALSO
80  
81 =head1 AUTHOR
82  
83 Michael R. Davis
84  
85 =head1 COPYRIGHT AND LICENSE
86  
87 Copyright (C) 2024 by Michael R. Davis
88  
89 MIT LICENSE
90  
91 =cut
92  
93 2 1;
« Leaflet/Marker.pm ↑ Summary Leaflet/Polygon.pm »