File Coverage

lib/App/Asciio/stripes/angled_arrow.pm
Criterion Covered Total %
statement 313 365 85.7
branch 73 104 70.1
condition 1 21 4.7
subroutine 27 37 72.9
pod 0 27 0.0
total 414 554 74.7


line stmt bran cond sub pod time code
1              
2             package App::Asciio::stripes::angled_arrow ;
3              
4 1     1   827 use base App::Asciio::stripes::stripes ;
  1         2  
  1         593  
5              
6 1     1   8 use strict;
  1         3  
  1         23  
7 1     1   4 use warnings;
  1         3  
  1         53  
8              
9 1     1   5 use List::Util qw(min max) ;
  1         2  
  1         68  
10 1     1   5 use Readonly ;
  1         2  
  1         1012  
11              
12             #-----------------------------------------------------------------------------
13              
14             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             {
36 73     73 0 2882 my ($class, $element_definition) = @_ ;
37              
38 73         222 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   33     657 ) ;
47              
48 73         333 return $self ;
49             }
50              
51             #-----------------------------------------------------------------------------
52              
53             sub setup
54             {
55 73     73 0 331 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         383 $arrow_type->[0][0] => [@{$arrow_type->[0]}[1..7]],
61 73         321 $arrow_type->[1][0] => [@{$arrow_type->[1]}[1..7]],
62 73         309 $arrow_type->[2][0] => [@{$arrow_type->[2]}[1..7]],
63 73         310 $arrow_type->[3][0] => [@{$arrow_type->[3]}[1..7]],
64 73         294 $arrow_type->[4][0] => [@{$arrow_type->[4]}[1..7]],
65 73         261 $arrow_type->[5][0] => [@{$arrow_type->[5]}[1..7]],
66 73         388 $arrow_type->[6][0] => [@{$arrow_type->[6]}[1..7]],
67 73         347 $arrow_type->[7][0] => [@{$arrow_type->[7]}[1..7]],
68 73         282 $arrow_type->[8][0] => [@{$arrow_type->[8]}[1..7]],
69 73         250 $arrow_type->[9][0] => [@{$arrow_type->[9]}[1..7]],
70 73         287 $arrow_type->[10][0] => [@{$arrow_type->[10]}[1..7]],
71 73         274 $arrow_type->[11][0] => [@{$arrow_type->[11]}[1..7]],
72 73         197 $arrow_type->[12][0] => [@{$arrow_type->[12]}[1..7]],
  73         701  
73             } ;
74              
75 73         339 (my ($stripes, $width, $height), $direction) = get_arrow($glyphs, $end_x, $end_y, $direction) ;
76              
77 73         206 my ($ex1, $ey1, $ex2, $ey2) ;
78              
79 73 100       189 if ($end_x < 0)
80             {
81 31         56 $ex1 = $end_x ;
82 31         54 $ex2 = 1 ;
83             }
84             else
85             {
86 42         87 $ex1 = 0 ;
87 42         80 $ex2 = $end_x + 1 ;
88             }
89              
90 73 100       176 if ($end_y < 0)
91             {
92 35         53 $ey1 = $end_y ;
93 35         60 $ey2 = 1 ;
94             }
95             else
96             {
97 38         53 $ey1 = 0 ;
98 38         66 $ey2 = $end_y + 1 ;
99             }
100              
101 73         487 $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             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             {
136 73     73 0 212 my ($glyphs, $end_x, $end_y, $direction) = @_ ;
137              
138 1     1   10 use constant CENTER => 1 ;
  1         2  
  1         120  
139 1     1   6 use constant LEFT => 0 ;
  1         2  
  1         52  
140 1     1   6 use constant RIGHT => 2 ;
  1         2  
  1         63  
141 1     1   6 use constant UP => 0 ;
  1         2  
  1         56  
142 1     1   5 use constant DOWN => 2 ;
  1         8  
  1         6327  
143              
144 73 100       1152 my @position_to_direction =
    100          
    100          
    100          
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 100       569 $direction = $position_to_direction
    100          
    100          
    100          
152             [$end_x == 0 ? CENTER : $end_x < 0 ? LEFT : RIGHT]
153             [$end_y == 0 ? CENTER : $end_y < 0 ? UP : DOWN] ;
154              
155 73         198 my $drawing_sub = $direction_to_arrow{$direction} ;
156            
157 73         349 return($drawing_sub->($glyphs, $end_x, $end_y), $direction) ;
158             }
159              
160             #--------------------------------------------------------------------------------------------------------------
161              
162             sub draw_origin
163             {
164 1     1 0 2 my ($glyphs, $end_x, $end_y) = @_ ;
165              
166 1         2 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{origin}} ;
  1         4  
