File Coverage

lib/SVG/Estimate/Polygon.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package SVG::Estimate::Polygon;
2             $SVG::Estimate::Polygon::VERSION = '1.0113';
3 14     14   3434 use Moo;
  14         24  
  14         80  
4 14     14   4007 use Math::Trig qw/pi/;
  14         25  
  14         753  
5 14     14   5002 use Clone qw/clone/;
  14         29141  
  14         1536  
6              
7             extends 'SVG::Estimate::Polyline';
8              
9             =head1 NAME
10              
11             SVG::Estimate::Polygon - Handles estimating shapes of more than 3 points with straight lines between the points.
12              
13             =head1 VERSION
14              
15             version 1.0113
16              
17             =head1 SYNOPSIS
18              
19             my $polygon = SVG::Estimate::Polygon->new(
20             transformer => $transform,
21             start_point => [45,13],
22             points => '20,20 40,25 60,40 80,120 120,140 200,180',
23             );
24              
25             my $length = $polygon->length;
26              
27             =head1 INHERITANCE
28              
29             This class extends L.
30              
31             =cut
32              
33             ##Take the first pair, and make it the last to close the shape.
34             around _get_pairs => sub {
35             my $orig = shift;
36             my $self = shift;
37             my @pairs = $self->$orig(@_);
38             push @pairs, $pairs[0];
39             return @pairs
40             };
41              
42             1;