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.0107';
3 8     8   2738 use Moo;
  8         7  
  8         34  
4 8     8   1438 use Math::Trig qw/pi/;
  8         9  
  8         335  
5 8     8   2774 use Clone qw/clone/;
  8         15042  
  8         825  
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.0107
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 @points = $self->$orig(@_);
38             push @points, $points[0];
39             return @points
40             };
41              
42             1;