167              
168 1         2 my ($stripes, $width, $height) = ([], 1, 1) ;
169              
170 1         2 push @{$stripes},
  1         5  
171             {
172             'HEIGHT' => 1,
173             'TEXT' => $start,
174             'WIDTH' => 1,
175             'X_OFFSET' => 0,
176             'Y_OFFSET' => 0,
177             } ;
178              
179 1         4 return($stripes, $width, $height) ;
180             }
181              
182             #--------------------------------------------------------------------------------------------------------------
183              
184             sub draw_up
185             {
186 4     4 0 11 my ($glyphs, $end_x, $end_y) = @_ ;
187              
188 4         9 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{up}} ;
  4         16  
189              
190 4         14 my ($width, $height) = ( $end_x + 1, -$end_y + 1) ;
191              
192 4         8 my @stripes ;
193              
194 4         50 push @stripes,
195             {
196             'HEIGHT' => 1,
197             'TEXT' => $start,
198             'WIDTH' => 1,
199             'X_OFFSET' => 0,
200             'Y_OFFSET' => 0,
201             } ;
202              
203 4         18 for(1 .. $height - 1)
204             {
205 16         52 push @stripes,
206             {
207             'HEIGHT' => 1,
208             'TEXT' => $body,
209             'WIDTH' => 1,
210             'X_OFFSET' => 0,
211             'Y_OFFSET' => -$_,
212             };
213             }
214              
215 4         24 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         27 return(\@stripes, $width, $height) ;
225             }
226              
227             #--------------------------------------------------------------------------------------------------------------
228              
229             sub draw_down
230             {
231 4     4 0 13 my ($glyphs, $end_x, $end_y) = @_ ;
232              
233 4         9 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{down}} ;
  4         17  
234              
235 4         16 my ($width, $height) = ( $end_x + 1, $end_y + 1) ;
236              
237 4         9 my @stripes ;
238              
239 4         26 push @stripes,
240             {
241             'HEIGHT' => 1,
242             'TEXT' => $start,
243             'WIDTH' => 1,
244             'X_OFFSET' => 0,
245             'Y_OFFSET' => 0,
246             } ;
247              
248 4         20 for(1 .. $height - 1)
249             {
250 16         50 push @stripes,
251             {
252             'HEIGHT' => 1,
253             'TEXT' => $body,
254             'WIDTH' => 1,
255             'X_OFFSET' => 0,
256             'Y_OFFSET' => $_,
257             } ;
258             }
259              
260 4         20 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         28 return(\@stripes, $width, $height) ;
270             }
271              
272             #--------------------------------------------------------------------------------------------------------------
273              
274             sub draw_left
275             {
276 3     3 0 4 my ($glyphs, $end_x, $end_y) = @_ ;
277              
278 3         5 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{left}} ;
  3         6  
279              
280 3         6 my ($width, $height) = ( -$end_x + 1, $end_y + 1) ;
281              
282 3         3 my @stripes ;
283              
284 3         8 my $stripe = $end . ($body x ( -$end_x - 1)) . $start ;
285 3         11 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         11 return(\@stripes, $width, $height) ;
295             }
296              
297             #--------------------------------------------------------------------------------------------------------------
298              
299             sub draw_right
300             {
301 2     2 0 3 my ($glyphs, $end_x, $end_y) = @_ ;
302              
303 2         3 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{right}} ;
  2         5  
