line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVG::Estimate::Path::Lineto; |
2
|
|
|
|
|
|
|
$SVG::Estimate::Path::Lineto::VERSION = '1.0113'; |
3
|
10
|
|
|
10
|
|
1223
|
use Moo; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
57
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'SVG::Estimate::Path::Command'; |
6
|
|
|
|
|
|
|
with 'SVG::Estimate::Role::Pythagorean'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
SVG::Estimate::Path::Lineto - Handles estimating diagonal lines. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
version 1.0113 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $line = SVG::Estimate::Path::Lineto->new( |
19
|
|
|
|
|
|
|
transformer => $transform, |
20
|
|
|
|
|
|
|
start_point => [13, 19], |
21
|
|
|
|
|
|
|
point => [45,13], |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $length = $line->length; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 INHERITANCE |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This class extends L and consumes L. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 new() |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Constructor. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=over |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item point |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
An array ref containing two floats that represent a point. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=back |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
has point => ( |
47
|
|
|
|
|
|
|
is => 'ro', |
48
|
|
|
|
|
|
|
required => 1, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub BUILDARGS { |
52
|
61
|
|
|
61
|
0
|
12360
|
my ($class, @args) = @_; |
53
|
|
|
|
|
|
|
##Upgrade to hashref |
54
|
61
|
100
|
|
|
|
144
|
my $args = @args % 2 ? $args[0] : { @args }; |
55
|
61
|
|
|
|
|
117
|
my $point = $args->{point}; |
56
|
61
|
100
|
|
|
|
184
|
if ($args->{transformer}->has_transforms) { |
57
|
5
|
|
|
|
|
13
|
$point = $args->{transformer}->transform($point); |
58
|
|
|
|
|
|
|
} |
59
|
61
|
|
|
|
|
915
|
$args->{start_point} = $args->{start_point}; |
60
|
61
|
|
|
|
|
96
|
$args->{end_point} = $point; |
61
|
61
|
100
|
|
|
|
181
|
$args->{min_x} = $args->{start_point}[0] < $point->[0] ? $args->{start_point}[0] : $point->[0]; |
62
|
61
|
100
|
|
|
|
166
|
$args->{min_y} = $args->{start_point}[1] < $point->[1] ? $args->{start_point}[1] : $point->[1]; |
63
|
61
|
100
|
|
|
|
152
|
$args->{max_x} = $args->{start_point}[0] > $point->[0] ? $args->{start_point}[0] : $point->[0]; |
64
|
61
|
100
|
|
|
|
144
|
$args->{max_y} = $args->{start_point}[1] > $point->[1] ? $args->{start_point}[1] : $point->[1]; |
65
|
61
|
|
|
|
|
161
|
$args->{shape_length} = $class->pythagorean($args->{start_point}, $args->{end_point}); |
66
|
61
|
|
|
|
|
86
|
$args->{travel_length} = 0; |
67
|
61
|
|
|
|
|
895
|
return $args; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |