line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GraphViz::Graph::Label; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
61
|
use warnings; |
|
8
|
|
|
|
|
22
|
|
|
8
|
|
|
|
|
286
|
|
4
|
8
|
|
|
8
|
|
53
|
use strict; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
220
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
51
|
use Carp; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
3637
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#_{ Methods |
9
|
|
|
|
|
|
|
#_{ POD |
10
|
|
|
|
|
|
|
=encoding utf8 |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 METHODS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#_} |
17
|
|
|
|
|
|
|
sub new { #_{ |
18
|
|
|
|
|
|
|
#_{ POD |
19
|
|
|
|
|
|
|
=head2 new |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
#_} |
23
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
24
|
0
|
|
|
|
|
|
my $opts = shift; |
25
|
0
|
|
|
|
|
|
my $self = {}; |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
croak 'Options expected' unless defined $opts; |
28
|
0
|
0
|
|
|
|
|
croak 'Options must be a HASH' unless ref $opts eq 'HASH'; |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
if ($opts->{text}) { |
|
|
0
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$self->{type} = 'text'; |
32
|
0
|
|
|
|
|
|
$self->{text_or_html} = delete $opts->{text}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
elsif ($opts->{html}) { |
35
|
0
|
|
|
|
|
|
$self->{type} = 'html'; |
36
|
0
|
|
|
|
|
|
$self->{text_or_html} = delete $opts->{html}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
0
|
|
|
|
|
|
croak "A label must be either a text or a html label"; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
croak "Unrecognized opts " . join "/", keys %$opts if keys %$opts; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
bless $self, $class; |
45
|
0
|
|
|
|
|
|
return $self; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} #_} |
48
|
|
|
|
|
|
|
sub loc { #_{ |
49
|
|
|
|
|
|
|
#_{ POD |
50
|
|
|
|
|
|
|
=head2 loc |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $label = $graph -> label(…); |
53
|
|
|
|
|
|
|
$label->loc('t'); # put label to top of graph |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
For I, only C<"t"> (I)and C<"b"> (I, default) are allowed. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Possible values for I seem to be C<"t">, C<"b"> and C<"c"> (I, default). The value is only used when the height of the node is larger than the height of its label. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
#_} |
61
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
62
|
0
|
|
|
|
|
|
my $loc = shift; |
63
|
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
carp "$loc is not in c, b, t" unless grep { $_ eq $loc} qw(c b t); |
|
0
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$self->{loc} = $loc; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return $self; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} #_} |
71
|
|
|
|
|
|
|
sub dot_text { #_{ |
72
|
|
|
|
|
|
|
#_{ POD |
73
|
|
|
|
|
|
|
=head2 dot_text |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
#_} |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my $ret = ''; |
81
|
|
|
|
|
|
|
|
82
|
0
|
0
|
|
|
|
|
if ($self->{type} eq 'text') { |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
$ret = " |
85
|
|
|
|
|
|
|
label=\"$self->{text_or_html}\" |
86
|
|
|
|
|
|
|
"; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
else { |
90
|
0
|
|
|
|
|
|
$ret = " |
91
|
|
|
|
|
|
|
label=<$self->{text_or_html}> |
92
|
|
|
|
|
|
|
"; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
0
|
0
|
|
|
|
|
if ($self->{loc}) { |
96
|
0
|
|
|
|
|
|
$ret .= " labelloc=$self->{loc} |
97
|
|
|
|
|
|
|
"; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
return $ret; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
} #_} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#_} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
'tq84'; |