lib/App/Asciio/stripes/angled_arrow.pm

filter: Statementstmt 85.8% 316 / 368 Branchbran 70.1% 73 / 104 Conditioncond 4.7% 1 / 21 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 72.9% 27 / 37 Podpod 0.0% 0 / 27 totaltotal 73.2% 417 / 569 CC 91 SCAR 25.5
CC
91
Cov
79%
resize
72.0
get_selection_action
30.0
get_named_connection
30.0
CRAP 12.8
« blib/lib/App/Asciio/Actions/Arrow.pm ↑ Summary blib/lib/App/Asciio/Text/Asciio/Menues.pm »
1  
2 package App::Asciio::stripes::angled_arrow ;
3  
4 1 ▶use base App::Asciio::stripes::stripes ;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use List::Util qw(min max) ;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Readonly ;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 #-----------------------------------------------------------------------------
13  
14 1 Readonly my $DEFAULT_ARROW_TYPE=>
15 # name: $start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection
16 [
17 ['origin' , '*', '?', '?', '?', '?', '?', '?', 1],
18 ['up' , "'", '|', '?', '?', '.', '?', '?', 1],
19 ['down' , '.', '|', '?', '?', "'", '?', '?', 1],
20 ['left' , '-', '-', '?', '?', '-', '?', '?', 1],
21 ['right' , '-', '-', '?', '?', '-', '?', '?', 1],
22 ['up-left' , "'", '\\', '.', '-', '-', '|', "'", 1],
23 ['left-up' , '-', '\\', "'", '-', '.', '|', "'", 1],
24 ['down-left' , '.', '/', "'", '-', '-', '|', "'", 1],
25 ['left-down' , '-', '/', '.', '-', "'", '|', "'", 1],
26 ['up-right' , "'", '/', '.', '-', '-', '|', "'", 1],
27 ['right-up' , '-', '/', "'", '-', '.', '|', "'", 1],
28 ['down-right' , '.', '\\', "'", '-', '-', '|', "'", 1],
29 ['right-down' , '-', '\\', '.', '-', "'", '|', "'", 1],
30 ] ;
31  
32 #-----------------------------------------------------------------------------
33  
34 sub new
35 73 ▶{
Subroutine new: called CC=2 SCAR=7.4
Pod undocumented
36 73 my ($class, $element_definition) = @_ ;
37  
38 73 my $self = bless {}, __PACKAGE__ ;
39  
40 $self->setup
41 (
42 $element_definition->{ARROW_TYPE} || $DEFAULT_ARROW_TYPE,
43 $element_definition->{END_X}, $element_definition->{END_Y},
44 $element_definition->{DIRECTION},
45 $element_definition->{EDITABLE},
46 73 ▶ ) ;
Condition33%1/3
$element_definition->{'ARROW_TYPE'} || $DEFAULT_ARROW_TYPE
l!l&&r!l&&!r
7300
MC/DC0%0/2
$element_definition->{'ARROW_TYPE'} || $DEFAULT_ARROW_TYPE
$element_definition->{'ARROW_TYPE'} $DEFAULT_ARROW_TYPE
Truth table33%1/3
A || B
A= $element_definition->{'ARROW_TYPE'}B= $DEFAULT_ARROW_TYPE
ABresult
1X1
011
000
47  
48 73 return $self ;
49 }
50  
51 #-----------------------------------------------------------------------------
52  
53 sub setup
54 73 ▶{
Subroutine setup: called CC=3 SCAR=11.0
Pod undocumented
55 73 my ($self, $arrow_type, $end_x, $end_y, $direction, $editable) = @_ ;
56  
57 my $glyphs =
58 {
59 # name => [$start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection]
60 73 $arrow_type->[0][0] => [@{$arrow_type->[0]}[1..7]],
61 73 $arrow_type->[1][0] => [@{$arrow_type->[1]}[1..7]],
62 73 $arrow_type->[2][0] => [@{$arrow_type->[2]}[1..7]],
63 73 $arrow_type->[3][0] => [@{$arrow_type->[3]}[1..7]],
64 73 $arrow_type->[4][0] => [@{$arrow_type->[4]}[1..7]],
65 73 $arrow_type->[5][0] => [@{$arrow_type->[5]}[1..7]],
66 73 $arrow_type->[6][0] => [@{$arrow_type->[6]}[1..7]],
67 73 $arrow_type->[7][0] => [@{$arrow_type->[7]}[1..7]],
68 73 $arrow_type->[8][0] => [@{$arrow_type->[8]}[1..7]],
69 73 $arrow_type->[9][0] => [@{$arrow_type->[9]}[1..7]],
70 73 $arrow_type->[10][0] => [@{$arrow_type->[10]}[1..7]],
71 73 $arrow_type->[11][0] => [@{$arrow_type->[11]}[1..7]],
72 73 $arrow_type->[12][0] => [@{$arrow_type->[12]}[1..7]],
73 } ;
74  
75 73 (my ($stripes, $width, $height), $direction) = get_arrow($glyphs, $end_x, $end_y, $direction) ;
76  
77 73 my ($ex1, $ey1, $ex2, $ey2) ;
78  
79 73 ▶if ($end_x < 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x < 0) { } 31 42 73
80 {
81 31 $ex1 = $end_x ;
82 31 $ex2 = 1 ;
83 }
84 else
85 {
86 42 $ex1 = 0 ;
87 42 $ex2 = $end_x + 1 ;
88 }
89  
90 73 ▶if ($end_y < 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($end_y < 0) { } 35 38 73
91 {
92 35 $ey1 = $end_y ;
93 35 $ey2 = 1 ;
94 }
95 else
96 {
97 38 $ey1 = 0 ;
98 38 $ey2 = $end_y + 1 ;
99 }
100  
101 73 $self->set
102 (
103 GLYPHS => $glyphs,
104 ARROW_TYPE => $arrow_type,
105 STRIPES => $stripes,
106 WIDTH => $width,
107 HEIGHT => $height,
108 DIRECTION => $direction,
109 END_X => $end_x,
110 END_Y => $end_y,
111 EXTENTS => [$ex1, $ey1, $ex2, $ey2],
112 ) ;
113 }
114  
115 #-----------------------------------------------------------------------------
116  
117 1 my %direction_to_arrow =
118 (
119 'origin' => \&draw_origin,
120 'up' => \&draw_up,
121 'down' => \&draw_down,
122 'left' => \&draw_left,
123 'up-left' => \&draw_upleft,
124 'left-up' => \&draw_leftup,
125 'down-left' => \&draw_downleft,
126 'left-down' => \&draw_leftdown,
127 'right' => \&draw_right,
128 'up-right' => \&draw_upright,
129 'right-up' => \&draw_rightup,
130 'down-right' => \&draw_downright,
131 'right-down' => \&draw_rightdown,
132 ) ;
133  
134 sub get_arrow
135 73 ▶{
Subroutine get_arrow: called CC=9 SCAR=22.0
Pod undocumented
136 73 my ($glyphs, $end_x, $end_y, $direction) = @_ ;
137  
138 1 ▶use constant CENTER => 1 ;
Subroutine BEGIN: called CC=1 SCAR=0.0
139 1 ▶use constant LEFT => 0 ;
Subroutine BEGIN: called CC=1 SCAR=0.0
140 1 ▶use constant RIGHT => 2 ;
Subroutine BEGIN: called CC=1 SCAR=0.0
141 1 ▶use constant UP => 0 ;
Subroutine BEGIN: called CC=1 SCAR=0.0
142 1 ▶use constant DOWN => 2 ;
Subroutine BEGIN: called CC=1 SCAR=0.0
143  
144 73 ▶my @position_to_direction =
Branch: 4 branches
BranchTrueFalseTotal
$direction =~ /^up/ ? : 25 48 73
$direction =~ /^down/ ? : 16 57 73
$direction =~ /^up/ ? : 25 48 73
$direction =~ /^down/ ? : 16 57 73
145 (
146 [$direction =~ /^up/ ? 'up-left' : 'left-up', 'left', $direction =~ /^down/ ? 'down-left' : 'left-down'] ,
147 ['up', 'origin', 'down'],
148 [$direction =~ /^up/ ? 'up-right' : 'right-up', 'right', $direction =~ /^down/ ? 'down-right' : 'right-down'],
149 ) ;
150  
151 73 ▶$direction = $position_to_direction
Branch: 4 branches
BranchTrueFalseTotal
$end_x == 0 ? : 9 64 73
$end_x < 0 ? : 31 33 64
$end_y == 0 ? : 6 67 73
$end_y < 0 ? : 35 32 67
152 [$end_x == 0 ? CENTER : $end_x < 0 ? LEFT : RIGHT]
153 [$end_y == 0 ? CENTER : $end_y < 0 ? UP : DOWN] ;
154  
155 73 my $drawing_sub = $direction_to_arrow{$direction} ;
156
157 73 return($drawing_sub->($glyphs, $end_x, $end_y), $direction) ;
158 }
159  
160 #--------------------------------------------------------------------------------------------------------------
161  
162 sub draw_origin
163 1 ▶{
Subroutine draw_origin: called CC=1 SCAR=0.0
Pod undocumented
164 1 my ($glyphs, $end_x, $end_y) = @_ ;
165  
166 1 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{origin}} ;
167  
168 1 my ($stripes, $width, $height) = ([], 1, 1) ;
169  
170 1 push @{$stripes},
171 {
172 'HEIGHT' => 1,
173 'TEXT' => $start,
174 'WIDTH' => 1,
175 'X_OFFSET' => 0,
176 'Y_OFFSET' => 0,
177 } ;
178  
179 1 return($stripes, $width, $height) ;
180 }
181  
182 #--------------------------------------------------------------------------------------------------------------
183  
184 sub draw_up
185 4 ▶{
Subroutine draw_up: called CC=2 SCAR=6.9
Pod undocumented
186 4 my ($glyphs, $end_x, $end_y) = @_ ;
187  
188 4 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{up}} ;
189  
190 4 my ($width, $height) = ( $end_x + 1, -$end_y + 1) ;
191  
192 4 my @stripes ;
193  
194 4 push @stripes,
195 {
196 'HEIGHT' => 1,
197 'TEXT' => $start,
198 'WIDTH' => 1,
199 'X_OFFSET' => 0,
200 'Y_OFFSET' => 0,
201 } ;
202  
203 4 for(1 .. $height - 1)
204 {
205 16 push @stripes,
206 {
207 'HEIGHT' => 1,
208 'TEXT' => $body,
209 'WIDTH' => 1,
210 'X_OFFSET' => 0,
211 'Y_OFFSET' => -$_,
212 };
213 }
214  
215 4 push @stripes,
216 {
217 'HEIGHT' => 1,
218 'TEXT' => $end,
219 'WIDTH' => 1,
220 'X_OFFSET' => 0,
221 'Y_OFFSET' => $end_y,
222 } ;
223  
224 4 return(\@stripes, $width, $height) ;
225 }
226  
227 #--------------------------------------------------------------------------------------------------------------
228  
229 sub draw_down
230 4 ▶{
Subroutine draw_down: called CC=2 SCAR=6.9
Pod undocumented
231 4 my ($glyphs, $end_x, $end_y) = @_ ;
232  
233 4 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{down}} ;
234  
235 4 my ($width, $height) = ( $end_x + 1, $end_y + 1) ;
236  
237 4 my @stripes ;
238  
239 4 push @stripes,
240 {
241 'HEIGHT' => 1,
242 'TEXT' => $start,
243 'WIDTH' => 1,
244 'X_OFFSET' => 0,
245 'Y_OFFSET' => 0,
246 } ;
247  
248 4 for(1 .. $height - 1)
249 {
250 16 push @stripes,
251 {
252 'HEIGHT' => 1,
253 'TEXT' => $body,
254 'WIDTH' => 1,
255 'X_OFFSET' => 0,
256 'Y_OFFSET' => $_,
257 } ;
258 }
259  
260 4 push @stripes,
261 {
262 'HEIGHT' => 1,
263 'TEXT' => $end,
264 'WIDTH' => 1,
265 'X_OFFSET' => 0,
266 'Y_OFFSET' => $end_y,
267 } ;
268  
269 4 return(\@stripes, $width, $height) ;
270 }
271  
272 #--------------------------------------------------------------------------------------------------------------
273  
274 sub draw_left
275 3 ▶{
Subroutine draw_left: called CC=1 SCAR=0.0
Pod undocumented
276 3 my ($glyphs, $end_x, $end_y) = @_ ;
277  
278 3 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{left}} ;
279  
280 3 my ($width, $height) = ( -$end_x + 1, $end_y + 1) ;
281  
282 3 my @stripes ;
283  
284 3 my $stripe = $end . ($body x ( -$end_x - 1)) . $start ;
285 3 push @stripes,
286 {
287 'HEIGHT' => 1,
288 'TEXT' => $stripe,
289 'WIDTH' => length($stripe),
290 'X_OFFSET' => $end_x,
291 'Y_OFFSET' => 0,
292 } ;
293  
294 3 return(\@stripes, $width, $height) ;
295 }
296  
297 #--------------------------------------------------------------------------------------------------------------
298  
299 sub draw_right
300 2 ▶{
Subroutine draw_right: called CC=1 SCAR=0.0
Pod undocumented
301 2 my ($glyphs, $end_x, $end_y) = @_ ;
302  
303 2 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{right}} ;
304  
305 2 my ($width, $height) = ($end_x + 1, $end_y + 1) ;
306  
307 2 my @stripes ;
308  
309 2 my $stripe = $start . ($body x ($end_x - 1)) . $end ;
310 2 push @stripes,
311 {
312 'HEIGHT' => 1,
313 'TEXT' => $stripe,
314 'WIDTH' => length($stripe),
315 'X_OFFSET' => 0,
316 'Y_OFFSET' => 0,
317 } ;
318  
319 2 return(\@stripes, $width, $height) ;
320 }
321  
322 #--------------------------------------------------------------------------------------------------------------
323  
324 sub draw_upright
325 10 ▶{
Subroutine draw_upright: called CC=9 SCAR=22.0
Pod undocumented
326 10 my ($glyphs, $end_x, $end_y) = @_ ;
327 10 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'up-right'}} ;
328  
329 10 my ($width, $height) = ( $end_x + 1, -$end_y + 1) ;
330  
331 10 my ($position_x, $position_y) = (0, 0) ;
332 10 my @stripes ;
333  
334 #~ require Enbugger ;
335 #~ Enbugger->stop ;
336  
337 10 ▶if($end_x >= -$end_y) # enought horizontal length to have a proper diagonal up
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x >= -$end_y) 7 3 10
338 {
339 7 push @stripes,
340 {
341 'HEIGHT' => 1,
342 'TEXT' => $start,
343 'WIDTH' => 1,
344 'X_OFFSET' => $position_x++, # diagonal
345 'Y_OFFSET' => $position_y--, # diagonal
346 } ;
347
348 7 for(-$position_y .. (-$end_y - 1))
349 {
350 13 push @stripes,
351 {
352 'HEIGHT' => 1,
353 'TEXT' => $body,
354 'WIDTH' => 1,
355 'X_OFFSET' => $position_x++, # diagonal
356 'Y_OFFSET' => $position_y--, # diagonal
357 } ;
358 }
359
360 7 push @stripes,
361 {
362 'HEIGHT' => 1,
363 'TEXT' => $connection,
364 'WIDTH' => 1,
365 'X_OFFSET' => $position_x++, # going right
366 'Y_OFFSET' => $position_y, # staying horizontal
367 } ;
368
369 7 ▶ if($end_x > -$end_y)
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x > -$end_y) 4 3 7
370 {
371 4 for($position_x .. ($end_x - 1))
372 {
373 3 push @stripes,
374 {
375 'HEIGHT' => 1,
376 'TEXT' => $body_2,
377 'WIDTH' => 1,
378 'X_OFFSET' => $position_x++, # going right
379 'Y_OFFSET' => $position_y, # staying horizontal
380 } ;
381 }
382
383 4 push @stripes,
384 {
385 'HEIGHT' => 1,
386 'TEXT' => $end,
387 'WIDTH' => 1,
388 'X_OFFSET' => $position_x, # finished
389 'Y_OFFSET' => $position_y, # finished
390 } ;
391 }
392 }
393  
394 10 ▶if($end_x < -$end_y) # not enought horizontal length to have a proper diagonal up
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x < -$end_y) 3 7 10
395 {
396 3 my $number_of_verticals = ($height - $width) - 1 ;
397
398 3 push @stripes,
399 {
400 'HEIGHT' => 1,
401 'TEXT' => $start,
402 'WIDTH' => 1,
403 'X_OFFSET' => $position_x,
404 'Y_OFFSET' => $position_y--, # up
405 } ;
406
407 3 for(1 .. $number_of_verticals)
408 {
409 3 push @stripes,
410 {
411 'HEIGHT' => 1,
412 'TEXT' => $vertical,
413 'WIDTH' => 1,
414 'X_OFFSET' => $position_x,
415 'Y_OFFSET' => $position_y--,
416 } ;
417 }
418
419 3 ▶ push @stripes,
Branch: 1 branch
BranchTrueFalseTotal
if $end_x != 0 3 0 3
420 {
421 'HEIGHT' => 1,
422 'TEXT' => $diagonal_connection,
423 'WIDTH' => 1,
424 'X_OFFSET' => $position_x++, # going right
425 'Y_OFFSET' => $position_y--, # going up
426 } if($end_x != 0) ;
427
428 3 my $number_of_diagonals = $height - ($number_of_verticals + 3) ;
429
430 3 for(1 .. $number_of_diagonals)
431 {
432 3 push @stripes,
433 {
434 'HEIGHT' => 1,
435 'TEXT' => $body,
436 'WIDTH' => 1,
437 'X_OFFSET' => $position_x++, # going right
438 'Y_OFFSET' => $position_y--, # going up
439 } ;
440 }
441
442 3 push @stripes,
443 {
444 'HEIGHT' => 1,
445 'TEXT' => $connection,
446 'WIDTH' => 1,
447 'X_OFFSET' => $position_x,
448 'Y_OFFSET' => $position_y,
449 } ;
450 }
451  
452 10 return(\@stripes, $width, $height) ;
453 }
454  
455 #--------------------------------------------------------------------------------------------------------------
456  
457 sub draw_upleft
458 7 ▶{
Subroutine draw_upleft: called CC=8 SCAR=20.8
Pod undocumented
459 7 my ($glyphs, $end_x, $end_y) = @_ ;
460  
461 7 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'up-left'}} ;
462  
463 7 my ($width, $height) = ( -$end_x + 1, -$end_y + 1) ;
464  
465 7 my ($position_x, $position_y) = (0, 0) ;
466 7 my @stripes ;
467  
468 #~ require Enbugger ;
469 #~ Enbugger->stop ;
470  
471 7 ▶if($width >= $height) # enought horizontal length to have a proper diagonal up
Branch: 1 branch
BranchTrueFalseTotal
if ($width >= $height) { } 4 3 7
472 {
473 4 push @stripes,
474 {
475 'HEIGHT' => 1,
476 'TEXT' => $start,
477 'WIDTH' => 1,
478 'X_OFFSET' => $position_x--,
479 'Y_OFFSET' => $position_y--,
480 } ;
481
482 4 for(-$position_y .. (-$end_y - 1))
483 {
484 12 push @stripes,
485 {
486 'HEIGHT' => 1,
487 'TEXT' => $body,
488 'WIDTH' => 1,
489 'X_OFFSET' => $position_x--,
490 'Y_OFFSET' => $position_y--,
491 } ;
492 }
493
494 4 push @stripes,
495 {
496 'HEIGHT' => 1,
497 'TEXT' => $connection,
498 'WIDTH' => 1,
499 'X_OFFSET' => $position_x--,
500 'Y_OFFSET' => $position_y,
501 } ;
502
503 4 ▶ if($width > $height)
Branch: 1 branch
BranchTrueFalseTotal
if ($width > $height) 3 1 4
504 {
505 3 for(1 .. ($width - $height) - 1)
506 {
507 3 push @stripes,
508 {
509 'HEIGHT' => 1,
510 'TEXT' => $body_2,
511 'WIDTH' => 1,
512 'X_OFFSET' => $position_x--,
513 'Y_OFFSET' => $position_y,
514 } ;
515 }
516
517 3 push @stripes,
518 {
519 'HEIGHT' => 1,
520 'TEXT' => $end,
521 'WIDTH' => 1,
522 'X_OFFSET' => $position_x,
523 'Y_OFFSET' => $position_y,
524 } ;
525 }
526 }
527 else
528 {
529 3 my $number_of_verticals = ($height - $width) - 1 ;
530 3 my $number_of_diagonals = $height - ($number_of_verticals + 3) ;
531
532 3 push @stripes,
533 {
534 'HEIGHT' => 1,
535 'TEXT' => $start,
536 'WIDTH' => 1,
537 'X_OFFSET' => $position_x,
538 'Y_OFFSET' => $position_y--,
539 } ;
540
541 3 for(1 .. $number_of_verticals)
542 {
543 3 push @stripes,
544 {
545 'HEIGHT' => 1,
546 'TEXT' => $vertical,
547 'WIDTH' => 1,
548 'X_OFFSET' => $position_x,
549 'Y_OFFSET' => $position_y--,
550 } ;
551 }
552
553 3 ▶ push @stripes,
Branch: 1 branch
BranchTrueFalseTotal
if $end_x != 0 3 0 3
554 {
555 'HEIGHT' => 1,
556 'TEXT' => $diagonal_connection,
557 'WIDTH' => 1,
558 'X_OFFSET' => $position_x--,
559 'Y_OFFSET' => $position_y--,
560 } if($end_x != 0) ;
561
562 3 for(1 .. $number_of_diagonals)
563 {
564 3 push @stripes,
565 {
566 'HEIGHT' => 1,
567 'TEXT' => $body,
568 'WIDTH' => 1,
569 'X_OFFSET' => $position_x--,
570 'Y_OFFSET' => $position_y--,
571 } ;
572 }
573
574 3 push @stripes,
575 {
576 'HEIGHT' => 1,
577 'TEXT' => $connection,
578 'WIDTH' => 1,
579 'X_OFFSET' => $position_x,
580 'Y_OFFSET' => $position_y,
581 } ;
582 }
583  
584 7 return(\@stripes, $width, $height) ;
585 }
586  
587 #--------------------------------------------------------------------------------------------------------------
588  
589 sub draw_leftup
590 7 ▶{
Subroutine draw_leftup: called CC=6 SCAR=17.9
Pod undocumented
591 7 my ($glyphs, $end_x, $end_y) = @_ ;
592  
593 7 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'left-up'}} ;
594  
595 7 my ($width, $height) = ( -$end_x + 1, -$end_y + 1) ;
596  
597 7 my ($position_x, $position_y) = (0, 0) ;
598 7 my @stripes ;
599  
600 7 ▶if($width > $height) # enought horizontal length to have a proper diagonal up
Branch: 1 branch
BranchTrueFalseTotal
if ($width > $height) { } 3 4 7
601 {
602 3 my $start_body_connector = $connection . $body_2 x (($width - $height) - 1) . $start ;
603
604 3 push @stripes,
605 {
606 'HEIGHT' => 1,
607 'TEXT' => $start_body_connector,
608 'WIDTH' => length($start_body_connector),
609 'X_OFFSET' => - length($start_body_connector) + 1,
610 'Y_OFFSET' => $position_y--,
611 } ;
612
613 3 $position_x -= length($start_body_connector) ;
614
615 3 for(1 .. ($height - 2)) # two connectors
616 {
617 9 push @stripes,
618 {
619 'HEIGHT' => 1,
620 'TEXT' => $body,
621 'WIDTH' => 1,
622 'X_OFFSET' => $position_x--,
623 'Y_OFFSET' => $position_y--,
624 } ;
625 }
626
627 3 push @stripes,
628 {
629 'HEIGHT' => 1,
630 'TEXT' => $end,
631 'WIDTH' => 1,
632 'X_OFFSET' => $position_x,
633 'Y_OFFSET' => $position_y,
634 } ;
635 }
636 else
637 {
638 4 my $number_of_verticals = $height - $width ;
639 4 my $number_of_diagonals = $height - ($number_of_verticals + 2) ;
640
641 4 push @stripes,
642 {
643 'HEIGHT' => 1,
644 'TEXT' => $connection,
645 'WIDTH' => 1,
646 'X_OFFSET' => $position_x--,
647 'Y_OFFSET' => $position_y--,
648 } ;
649
650 4 for(1 .. $number_of_diagonals)
651 {
652 6 push @stripes,
653 {
654 'HEIGHT' => 1,
655 'TEXT' => $body,
656 'WIDTH' => 1,
657 'X_OFFSET' => $position_x--,
658 'Y_OFFSET' => $position_y--,
659 } ;
660 }
661
662 4 ▶ push @stripes,
Branch: 1 branch
BranchTrueFalseTotal
if $end_x != $end_y 3 1 4
663 {
664 'HEIGHT' => 1,
665 'TEXT' => $diagonal_connection,
666 'WIDTH' => 1,
667 'X_OFFSET' => $position_x,
668 'Y_OFFSET' => $position_y--,
669 } if($end_x != $end_y) ;
670
671 4 for(1 .. $number_of_verticals - 1)
672 {
673 3 push @stripes,
674 {
675 'HEIGHT' => 1,
676 'TEXT' => $vertical,
677 'WIDTH' => 1,
678 'X_OFFSET' => $position_x,
679 'Y_OFFSET' => $position_y--,
680 } ;
681 }
682
683 4 push @stripes,
684 {
685 'HEIGHT' => 1,
686 'TEXT' => $end,
687 'WIDTH' => 1,
688 'X_OFFSET' => $position_x,
689 'Y_OFFSET' => $position_y,
690 } ;
691
692 }
693  
694 7 return(\@stripes, $width, $height) ;
695 }
696  
697 #---------------------------------------------------------------------------------
698  
699 sub draw_rightup
700 7 ▶{
Subroutine draw_rightup: called CC=10 SCAR=23.0
Pod undocumented
701 7 my ($glyphs, $end_x, $end_y) = @_ ;
702  
703 7 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'right-up'}} ;
704  
705 7 my ($width, $height) = ( $end_x + 1, -$end_y + 1) ;
706  
707 7 my ($position_x, $position_y) = (0, 0) ;
708 7 my @stripes ;
709  
710 7 ▶if($end_x > -$end_y)
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x > -$end_y) { } 3 4 7
711 {
712 3 push @stripes,
713 {
714 'HEIGHT' => 1,
715 'TEXT' => $start,
716 'WIDTH' => 1,
717 'X_OFFSET' => $position_x++,
718 'Y_OFFSET' => $position_y,
719 } ;
720
721 3 for(1 .. ($width - $height) - 1)
722 {
723 3 push @stripes,
724 {
725 'HEIGHT' => 1,
726 'TEXT' => $body_2,
727 'WIDTH' => 1,
728 'X_OFFSET' => $position_x++,
729 'Y_OFFSET' => $position_y,
730 } ;
731 }
732
733 3 push @stripes,
734 {
735 'HEIGHT' => 1,
736 'TEXT' => $connection,
737 'WIDTH' => 1,
738 'X_OFFSET' => $position_x++,
739 'Y_OFFSET' => $position_y--,
740 } ;
741
742 3 for($position_x .. ($end_x - 1))
743 {
744 9 push @stripes,
745 {
746 'HEIGHT' => 1,
747 'TEXT' => $body,
748 'WIDTH' => 1,
749 'X_OFFSET' => $position_x++,
750 'Y_OFFSET' => $position_y--,
751 } ;
752 }
753
754 3 push @stripes,
755 {
756 'HEIGHT' => 1,
757 'TEXT' => $end,
758 'WIDTH' => 1,
759 'X_OFFSET' => $end_x,
760 'Y_OFFSET' => $end_y,
761 } ;
762 }
763 else
764 {
765 4 ▶ my $number_of_verticals = ($height == $width) ? 0 : ($height - $width) -1 ;
Branch: 1 branch
BranchTrueFalseTotal
$height == $width ? : 1 3 4
766 4 ▶ my $has_diagonal_connection = ($height == $width) ? 0 : 1 ;
Branch: 1 branch
BranchTrueFalseTotal
$height == $width ? : 1 3 4
767
768 4 my $number_of_diagonals = $height - ($number_of_verticals + 2 + $has_diagonal_connection) ;
769
770 4 push @stripes,
771 {
772 'HEIGHT' => 1,
773 'TEXT' => $connection,
774 'WIDTH' => 1,
775 'X_OFFSET' => $position_x++,
776 'Y_OFFSET' => $position_y--,
777 } ;
778
779 4 for(1 .. $number_of_diagonals)
780 {
781 6 push @stripes,
782 {
783 'HEIGHT' => 1,
784 'TEXT' => $body,
785 'WIDTH' => 1,
786 'X_OFFSET' => $position_x++,
787 'Y_OFFSET' => $position_y--,
788 } ;
789 }
790
791 4 ▶ push @stripes,
Branch: 1 branch
BranchTrueFalseTotal
if $has_diagonal_connection 3 1 4
792 {
793 'HEIGHT' => 1,
794 'TEXT' => $diagonal_connection,
795 'WIDTH' => 1,
796 'X_OFFSET' => $position_x,
797 'Y_OFFSET' => $position_y--,
798 } if $has_diagonal_connection ;
799
800 4 for(1 .. $number_of_verticals)
801 {
802 3 push @stripes,
803 {
804 'HEIGHT' => 1,
805 'TEXT' => $vertical,
806 'WIDTH' => 1,
807 'X_OFFSET' => $position_x,
808 'Y_OFFSET' => $position_y--,
809 } ;
810 }
811
812 4 ▶ push @stripes,
Branch: 1 branch
BranchTrueFalseTotal
if $end_x != 0 4 0 4
813 {
814 'HEIGHT' => 1,
815 'TEXT' => $end,
816 'WIDTH' => 1,
817 'X_OFFSET' => $position_x,
818 'Y_OFFSET' => $position_y--,
819 } if($end_x != 0) ;
820 }
821  
822 7 return(\@stripes, $width, $height) ;
823 }
824  
825 #---------------------------------------------------------------------------------
826  
827 sub draw_downleft
828 7 ▶{
Subroutine draw_downleft: called CC=8 SCAR=20.8
Pod undocumented
829 7 my ($glyphs, $end_x, $end_y) = @_ ;
830  
831 7 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'down-left'}} ;
832  
833 7 my ($width, $height) = ( -$end_x + 1, $end_y + 1) ;
834  
835 7 my ($position_x, $position_y) = (0, 0) ;
836 7 my @stripes ;
837  
838 7 ▶if($width >= $height) # enought horizontal length to have a proper diagonal up
Branch: 1 branch
BranchTrueFalseTotal
if ($width >= $height) { } 4 3 7
839 {
840 4 push @stripes,
841 {
842 'HEIGHT' => 1,
843 'TEXT' => $start,
844 'WIDTH' => 1,
845 'X_OFFSET' => $position_x--,
846 'Y_OFFSET' => $position_y++,
847 } ;
848
849 4 for(1 .. ($height - 2)) # two connectors
850 {
851 12 push @stripes,
852 {
853 'HEIGHT' => 1,
854 'TEXT' => $body,
855 'WIDTH' => 1,
856 'X_OFFSET' => $position_x--,
857 'Y_OFFSET' => $position_y++,
858 } ;
859 }
860
861 4 my $left_text = '' ;
862 4 ▶ $left_text .= $body_2 x (($width - $height) - 1) if $width > $height ;
Branch: 1 branch
BranchTrueFalseTotal
if $width > $height 3 1 4
863
864 4 ▶ if($width > $height)
Branch: 1 branch
BranchTrueFalseTotal
if ($width > $height) 3 1 4
865 {
866 3 $left_text = $end . $body_2 x (($width - $height) - 1) ;
867 }
868
869 4 push @stripes,
870 {
871 'HEIGHT' => 1,
872 'TEXT' => $left_text . $connection,
873 'WIDTH' => length($left_text) + 1,
874 'X_OFFSET' => $end_x,
875 'Y_OFFSET' => $position_y,
876 } ;
877 }
878 else # not enought horizontal length to have a proper diagonal up
879 {
880 3 push @stripes,
881 {
882 'HEIGHT' => 1,
883 'TEXT' => $start,
884 'WIDTH' => 1,
885 'X_OFFSET' => $position_x,
886 'Y_OFFSET' => $position_y++,
887 } ;
888
889 3 for (1 .. ($height - $width) - 1)
890 {
891 3 push @stripes,
892 {
893 'HEIGHT' => 1,
894 'TEXT' => $vertical,
895 'WIDTH' => 1,
896 'X_OFFSET' => $position_x,
897 'Y_OFFSET' => $position_y++,
898 } ;
899 }
900
901 3 ▶ if($end_x != 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x != 0) 3 0 3
902 {
903 3 push @stripes,
904 {
905 'HEIGHT' => 1,
906 'TEXT' => $diagonal_connection,
907 'WIDTH' => 1,
908 'X_OFFSET' => $position_x--,
909 'Y_OFFSET' => $position_y++,
910 } ;
911 }
912
913 3 for(1 .. (-$end_x + $position_x))
914 {
915 3 push @stripes,
916 {
917 'HEIGHT' => 1,
918 'TEXT' => $body,
919 'WIDTH' => 1,
920 'X_OFFSET' => $position_x--,
921 'Y_OFFSET' => $position_y++,
922 } ;
923 }
924
925 3 push @stripes,
926 {
927 'HEIGHT' => 1,
928 'TEXT' => $connection,
929 'WIDTH' => 1,
930 'X_OFFSET' => $position_x,
931 'Y_OFFSET' => $position_y,
932 } ;
933 }
934  
935 7 return(\@stripes, $width, $height) ;
936 }
937  
938 #----------------------------------------------------------------------------------------------------------
939  
940 sub draw_leftdown
941 7 ▶{
Subroutine draw_leftdown: called CC=8 SCAR=20.8
Pod undocumented
942 7 my ($glyphs, $end_x, $end_y) = @_ ;
943  
944 7 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'left-down'}} ;
945  
946 7 my ($width, $height) = ( -$end_x + 1, $end_y + 1) ;
947  
948 7 my ($position_x, $position_y) = (0, 0) ;
949 7 my @stripes ;
950  
951 7 ▶if($width >= $height) # enought horizontal length to have a proper diagonal up
Branch: 1 branch
BranchTrueFalseTotal
if ($width >= $height) { } 4 3 7
952 {
953 4 my $start_body_connector = $connection;
954 4 ▶ $start_body_connector .= $body_2 x (($width - $height) - 1) if $width > $height ;
Branch: 1 branch
BranchTrueFalseTotal
if $width > $height 3 1 4
955
956 4 ▶ if($width > $height)
Branch: 1 branch
BranchTrueFalseTotal
if ($width > $height) 3 1 4
957 {
958 3 $start_body_connector .= $start ;
959 }
960
961 4 push @stripes,
962 {
963 'HEIGHT' => 1,
964 'TEXT' => $start_body_connector,
965 'WIDTH' => length($start_body_connector),
966 'X_OFFSET' => - length($start_body_connector) + 1,
967 'Y_OFFSET' => $position_y++,
968 } ;
969
970 4 $position_x -= length($start_body_connector) ;
971
972 4 for(1 .. ($height - 2)) # two connectors
973 {
974 12 push @stripes,
975 {
976 'HEIGHT' => 1,
977 'TEXT' => $body,
978 'WIDTH' => 1,
979 'X_OFFSET' => $position_x--,
980 'Y_OFFSET' => $position_y++,
981 } ;
982 }
983
984 4 push @stripes,
985 {
986 'HEIGHT' => 1,
987 'TEXT' => $end,
988 'WIDTH' => 1,
989 'X_OFFSET' => $position_x,
990 'Y_OFFSET' => $position_y,
991 } ;
992 }
993 else
994 {
995 3 push @stripes,
996 {
997 'HEIGHT' => 1,
998 'TEXT' => $connection,
999 'WIDTH' => 1,
1000 'X_OFFSET' => $position_x--,
1001 'Y_OFFSET' => $position_y++,
1002 } ;
1003
1004 3 for(1 .. (-$end_x + $position_x))
1005 {
1006 3 push @stripes,
1007 {
1008 'HEIGHT' => 1,
1009 'TEXT' => $body,
1010 'WIDTH' => 1,
1011 'X_OFFSET' => $position_x--,
1012 'Y_OFFSET' => $position_y++,
1013 } ;
1014 }
1015
1016 3 ▶ if($end_x != 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x != 0) 3 0 3
1017 {
1018 3 push @stripes,
1019 {
1020 'HEIGHT' => 1,
1021 'TEXT' => $diagonal_connection,
1022 'WIDTH' => 1,
1023 'X_OFFSET' => $position_x,
1024 'Y_OFFSET' => $position_y++,
1025 } ;
1026 }
1027
1028 3 for (1 .. ($height - $width) - 1)
1029 {
1030 3 push @stripes,
1031 {
1032 'HEIGHT' => 1,
1033 'TEXT' => $vertical,
1034 'WIDTH' => 1,
1035 'X_OFFSET' => $position_x,
1036 'Y_OFFSET' => $position_y++,
1037 } ;
1038 }
1039
1040 3 push @stripes,
1041 {
1042 'HEIGHT' => 1,
1043 'TEXT' => $end,
1044 'WIDTH' => 1,
1045 'X_OFFSET' => $position_x,
1046 'Y_OFFSET' => $position_y,
1047 } ;
1048 }
1049  
1050 7 return(\@stripes, $width, $height) ;
1051 }
1052  
1053 #----------------------------------------------------------------------------------------------------------
1054  
1055 sub draw_downright
1056 7 ▶{
Subroutine draw_downright: called CC=9 SCAR=22.0
Pod undocumented
1057 7 my ($glyphs, $end_x, $end_y) = @_ ;
1058  
1059 7 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'down-right'}} ;
1060  
1061 7 my ($width, $height) = ( $end_x + 1, $end_y + 1) ;
1062  
1063 7 my ($position_x, $position_y) = (0, 0) ;
1064 7 my @stripes ;
1065  
1066 #~ require Enbugger ;
1067 #~ Enbugger->stop ;
1068  
1069 7 ▶if($end_x >= $end_y) # enought horizontal length to have a proper diagonal up
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x >= $end_y) 4 3 7
1070 {
1071 4 push @stripes,
1072 {
1073 'HEIGHT' => 1,
1074 'TEXT' => $start,
1075 'WIDTH' => 1,
1076 'X_OFFSET' => $position_x++, # diagonal
1077 'Y_OFFSET' => $position_y++, # diagonal
1078 } ;
1079
1080 4 for($position_y .. ($end_y - 1))
1081 {
1082 12 push @stripes,
1083 {
1084 'HEIGHT' => 1,
1085 'TEXT' => $body,
1086 'WIDTH' => 1,
1087 'X_OFFSET' => $position_x++, # diagonal
1088 'Y_OFFSET' => $position_y++, # diagonal
1089 } ;
1090 }
1091
1092 4 push @stripes,
1093 {
1094 'HEIGHT' => 1,
1095 'TEXT' => $connection,
1096 'WIDTH' => 1,
1097 'X_OFFSET' => $position_x++, # going right
1098 'Y_OFFSET' => $position_y, # staying horizontal
1099 } ;
1100
1101 4 ▶ if($end_x > $end_y)
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x > $end_y) 3 1 4
1102 {
1103 3 for($position_x .. ($end_x - 1))
1104 {
1105 3 push @stripes,
1106 {
1107 'HEIGHT' => 1,
1108 'TEXT' => $body_2,
1109 'WIDTH' => 1,
1110 'X_OFFSET' => $position_x++, # going right
1111 'Y_OFFSET' => $position_y, # staying horizontal
1112 } ;
1113 }
1114
1115 3 push @stripes,
1116 {
1117 'HEIGHT' => 1,
1118 'TEXT' => $end,
1119 'WIDTH' => 1,
1120 'X_OFFSET' => $position_x, # finished
1121 'Y_OFFSET' => $position_y, # finished
1122 } ;
1123 }
1124 }
1125  
1126 7 ▶if($end_x < $end_y) # not enought horizontal length to have a proper diagonal up
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x < $end_y) 3 4 7
1127 {
1128 3 my $number_of_verticals = ($end_y - $end_x) - 1 ;
1129
1130 3 push @stripes,
1131 {
1132 'HEIGHT' => 1,
1133 'TEXT' => $start,
1134 'WIDTH' => 1,
1135 'X_OFFSET' => $position_x,
1136 'Y_OFFSET' => $position_y++,
1137 } ;
1138
1139 3 for(1 .. $number_of_verticals)
1140 {
1141 3 push @stripes,
1142 {
1143 'HEIGHT' => 1,
1144 'TEXT' => $vertical,
1145 'WIDTH' => 1,
1146 'X_OFFSET' => $position_x,
1147 'Y_OFFSET' => $position_y++,
1148 } ;
1149 }
1150
1151 3 ▶ push @stripes,
Branch: 1 branch
BranchTrueFalseTotal
if $end_x != 0 3 0 3
1152 {
1153 'HEIGHT' => 1,
1154 'TEXT' => $diagonal_connection,
1155 'WIDTH' => 1,
1156 'X_OFFSET' => $position_x++,
1157 'Y_OFFSET' => $position_y++,
1158 } if($end_x != 0) ;
1159
1160 3 my $number_of_diagonals = $height - ($number_of_verticals + 3) ;
1161
1162 3 for(1 .. $number_of_diagonals)
1163 {
1164 3 push @stripes,
1165 {
1166 'HEIGHT' => 1,
1167 'TEXT' => $body,
1168 'WIDTH' => 1,
1169 'X_OFFSET' => $position_x++,
1170 'Y_OFFSET' => $position_y++,
1171 } ;
1172 }
1173
1174 3 push @stripes,
1175 {
1176 'HEIGHT' => 1,
1177 'TEXT' => $connection,
1178 'WIDTH' => 1,
1179 'X_OFFSET' => $position_x,
1180 'Y_OFFSET' => $position_y,
1181 } ;
1182 }
1183  
1184 7 return(\@stripes, $width, $height) ;
1185 }
1186  
1187 #----------------------------------------------------------------------------------------------------------
1188  
1189 sub draw_rightdown
1190 7 ▶{
Subroutine draw_rightdown: called CC=9 SCAR=22.0
Pod undocumented
1191 7 my ($glyphs, $end_x, $end_y) = @_ ;
1192  
1193 7 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'right-down'}} ;
1194  
1195 7 my ($width, $height) = ( $end_x + 1, $end_y + 1) ;
1196  
1197 7 my ($position_x, $position_y) = (0, 0) ;
1198 7 my @stripes ;
1199  
1200 7 ▶if($end_x >= $end_y) # enought horizontal length to have a proper diagonal down
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x >= $end_y) 4 3 7
1201 {
1202 4 ▶ if($end_x > $end_y)
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x > $end_y) 3 1 4
1203 {
1204 3 push @stripes,
1205 {
1206 'HEIGHT' => 1,
1207 'TEXT' => $start,
1208 'WIDTH' => 1,
1209 'X_OFFSET' => $position_x++, # going right
1210 'Y_OFFSET' => $position_y, # stay on this line
1211 } ;
1212
1213 3 for(1 .. ($end_x - $end_y) - 1)
1214 {
1215 3 push @stripes,
1216 {
1217 'HEIGHT' => 1,
1218 'TEXT' => $body_2,
1219 'WIDTH' => 1,
1220 'X_OFFSET' => $position_x++,
1221 'Y_OFFSET' => $position_y,
1222 } ;
1223 }
1224 }
1225
1226 4 push @stripes,
1227 {
1228 'HEIGHT' => 1,
1229 'TEXT' => $connection,
1230 'WIDTH' => 1,
1231 'X_OFFSET' => $position_x++,
1232 'Y_OFFSET' => $position_y++,
1233 } ;
1234
1235 4 for(1 .. ($end_y - $position_y))
1236 {
1237 12 push @stripes,
1238 {
1239 'HEIGHT' => 1,
1240 'TEXT' => $body,
1241 'WIDTH' => 1,
1242 'X_OFFSET' => $position_x++,
1243 'Y_OFFSET' => $position_y++,
1244 } ;
1245 }
1246
1247 4 push @stripes,
1248 {
1249 'HEIGHT' => 1,
1250 'TEXT' => $end,
1251 'WIDTH' => 1,
1252 'X_OFFSET' => $position_x,
1253 'Y_OFFSET' => $position_y,
1254 } ;
1255 }
1256  
1257 7 ▶if($end_x < $end_y) # not enought horizontal length to have a proper diagonal up
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x < $end_y) 3 4 7
1258 {
1259 3 push @stripes,
1260 {
1261 'HEIGHT' => 1,
1262 'TEXT' => $connection,
1263 'WIDTH' => 1,
1264 'X_OFFSET' => $position_x,
1265 'Y_OFFSET' => $position_y++,
1266 } ;
1267
1268 3 for(1 .. (($end_x - 1) - $position_x))
1269 {
1270 3 $position_x++ ;
1271 3 push @stripes,
1272 {
1273 'HEIGHT' => 1,
1274 'TEXT' => $body,
1275 'WIDTH' => 1,
1276 'X_OFFSET' => $position_x,
1277 'Y_OFFSET' => $position_y++,
1278 } ;
1279 }
1280
1281 3 ▶ if($end_x != 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($end_x != 0) 3 0 3
1282 {
1283 3 $position_x++ ;
1284 3 push @stripes,
1285 {
1286 'HEIGHT' => 1,
1287 'TEXT' => $diagonal_connection,
1288 'WIDTH' => 1,
1289 'X_OFFSET' => $position_x,
1290 'Y_OFFSET' => $position_y++,
1291 } ;
1292 }
1293
1294 3 for (0 .. ($end_y -$position_y) - 1)
1295 {
1296 3 push @stripes,
1297 {
1298 'HEIGHT' => 1,
1299 'TEXT' => $vertical,
1300 'WIDTH' => 1,
1301 'X_OFFSET' => $position_x,
1302 'Y_OFFSET' => $position_y++,
1303 };
1304 }
1305
1306 3 push @stripes,
1307 {
1308 'HEIGHT' => 1,
1309 'TEXT' => $end,
1310 'WIDTH' => 1,
1311 'X_OFFSET' => $position_x,
1312 'Y_OFFSET' => $position_y++,
1313 } ;
1314 }
1315  
1316 7 return(\@stripes, $width, $height) ;
1317 }
1318  
1319 #-----------------------------------------------------------------------------
1320  
1321 sub get_selection_action
1322 0 ▶{
Subroutine get_selection_action: not called CC=5 SCAR=34.0
Pod undocumented
1323 0 my ($self, $x, $y) = @_ ;
1324  
1325 0 ▶if (
Branch: 1 branch
BranchTrueFalseTotal
if ($x == 0 and $y == 0 or $x == $self->{'END_X'} and $y == $self->{'END_Y'}) { } 0 0 0
Condition0%0/9
$x == 0 and $y == 0 or $x == $self->{"END_X"} and $y == $self->{"END_Y"}
l!l&&r!l&&!r
000
$x == 0 and $y == 0
!ll&&!rl&&r
000
$x == $self->{"END_X"} and $y == $self->{"END_Y"}
!ll&&!rl&&r
000
MC/DC0%0/4
$x == 0 and $y == 0 or $x == $self->{"END_X"} and $y == $self->{"END_Y"}
$x == 0 $y == 0 $x == $self->{"END_X"} $y == $self->{"END_Y"}
Truth table0%0/7
A and B or C and D
A= $x == 0B= $y == 0C= $x == $self->{"END_X"}D= $y == $self->{"END_Y"}
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
1326 ($x == 0 && $y == 0)
1327 || ($x == $self->{END_X} && $y == $self->{END_Y})
1328 )
1329 {
1330 0 'resize' ;
1331 }
1332 else
1333 {
1334 0 'move' ;
1335 }
1336 }
1337  
1338 #-----------------------------------------------------------------------------
1339  
1340 sub get_connector_points
1341 73 ▶{
Subroutine get_connector_points: called CC=1 SCAR=0.0
Pod undocumented
1342 73 my ($self) = @_ ;
1343  
1344 return
1345 (
1346 {X => 0, Y => 0, NAME => 'start'},
1347 73 {X => $self->{END_X}, Y => $self->{END_Y}, NAME => 'end'},
1348 ) ;
1349 }
1350 #-----------------------------------------------------------------------------
1351  
1352 sub get_named_connection
1353 0 ▶{
Subroutine get_named_connection: not called CC=5 SCAR=34.0
Pod undocumented
1354 0 my ($self, $name) = @_ ;
1355  
1356 0 ▶if($name eq 'start')
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq 'start') { } 0 0 0
elsif ($name eq 'end') { } 0 0 0
1357 {
1358 0 ▶ return( {X => 0, Y => 0, NAME => 'start', CHAR => $self->{GLYPHS}{$self->{DIRECTION}}[0]} ) if exists $self->{GLYPHS} ;
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"GLYPHS"} 0 0 0
1359 0 return( {X => 0, Y => 0, NAME => 'start', CHAR => '?'} ) ;
1360 }
1361 elsif($name eq 'end')
1362 {
1363 0 ▶ return( {X => $self->{END_X}, Y => $self->{END_Y}, NAME => 'end', CHAR => $self->{GLYPHS}{$self->{DIRECTION}}[4]} ) if exists $self->{GLYPHS} ;
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"GLYPHS"} 0 0 0
1364 0 return( {X => $self->{END_X}, Y => $self->{END_Y}, NAME => 'end', CHAR => '?'} ) ;
1365 }
1366 else
1367 {
1368 0 return ;
1369 }
1370 }
1371  
1372 #-----------------------------------------------------------------------------
1373  
1374 sub get_direction
1375 0 ▶{
Subroutine get_direction: not called CC=1 SCAR=6.9
Pod undocumented
1376 0 my ($self) = @_ ;
1377  
1378 0 return $self->{DIRECTION} ;
1379 }
1380  
1381 #-----------------------------------------------------------------------------
1382  
1383 sub change_direction
1384 0 ▶{
Subroutine change_direction: not called CC=2 SCAR=17.9
Pod undocumented
1385 0 my ($self, $x, $y) = @_ ;
1386  
1387 0 my $direction = $self->get_direction() ;
1388  
1389 0 ▶if($direction =~ /(.*)-(.*)/)
Branch: 1 branch
BranchTrueFalseTotal
if ($direction =~ /(.*)-(.*)/) 0 0 0
1390 {
1391 0 $self->resize(0, 0, 0, 0, "$2-$1") ;
1392 }
1393 }
1394  
1395 #-----------------------------------------------------------------------------
1396  
1397 sub move_connector
1398 0 ▶{
Subroutine move_connector: not called CC=3 SCAR=24.8
Pod undocumented
1399 0 my ($self, $connector_name, $x_offset, $y_offset, $hint) = @_ ;
1400  
1401 0 ▶if($connector_name eq 'start')
Branch: 2 branches
BranchTrueFalseTotal
if ($connector_name eq 'start') { } 0 0 0
elsif ($connector_name eq 'end') { } 0 0 0
1402 {
1403 0 my ($x_offset, $y_offset, $width, $height, undef) =
1404 $self->resize(0, 0, $x_offset, $y_offset, $hint) ;
1405
1406 return
1407 $x_offset, $y_offset, $width, $height,
1408 0 {X => $self->{END_X}, Y => $self->{END_Y}, NAME => 'start'} ;
1409 }
1410 elsif($connector_name eq 'end')
1411 {
1412 my ($x_offset, $y_offset, $width, $height, undef) =
1413 0 $self->resize(-1, -1, $self->{END_X} + $x_offset, $self->{END_Y} + $y_offset, $hint) ;
1414
1415 return
1416 $x_offset, $y_offset, $width, $height,
1417 0 {X => $self->{END_X}, Y => $self->{END_Y}, NAME => 'end'} ;
1418 }
1419 else
1420 {
1421 0 die "unknown connector '$connector_name'!\n" ;
1422 }
1423 }
1424  
1425 #-----------------------------------------------------------------------------
1426  
1427 sub resize
1428 0 ▶{
Subroutine resize: not called CC=8 SCAR=42.8
Pod undocumented
1429 0 my ($self, $reference_x, $reference_y, $new_x, $new_y, $hint, $connector_name) = @_ ;
1430  
1431 0 my $is_start ;
1432  
1433 0 ▶if(defined $connector_name)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $connector_name) { } 0 0 0
1434 {
1435 0 ▶ if($connector_name eq 'start')
Branch: 1 branch
BranchTrueFalseTotal
if ($connector_name eq "start") 0 0 0
1436 {
1437 0 $is_start++ ;
1438 }
1439 }
1440 else
1441 {
1442 0 ▶ if($reference_x == 0 && $reference_y == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($reference_x == 0 and $reference_y == 0) 0 0 0
Condition0%0/3
$reference_x == 0 and $reference_y == 0
!ll&&!rl&&r
000
MC/DC0%0/2
$reference_x == 0 and $reference_y == 0
$reference_x == 0 $reference_y == 0
Truth table0%0/3
A and B
A= $reference_x == 0B= $reference_y == 0
ABresult
0X0
100
111
1443 {
1444 0 $is_start++ ;
1445 }
1446 }
1447  
1448 0 ▶if($is_start)
Branch: 1 branch
BranchTrueFalseTotal
if ($is_start) { } 0 0 0
1449 {
1450 0 my $x_offset = $new_x ;
1451 0 my $y_offset = $new_y ;
1452
1453 0 my $new_end_x = $self->{END_X} - $x_offset ;
1454 0 my $new_end_y = $self->{END_Y} - $y_offset ;
1455
1456 0 ▶ $self->setup($self->{ARROW_TYPE}, $new_end_x, $new_end_y, $hint || $self->{DIRECTION}, $self->{EDITABLE}) ;
Condition0%0/3
$hint || $self->{'DIRECTION'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$hint || $self->{'DIRECTION'}
$hint $self->{'DIRECTION'}
Truth table0%0/3
A || B
A= $hintB= $self->{'DIRECTION'}
ABresult
1X1
011
000
1457
1458 0 return($x_offset, $y_offset, $self->{WIDTH}, $self->{HEIGHT}, 'start') ;
1459 }
1460 else
1461 {
1462 0 my $new_end_x = $new_x ;
1463 0 my $new_end_y = $new_y ;
1464
1465 0 ▶ $self->setup($self->{ARROW_TYPE}, $new_end_x, $new_end_y, $hint || $self->{DIRECTION}, $self->{EDITABLE}) ;
Condition0%0/3
$hint || $self->{'DIRECTION'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$hint || $self->{'DIRECTION'}
$hint $self->{'DIRECTION'}
Truth table0%0/3
A || B
A= $hintB= $self->{'DIRECTION'}
ABresult
1X1
011
000
1466
1467 0 return(0, 0, $self->{WIDTH}, $self->{HEIGHT}, 'end') ;
1468 }
1469 }
1470  
1471 #-----------------------------------------------------------------------------
1472  
1473 0 ▶sub get_all_points { my ($self) = @_ ; $self->get_connector_points() ; }
Subroutine get_all_points: not called CC=1 SCAR=6.9
Pod undocumented
1474  
1475 #-----------------------------------------------------------------------------
1476  
1477 0 ▶sub get_section_direction { my ($self, $section_index) = @_ ; return $self->{DIRECTION} ; }
Subroutine get_section_direction: not called CC=1 SCAR=6.9
Pod undocumented
1478  
1479 #-----------------------------------------------------------------------------
1480  
1481 sub edit
1482 0 ▶{
Subroutine edit: not called CC=1 SCAR=6.9
Pod undocumented
1483 0 my ($self, $asciio) = @_ ;
1484  
1485 0 $self->display_arrow_edit_dialog() ;
1486  
1487 $self->setup
1488 (
1489 $self->{ARROW_TYPE},
1490 $self->{END_X}, $self->{END_Y},
1491 $self->{DIRECTION},
1492 $self->{EDITABLE},
1493 0 ) ;
1494 }
1495  
1496 #-----------------------------------------------------------------------------
1497  
1498 sub set_arrow_type
1499 0 ▶{
Subroutine set_arrow_type: not called CC=1 SCAR=6.9
Pod undocumented
1500 0 my ($self, $arrow_type) = @_ ;
1501  
1502 0 delete $self->{CACHE} ;
1503  
1504 $self->setup
1505 (
1506 $arrow_type,
1507 $self->{END_X}, $self->{END_Y},
1508 $self->{DIRECTION},
1509 $self->{EDITABLE},
1510 0 ) ;
1511 }
1512  
1513 #-----------------------------------------------------------------------------
1514  
1515  
1516 1 1 ;
« blib/lib/App/Asciio/Actions/Arrow.pm ↑ Summary blib/lib/App/Asciio/Text/Asciio/Menues.pm »