line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVG::Estimate::Path::VerticalLineto; |
2
|
|
|
|
|
|
|
$SVG::Estimate::Path::VerticalLineto::VERSION = '1.0107'; |
3
|
4
|
|
|
4
|
|
819
|
use Moo; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
19
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'SVG::Estimate::Path::Command'; |
6
|
|
|
|
|
|
|
with 'SVG::Estimate::Role::Pythagorean'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
SVG::Estimate::Path::VerticalLineto - Handles estimating vertical lines. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
version 1.0107 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $line = SVG::Estimate::Path::VerticalLineto->new( |
19
|
|
|
|
|
|
|
transformer => $transform, |
20
|
|
|
|
|
|
|
start_point => [13, 19], |
21
|
|
|
|
|
|
|
y => 45, |
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 y |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
A float representing what to change the y value to. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=back |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
has y => ( |
47
|
|
|
|
|
|
|
is => 'ro', |
48
|
|
|
|
|
|
|
required => 1, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub BUILDARGS { |
52
|
2
|
|
|
2
|
0
|
5021
|
my ($class, @args) = @_; |
53
|
|
|
|
|
|
|
##Upgrade to hashref |
54
|
2
|
50
|
|
|
|
9
|
my $args = @args % 2 ? $args[0] : { @args }; |
55
|
2
|
|
|
|
|
4
|
my $end = [$args->{start_point}[0], $args->{y}]; |
56
|
2
|
100
|
|
|
|
10
|
if ($args->{transformer}->has_transforms) { |
57
|
1
|
|
|
|
|
4
|
$end = $args->{transformer}->transform($end); |
58
|
|
|
|
|
|
|
} |
59
|
2
|
|
|
|
|
486
|
$args->{end_point} = [$args->{start_point}[0], $end->[1]]; |
60
|
2
|
|
|
|
|
4
|
$args->{y} = $args->{end_point}[1]; |
61
|
2
|
|
|
|
|
6
|
$args->{shape_length} = $class->pythagorean($args->{start_point}, $args->{end_point}); |
62
|
2
|
|
|
|
|
3
|
$args->{travel_length} = 0; |
63
|
2
|
50
|
|
|
|
5
|
$args->{min_x} = $args->{start_point}[0] < $args->{end_point}->[0] ? $args->{start_point}[0] : $args->{end_point}->[0]; |
64
|
2
|
50
|
|
|
|
7
|
$args->{min_y} = $args->{start_point}[1] < $args->{end_point}->[1] ? $args->{start_point}[1] : $args->{end_point}->[1]; |
65
|
2
|
50
|
|
|
|
5
|
$args->{max_x} = $args->{start_point}[0] > $args->{end_point}->[0] ? $args->{start_point}[0] : $args->{end_point}->[0]; |
66
|
2
|
50
|
|
|
|
5
|
$args->{max_y} = $args->{start_point}[1] > $args->{end_point}->[1] ? $args->{start_point}[1] : $args->{end_point}->[1]; |
67
|
2
|
|
|
|
|
34
|
return $args; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |