line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#_{ Encoding and name |
2
|
|
|
|
|
|
|
=encoding utf8 |
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Grid::Layout::Area |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=cut |
8
|
|
|
|
|
|
|
#_} |
9
|
|
|
|
|
|
|
package Grid::Layout::Area; |
10
|
|
|
|
|
|
|
#_{ use … |
11
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
52
|
|
12
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
35
|
|
13
|
2
|
|
|
2
|
|
7
|
use utf8; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
7
|
|
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
34
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
763
|
|
16
|
|
|
|
|
|
|
#_} |
17
|
|
|
|
|
|
|
our $VERSION = 0.01; |
18
|
|
|
|
|
|
|
#_{ Synopsis |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
#_} |
23
|
|
|
|
|
|
|
#_{ Description |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
A C<< Grid::Layout::Area >> is bound by 2 different horizontal L<< Grid::Layout::Line >>s and |
28
|
|
|
|
|
|
|
2 different vertical L<< Grid::Layout::Line >>s. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Thus, it's I is at least one L<< Grid::Layout::Cell >> and an exact integer multiple |
31
|
|
|
|
|
|
|
of L<< Grid::Layout::Cell >>s. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
#_} |
35
|
|
|
|
|
|
|
#_{ Methods |
36
|
|
|
|
|
|
|
#_{ POD |
37
|
|
|
|
|
|
|
=head1 METHODS |
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
#_} |
40
|
|
|
|
|
|
|
sub new { #_{ |
41
|
|
|
|
|
|
|
#_{ POD |
42
|
|
|
|
|
|
|
=head2 new |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
#_} |
47
|
|
|
|
|
|
|
|
48
|
5
|
|
|
5
|
0
|
7
|
my $class = shift; |
49
|
5
|
|
|
|
|
6
|
my $track_v_from = shift; |
50
|
5
|
|
|
|
|
7
|
my $track_h_from = shift; |
51
|
5
|
|
|
|
|
6
|
my $track_v_to = shift; |
52
|
5
|
|
|
|
|
6
|
my $track_h_to = shift; |
53
|
|
|
|
|
|
|
|
54
|
5
|
50
|
|
|
|
22
|
croak 'track_v_from is not a Grid::Layout::Track' unless $track_v_from->isa('Grid::Layout::Track'); |
55
|
5
|
50
|
|
|
|
10
|
croak 'track_v_to is not a Grid::Layout::Track' unless $track_v_to ->isa('Grid::Layout::Track'); |
56
|
5
|
50
|
|
|
|
11
|
croak 'track_h_from is not a Grid::Layout::Track' unless $track_h_from->isa('Grid::Layout::Track'); |
57
|
5
|
50
|
|
|
|
10
|
croak 'track_h_to is not a Grid::Layout::Track' unless $track_h_to ->isa('Grid::Layout::Track'); |
58
|
|
|
|
|
|
|
|
59
|
5
|
50
|
|
|
|
10
|
croak 'track_v_from is not a vertical' unless $track_v_from->{V_or_H} eq 'V'; |
60
|
5
|
50
|
|
|
|
9
|
croak 'track_v_to is not a vertical' unless $track_v_to ->{V_or_H} eq 'V'; |
61
|
5
|
50
|
|
|
|
16
|
croak 'track_h_from is not a vertical' unless $track_h_from->{V_or_H} eq 'H'; |
62
|
5
|
50
|
|
|
|
8
|
croak 'track_h_to is not a vertical' unless $track_h_to ->{V_or_H} eq 'H'; |
63
|
|
|
|
|
|
|
|
64
|
5
|
|
|
|
|
7
|
my $self = {}; |
65
|
|
|
|
|
|
|
|
66
|
5
|
|
|
|
|
14
|
$self->{track}{'V'}{from} = $track_v_from; |
67
|
5
|
|
|
|
|
7
|
$self->{track}{'V'}{to } = $track_v_to ; |
68
|
5
|
|
|
|
|
8
|
$self->{track}{'H'}{from} = $track_h_from; |
69
|
5
|
|
|
|
|
7
|
$self->{track}{'H'}{to } = $track_h_to ; |
70
|
|
|
|
|
|
|
|
71
|
5
|
|
|
|
|
8
|
bless $self, $class; |
72
|
|
|
|
|
|
|
|
73
|
5
|
|
|
|
|
9
|
return $self; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
} #_} |
76
|
|
|
|
|
|
|
#_{ x/y_from/to |
77
|
|
|
|
|
|
|
sub x_from { #_{ |
78
|
|
|
|
|
|
|
#_{ POD |
79
|
|
|
|
|
|
|
=head2 x_from |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
#_} |
83
|
|
|
|
|
|
|
|
84
|
34
|
|
|
34
|
0
|
7776
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
34
|
|
|
|
|
136
|
return $self->{track}{V}{from}->{position}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
#_} |
89
|
|
|
|
|
|
|
sub x_to { #_{ |
90
|
|
|
|
|
|
|
#_{ POD |
91
|
|
|
|
|
|
|
=head2 x_to |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
#_} |
95
|
|
|
|
|
|
|
|
96
|
8
|
|
|
8
|
0
|
16
|
my $self = shift; |
97
|
|
|
|
|
|
|
|
98
|
8
|
|
|
|
|
35
|
return $self->{track}{V}{to}->{position}; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
#_} |
101
|
|
|
|
|
|
|
sub y_from { #_{ |
102
|
|
|
|
|
|
|
#_{ POD |
103
|
|
|
|
|
|
|
=head2 y_from |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
#_} |
107
|
|
|
|
|
|
|
|
108
|
21
|
|
|
21
|
0
|
49
|
my $self = shift; |
109
|
|
|
|
|
|
|
|
110
|
21
|
|
|
|
|
68
|
return $self->{track}{H}{from}->{position}; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
#_} |
113
|
|
|
|
|
|
|
sub y_to { #_{ |
114
|
|
|
|
|
|
|
#_{ POD |
115
|
|
|
|
|
|
|
=head2 y_to |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
#_} |
119
|
|
|
|
|
|
|
|
120
|
8
|
|
|
8
|
0
|
14
|
my $self = shift; |
121
|
|
|
|
|
|
|
|
122
|
8
|
|
|
|
|
31
|
return $self->{track}{H}{to}->{position}; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
#_} |
125
|
|
|
|
|
|
|
#_} |
126
|
|
|
|
|
|
|
#_{ width/height |
127
|
|
|
|
|
|
|
sub width { #_{ |
128
|
|
|
|
|
|
|
#_{ POD |
129
|
|
|
|
|
|
|
=head2 width |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
132
|
|
|
|
|
|
|
#_} |
133
|
6
|
|
|
6
|
0
|
31
|
my $self = shift; |
134
|
6
|
|
|
|
|
17
|
return $self->x_to - $self->x_from+1; |
135
|
|
|
|
|
|
|
} #_} |
136
|
|
|
|
|
|
|
sub height { #_{ |
137
|
|
|
|
|
|
|
#_{ POD |
138
|
|
|
|
|
|
|
=head2 height |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
#_} |
142
|
6
|
|
|
6
|
0
|
25
|
my $self = shift; |
143
|
6
|
|
|
|
|
16
|
return $self->y_to - $self->y_from +1; |
144
|
|
|
|
|
|
|
} #_} |
145
|
|
|
|
|
|
|
#_} |
146
|
|
|
|
|
|
|
#_} |
147
|
|
|
|
|
|
|
#_{ POD: Copyright |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 Copyright |
150
|
|
|
|
|
|
|
Copyright © 2017 René Nyffenegger, Switzerland. All rights reserved. |
151
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
152
|
|
|
|
|
|
|
under the terms of the the Artistic License (2.0). You may obtain a |
153
|
|
|
|
|
|
|
copy of the full license at: L |
154
|
|
|
|
|
|
|
=cut |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
#_} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
'tq84'; |