File Coverage

blib/lib/Geo/Leaflet/Rectangle.pm
Criterion Covered Total %
statement 9 28 32.1
branch 0 16 0.0
condition n/a
subroutine 3 9 33.3
pod 5 5 100.0
total 17 58 29.3


line stmt bran cond sub pod time code
1             package Geo::Leaflet::Rectangle;
2 2     2   12 use strict;
  2         2  
  2         162  
3 2     2   13 use warnings;
  2         3  
  2         89  
4 2     2   8 use base qw{Geo::Leaflet::Objects};
  2         2  
  2         752  
5              
6             our $VERSION = '0.04';
7             our $PACKAGE = __PACKAGE__;
8              
9             =head1 NAME
10              
11             Geo::Leaflet::Rectangle - Leaflet rectangle object
12              
13             =head1 SYNOPSIS
14              
15             use Geo::Leaflet;
16             my $map = Geo::Leaflet->new;
17             my $rectangle = $map->rectangle(
18             llat => $llat,
19             llon => $llon,
20             ulat => $ulat,
21             ulon => $ulon,
22             options => {},
23             );
24              
25             =head1 DESCRIPTION
26              
27             This package constructs a Leaflet rectangle object for use on a L map.
28              
29             =head1 PROPERTIES
30              
31             =head2 llat
32              
33             =cut
34              
35             sub llat {
36 0     0 1   my $self = shift;
37 0 0         $self->{'llat'} = shift if @_;
38 0 0         die("Error: llat required") unless defined $self->{'llat'};
39 0           return $self->{'llat'};
40             }
41              
42             =head2 llon
43              
44             =cut
45              
46             sub llon {
47 0     0 1   my $self = shift;
48 0 0         $self->{'llon'} = shift if @_;
49 0 0         die("Error: llon required") unless defined $self->{'llon'};
50 0           return $self->{'llon'};
51             }
52              
53             =head2 ulat
54              
55             =cut
56              
57             sub ulat {
58 0     0 1   my $self = shift;
59 0 0         $self->{'ulat'} = shift if @_;
60 0 0         die("Error: ulat required") unless defined $self->{'ulat'};
61 0           return $self->{'ulat'};
62             }
63              
64             =head2 ulon
65              
66             =cut
67              
68             sub ulon {
69 0     0 1   my $self = shift;
70 0 0         $self->{'ulon'} = shift if @_;
71 0 0         die("Error: ulon required") unless defined $self->{'ulon'};
72 0           return $self->{'ulon'};
73             }
74              
75             =head2 options
76              
77             =head2 popup
78              
79             =head1 METHODS
80              
81             =head2 stringify
82              
83             =cut
84              
85 0     0     sub _method_name {'rectangle'};
86              
87             sub stringify {
88 0     0 1   my $self = shift;
89             #L.rectangle([[54.559322, -5.767822], [56.1210604, -3.021240]], {color: "#ff7800", weight: 1}).addTo(map);
90 0           return $self->stringify_base([[$self->llat, $self->llon], [$self->ulat, $self->ulon]]);
91             }
92              
93             =head1 SEE ALSO
94              
95             =head1 AUTHOR
96              
97             Michael R. Davis
98              
99             =head1 COPYRIGHT AND LICENSE
100              
101             Copyright (C) 2024 by Michael R. Davis
102              
103             MIT LICENSE
104              
105             =cut
106              
107             1;