304              
305 2         4 my ($width, $height) = ($end_x + 1, $end_y + 1) ;
306              
307 2         1 my @stripes ;
308              
309 2         5 my $stripe = $start . ($body x ($end_x - 1)) . $end ;
310 2         7 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         10 return(\@stripes, $width, $height) ;
320             }
321              
322             #--------------------------------------------------------------------------------------------------------------
323              
324             sub draw_upright
325             {
326 10     10 0 26 my ($glyphs, $end_x, $end_y) = @_ ;
327 10         19 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'up-right'}} ;
  10         38  
328              
329 10         31 my ($width, $height) = ( $end_x + 1, -$end_y + 1) ;
330              
331 10         27 my ($position_x, $position_y) = (0, 0) ;
332 10         17 my @stripes ;
333              
334             #~ require Enbugger ;
335             #~ Enbugger->stop ;
336              
337 10 100       47 if($end_x >= -$end_y) # enought horizontal length to have a proper diagonal up
338             {
339 7         56 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         31 for(-$position_y .. (-$end_y - 1))
349             {
350 13         51 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         27 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 100       21 if($end_x > -$end_y)
370             {
371 4         14 for($position_x .. ($end_x - 1))
372             {
373 3         18 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         17 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 100       32 if($end_x < -$end_y) # not enought horizontal length to have a proper diagonal up
395             {
396 3         11 my $number_of_verticals = ($height - $width) - 1 ;
397            
398 3         24 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         14 for(1 .. $number_of_verticals)
408             {
409 3         17 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 50       24 push @stripes,
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         8 my $number_of_diagonals = $height - ($number_of_verticals + 3) ;
429            
430 3         135 for(1 .. $number_of_diagonals)
431             {
432 3         20 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         16 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         93 return(\@stripes, $width, $height) ;
453             }
454              
455             #--------------------------------------------------------------------------------------------------------------
456              
457             sub draw_upleft
458             {
459 7     7 0 12 my ($glyphs, $end_x, $end_y) = @_ ;
460              
461 7         7 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'up-left'}} ;
  7         17  
462              
463 7         13 my ($width, $height) = ( -$end_x + 1, -$end_y + 1) ;
464              
465 7         9 my ($position_x, $position_y) = (0, 0) ;
466 7         7 my @stripes ;
467              
468             #~ require Enbugger ;
469             #~ Enbugger->stop ;
470              
471 7 100       12 if($width >= $height) # enought horizontal length to have a proper diagonal up
472             {
473 4         16 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         15 for(-$position_y .. (-$end_y - 1))
483             {
484 12         27 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         12 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 100       11 if($width > $height)
504             {
505 3         8 for(1 .. ($width - $height) - 1)
506             {
507 3         11 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         10 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         6 my $number_of_verticals = ($height - $width) - 1 ;
530 3         5 my $number_of_diagonals = $height - ($number_of_verticals + 3) ;
531            
532 3         10 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         9 for(1 .. $number_of_verticals)
542             {
543 3         9 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 50       11 push @stripes,
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         91 for(1 .. $number_of_diagonals)
563             {
564 3         7 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         9 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         35 return(\@stripes, $width, $height) ;
585             }
586              
587             #--------------------------------------------------------------------------------------------------------------
588              
589             sub draw_leftup
590             {
591 7     7 0 15 my ($glyphs, $end_x, $end_y) = @_ ;
592              
593 7         9 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'left-up'}} ;
  7         24  
594              
595 7         21 my ($width, $height) = ( -$end_x + 1, -$end_y + 1) ;
596              
597 7         15 my ($position_x, $position_y) = (0, 0) ;
598 7         10 my @stripes ;
599              
600 7 100       19 if($width > $height) # enought horizontal length to have a proper diagonal up
601             {
602 3         9 my $start_body_connector = $connection . $body_2 x (($width - $height) - 1) . $start ;
603            
604 3         16 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         6 $position_x -= length($start_body_connector) ;
614            
615 3         11 for(1 .. ($height - 2)) # two connectors
616             {
617 9         29 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         11 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         10 my $number_of_verticals = $height - $width ;
639 4         9 my $number_of_diagonals = $height - ($number_of_verticals + 2) ;
640            
641 4         25 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         13 for(1 .. $number_of_diagonals)
651             {
652 6         23 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 100       23 push @stripes,
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         12 for(1 .. $number_of_verticals - 1)
672             {
673 3         12 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         16 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         45 return(\@stripes, $width, $height) ;
695             }
696              
697             #---------------------------------------------------------------------------------
698              
699             sub draw_rightup
700             {
701 7     7 0 26 my ($glyphs, $end_x, $end_y) = @_ ;
702              
703 7         16 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'right-up'}} ;
  7         38  
704              
705 7         28 my ($width, $height) = ( $end_x + 1, -$end_y + 1) ;
706              
707 7         17 my ($position_x, $position_y) = (0, 0) ;
708 7         16 my @stripes ;
709              
710 7 100       28 if($end_x > -$end_y)
711             {
712 3         21 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         18 for(1 .. ($width - $height) - 1)
722             {
723 3         15 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         18 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         10 for($position_x .. ($end_x - 1))
743             {
744 9         39 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         16 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 100       20 my $number_of_verticals = ($height == $width) ? 0 : ($height - $width) -1 ;
766 4 100       14 my $has_diagonal_connection = ($height == $width) ? 0 : 1 ;
767            
768 4         11 my $number_of_diagonals = $height - ($number_of_verticals + 2 + $has_diagonal_connection) ;
769            
770 4         37 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         17 for(1 .. $number_of_diagonals)
780             {
781 6         28 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 100       27 push @stripes,
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         15 for(1 .. $number_of_verticals)
801             {
802 3         13 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 50       325 push @stripes,
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         67 return(\@stripes, $width, $height) ;
823             }
824              
825             #---------------------------------------------------------------------------------
826              
827             sub draw_downleft
828             {
829 7     7 0 26 my ($glyphs, $end_x, $end_y) = @_ ;
830              
831 7         18 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'down-left'}} ;
  7         38  
832              
833 7         27 my ($width, $height) = ( -$end_x + 1, $end_y + 1) ;
834              
835 7         20 my ($position_x, $position_y) = (0, 0) ;
836 7         16 my @stripes ;
837              
838 7 100       26 if($width >= $height) # enought horizontal length to have a proper diagonal up
839             {
840 4         31 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         20 for(1 .. ($height - 2)) # two connectors
850             {
851 12         45 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         12 my $left_text = '' ;
862 4 100       41 $left_text .= $body_2 x (($width - $height) - 1) if $width > $height ;
863            
864 4 100       21 if($width > $height)
865             {
866 3         11 $left_text = $end . $body_2 x (($width - $height) - 1) ;
867             }
868            
869 4         25 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         25 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         16 for (1 .. ($height - $width) - 1)
890             {
891 3         15 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 50       14 if($end_x != 0)
902             {
903 3         16 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         14 for(1 .. (-$end_x + $position_x))
914             {
915 3         14 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         33 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         61 return(\@stripes, $width, $height) ;
936             }
937              
938             #----------------------------------------------------------------------------------------------------------
939              
940             sub draw_leftdown
941             {
942 7     7 0 24 my ($glyphs, $end_x, $end_y) = @_ ;
943              
944 7         17 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'left-down'}} ;
  7         38  
945              
946 7         30 my ($width, $height) = ( -$end_x + 1, $end_y + 1) ;
947              
948 7         19 my ($position_x, $position_y) = (0, 0) ;
949 7         14 my @stripes ;
950              
951 7 100       25 if($width >= $height) # enought horizontal length to have a proper diagonal up
952             {
953 4         9 my $start_body_connector = $connection;
954 4 100       23 $start_body_connector .= $body_2 x (($width - $height) - 1) if $width > $height ;
955            
956 4 100       15 if($width > $height)
957             {
958 3         6 $start_body_connector .= $start ;
959             }
960            
961 4         32 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         12 $position_x -= length($start_body_connector) ;
971            
972 4         18 for(1 .. ($height - 2)) # two connectors
973             {
974 12         46 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         20 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         25 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         14 for(1 .. (-$end_x + $position_x))
1005             {
1006 3         15 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 50       13 if($end_x != 0)
1017             {
1018 3         19 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         14 for (1 .. ($height - $width) - 1)
1029             {
1030 3         13 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         17 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         53 return(\@stripes, $width, $height) ;
1051             }
1052              
1053             #----------------------------------------------------------------------------------------------------------
1054              
1055             sub draw_downright
1056             {
1057 7     7 0 13 my ($glyphs, $end_x, $end_y) = @_ ;
1058              
1059 7         12 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'down-right'}} ;
  7         28  
1060              
1061 7         18 my ($width, $height) = ( $end_x + 1, $end_y + 1) ;
1062              
1063 7         16 my ($position_x, $position_y) = (0, 0) ;
1064 7         11 my @stripes ;
1065              
1066             #~ require Enbugger ;
1067             #~ Enbugger->stop ;
1068              
1069 7 100       44 if($end_x >= $end_y) # enought horizontal length to have a proper diagonal up
1070             {
1071 4         26 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         31 for($position_y .. ($end_y - 1))
1081             {
1082 12         37 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         17 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 100       15 if($end_x > $end_y)
1102             {
1103 3         10 for($position_x .. ($end_x - 1))
1104             {
1105 3         13 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         12 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 100       20 if($end_x < $end_y) # not enought horizontal length to have a proper diagonal up
1127             {
1128 3         9 my $number_of_verticals = ($end_y - $end_x) - 1 ;
1129            
1130 3         19 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         12 for(1 .. $number_of_verticals)
1140             {
1141 3         18 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 50       17 push @stripes,
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         6 my $number_of_diagonals = $height - ($number_of_verticals + 3) ;
1161            
1162 3         7 for(1 .. $number_of_diagonals)
1163             {
1164 3         8 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         11 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         62 return(\@stripes, $width, $height) ;
1185             }
1186              
1187             #----------------------------------------------------------------------------------------------------------
1188              
1189             sub draw_rightdown
1190             {
1191 7     7 0 23 my ($glyphs, $end_x, $end_y) = @_ ;
1192              
1193 7         17 my ($start, $body, $connection, $body_2, $end, $vertical, $diagonal_connection) = @{$glyphs->{'right-down'}} ;
  7         32  
1194              
1195 7         18 my ($width, $height) = ( $end_x + 1, $end_y + 1) ;
1196              
1197 7         16 my ($position_x, $position_y) = (0, 0) ;
1198 7         12 my @stripes ;
1199              
1200 7 100       28 if($end_x >= $end_y) # enought horizontal length to have a proper diagonal down
1201             {
1202 4 100       12 if($end_x > $end_y)
1203             {
1204 3         20 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         13 for(1 .. ($end_x - $end_y) - 1)
1214             {
1215 3         12 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         18 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         11 for(1 .. ($end_y - $position_y))
1236             {
1237 12         30 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         18 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 100       28 if($end_x < $end_y) # not enought horizontal length to have a proper diagonal up
1258             {
1259 3         21 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         13 for(1 .. (($end_x - 1) - $position_x))
1269             {
1270 3         4 $position_x++ ;
1271 3         10 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 50       9 if($end_x != 0)
1282             {
1283 3         6 $position_x++ ;
1284 3         10 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         8 for (0 .. ($end_y -$position_y) - 1)
1295             {
1296 3         11 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         10 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         65 return(\@stripes, $width, $height) ;
1317             }
1318              
1319             #-----------------------------------------------------------------------------
1320              
1321             sub get_selection_action
1322             {
1323 0     0 0 0 my ($self, $x, $y) = @_ ;
1324              
1325 0 0 0     0 if (
      0        
      0        
1326             ($x == 0 && $y == 0)
1327             || ($x == $self->{END_X} && $y == $self->{END_Y})
1328             )
1329             {
1330 0         0 'resize' ;
1331             }
1332             else
1333             {
1334 0         0 'move' ;
1335             }
1336             }
1337              
1338             #-----------------------------------------------------------------------------
1339              
1340             sub get_connector_points
1341             {
1342 73     73 0 213 my ($self) = @_ ;
1343              
1344             return
1345             (
1346             {X => 0, Y => 0, NAME => 'start'},
1347 73         603 {X => $self->{END_X}, Y => $self->{END_Y}, NAME => 'end'},
1348             ) ;
1349             }
1350             #-----------------------------------------------------------------------------
1351              
1352             sub get_named_connection
1353             {
1354 0     0 0   my ($self, $name) = @_ ;
1355              
1356 0 0         if($name eq 'start')
    0          
1357             {
1358 0 0         return( {X => 0, Y => 0, NAME => 'start', CHAR => $self->{GLYPHS}{$self->{DIRECTION}}[0]} ) if exists $self->{GLYPHS} ;
1359 0           return( {X => 0, Y => 0, NAME => 'start', CHAR => '?'} ) ;
1360             }
1361             elsif($name eq 'end')
1362             {
1363 0 0         return( {X => $self->{END_X}, Y => $self->{END_Y}, NAME => 'end', CHAR => $self->{GLYPHS}{$self->{DIRECTION}}[4]} ) if exists $self->{GLYPHS} ;
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             {
1376 0     0 0   my ($self) = @_ ;
1377              
1378 0           return $self->{DIRECTION} ;
1379             }
1380              
1381             #-----------------------------------------------------------------------------
1382              
1383             sub change_direction
1384             {
1385 0     0 0   my ($self, $x, $y) = @_ ;
1386              
1387 0           my $direction = $self->get_direction() ;
1388              
1389 0 0         if($direction =~ /(.*)-(.*)/)
1390             {
1391 0           $self->resize(0, 0, 0, 0, "$2-$1") ;
1392             }
1393             }
1394              
1395             #-----------------------------------------------------------------------------
1396              
1397             sub move_connector
1398             {
1399 0     0 0   my ($self, $connector_name, $x_offset, $y_offset, $hint) = @_ ;
1400              
1401 0 0         if($connector_name eq 'start')
    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             {
1429 0     0 0   my ($self, $reference_x, $reference_y, $new_x, $new_y, $hint, $connector_name) = @_ ;
1430              
1431 0           my $is_start ;
1432              
1433 0 0         if(defined $connector_name)
1434             {
1435 0 0         if($connector_name eq 'start')
1436             {
1437 0           $is_start++ ;
1438             }
1439             }
1440             else
1441             {
1442 0 0 0       if($reference_x == 0 && $reference_y == 0)
1443             {
1444 0           $is_start++ ;
1445             }
1446             }
1447              
1448 0 0         if($is_start)
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   0       $self->setup($self->{ARROW_TYPE}, $new_end_x, $new_end_y, $hint || $self->{DIRECTION}, $self->{EDITABLE}) ;
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   0       $self->setup($self->{ARROW_TYPE}, $new_end_x, $new_end_y, $hint || $self->{DIRECTION}, $self->{EDITABLE}) ;
1466            
1467 0           return(0, 0, $self->{WIDTH}, $self->{HEIGHT}, 'end') ;
1468             }
1469             }
1470              
1471             #-----------------------------------------------------------------------------
1472              
1473 0     0 0   sub get_all_points { my ($self) = @_ ; $self->get_connector_points() ; }
  0            
1474              
1475             #-----------------------------------------------------------------------------
1476              
1477 0     0 0   sub get_section_direction { my ($self, $section_index) = @_ ; return $self->{DIRECTION} ; }
  0            
1478              
1479             #-----------------------------------------------------------------------------
1480              
1481             sub edit
1482             {
1483 0     0 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             {
1500 0     0 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 ;