line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVG::Graph::Glyph; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
47
|
use strict; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
281
|
|
4
|
7
|
|
|
7
|
|
37
|
use Data::Dumper; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
6582
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head2 new |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Title : new |
9
|
|
|
|
|
|
|
Usage : |
10
|
|
|
|
|
|
|
Function: |
11
|
|
|
|
|
|
|
Example : |
12
|
|
|
|
|
|
|
Returns : |
13
|
|
|
|
|
|
|
Args : |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
14
|
|
|
14
|
1
|
72
|
my($class, %args) = @_; |
20
|
14
|
|
|
|
|
116
|
my $self = bless {}, $class; |
21
|
14
|
|
|
|
|
83
|
$self->init(%args); |
22
|
14
|
|
|
|
|
61
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 init |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Title : init |
28
|
|
|
|
|
|
|
Usage : |
29
|
|
|
|
|
|
|
Function: |
30
|
|
|
|
|
|
|
Example : |
31
|
|
|
|
|
|
|
Returns : |
32
|
|
|
|
|
|
|
Args : |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub init { |
38
|
14
|
|
|
14
|
1
|
50
|
my($self, %args) = @_; |
39
|
|
|
|
|
|
|
|
40
|
14
|
|
|
|
|
149
|
my $id = sprintf("%07d",int(rand(9999999))); |
41
|
14
|
|
|
|
|
109
|
my($glyphname) = ref($self) =~ /::([^:]+)$/; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
14
|
|
|
|
|
48
|
foreach my $arg (keys %args){ |
45
|
94
|
|
|
|
|
135
|
my $meth = $arg; |
46
|
|
|
|
|
|
|
#caveat, all constructor args will now pass |
47
|
94
|
100
|
|
|
|
464
|
if($self->can($meth)){ |
48
|
84
|
|
|
|
|
194
|
$self->$meth($args{$arg}); |
49
|
|
|
|
|
|
|
} else { |
50
|
10
|
|
|
|
|
38
|
$self->_style($arg => $args{$arg}); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
14
|
50
|
|
|
|
73
|
$self->canvas($self->svg->group(id=>"$glyphname$id")) unless $self->canvas; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 _style |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Title : _style |
60
|
|
|
|
|
|
|
Usage : $obj->_style($newval) |
61
|
|
|
|
|
|
|
Function: |
62
|
|
|
|
|
|
|
Example : |
63
|
|
|
|
|
|
|
Returns : |
64
|
|
|
|
|
|
|
Args : |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _style{ |
70
|
200
|
|
|
200
|
|
242
|
my $self = shift; |
71
|
200
|
|
|
|
|
245
|
my($key,$val) = @_; |
72
|
|
|
|
|
|
|
|
73
|
200
|
50
|
66
|
|
|
877
|
if(defined($key) and not defined($val)){ |
|
|
100
|
66
|
|
|
|
|
74
|
0
|
|
|
|
|
0
|
return $self->{'_style'}{$key}; |
75
|
|
|
|
|
|
|
} elsif(defined($key) and defined($val)){ |
76
|
10
|
|
|
|
|
24
|
$self->{'_style'}{$key} = $val; |
77
|
10
|
|
|
|
|
25
|
return $val; |
78
|
|
|
|
|
|
|
} else { |
79
|
190
|
100
|
|
|
|
643
|
return $self->{'_style'} ? %{$self->{'_style'}} : (); |
|
104
|
|
|
|
|
866
|
|
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 draw |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Title : draw |
86
|
|
|
|
|
|
|
Usage : |
87
|
|
|
|
|
|
|
Function: |
88
|
|
|
|
|
|
|
Example : |
89
|
|
|
|
|
|
|
Returns : |
90
|
|
|
|
|
|
|
Args : |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub draw{ |
96
|
0
|
|
|
0
|
1
|
0
|
my ($self,@args) = @_; |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
0
|
die "method undefined by ".__PACKAGE__; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 svg |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Title : svg |
104
|
|
|
|
|
|
|
Usage : $obj->svg($newval) |
105
|
|
|
|
|
|
|
Function: |
106
|
|
|
|
|
|
|
Example : |
107
|
|
|
|
|
|
|
Returns : value of svg (a scalar) |
108
|
|
|
|
|
|
|
Args : on set, new value (a scalar or undef, optional) |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub svg{ |
114
|
61
|
|
|
61
|
1
|
75
|
my $self = shift; |
115
|
|
|
|
|
|
|
|
116
|
61
|
100
|
|
|
|
156
|
return $self->{'svg'} = shift if @_; |
117
|
47
|
|
|
|
|
258
|
return $self->{'svg'}; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 group |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Title : group |
123
|
|
|
|
|
|
|
Usage : $obj->group($newval) |
124
|
|
|
|
|
|
|
Function: |
125
|
|
|
|
|
|
|
Example : |
126
|
|
|
|
|
|
|
Returns : value of group (a scalar) |
127
|
|
|
|
|
|
|
Args : on set, new value (a scalar or undef, optional) |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub group{ |
133
|
450
|
|
|
450
|
1
|
525
|
my $self = shift; |
134
|
|
|
|
|
|
|
|
135
|
450
|
100
|
|
|
|
885
|
return $self->{'group'} = shift if @_; |
136
|
436
|
|
|
|
|
1411
|
return $self->{'group'}; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 xsize |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Title : xsize |
142
|
|
|
|
|
|
|
Usage : $obj->xsize($newval) |
143
|
|
|
|
|
|
|
Function: |
144
|
|
|
|
|
|
|
Example : |
145
|
|
|
|
|
|
|
Returns : value of xsize (a scalar) |
146
|
|
|
|
|
|
|
Args : on set, new value (a scalar or undef, optional) |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub xsize{ |
152
|
172
|
|
|
172
|
1
|
191
|
my $self = shift; |
153
|
|
|
|
|
|
|
|
154
|
172
|
100
|
|
|
|
343
|
return $self->{'xsize'} = shift if @_; |
155
|
158
|
|
|
|
|
509
|
return $self->{'xsize'}; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 ysize |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Title : ysize |
161
|
|
|
|
|
|
|
Usage : $obj->ysize($newval) |
162
|
|
|
|
|
|
|
Function: |
163
|
|
|
|
|
|
|
Example : |
164
|
|
|
|
|
|
|
Returns : value of ysize (a scalar) |
165
|
|
|
|
|
|
|
Args : on set, new value (a scalar or undef, optional) |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=cut |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub ysize{ |
171
|
118
|
|
|
118
|
1
|
131
|
my $self = shift; |
172
|
|
|
|
|
|
|
|
173
|
118
|
100
|
|
|
|
292
|
return $self->{'ysize'} = shift if @_; |
174
|
104
|
|
|
|
|
302
|
return $self->{'ysize'}; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head2 xoffset |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Title : xoffset |
180
|
|
|
|
|
|
|
Usage : $obj->xoffset($newval) |
181
|
|
|
|
|
|
|
Function: |
182
|
|
|
|
|
|
|
Example : |
183
|
|
|
|
|
|
|
Returns : value of xoffset (a scalar) |
184
|
|
|
|
|
|
|
Args : on set, new value (a scalar or undef, optional) |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=cut |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub xoffset{ |
190
|
211
|
|
|
211
|
1
|
1054
|
my $self = shift; |
191
|
|
|
|
|
|
|
|
192
|
211
|
100
|
|
|
|
457
|
return $self->{'xoffset'} = shift if @_; |
193
|
197
|
|
|
|
|
501
|
return $self->{'xoffset'}; |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head2 yoffset |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Title : yoffset |
199
|
|
|
|
|
|
|
Usage : $obj->yoffset($newval) |
200
|
|
|
|
|
|
|
Function: |
201
|
|
|
|
|
|
|
Example : |
202
|
|
|
|
|
|
|
Returns : value of yoffset (a scalar) |
203
|
|
|
|
|
|
|
Args : on set, new value (a scalar or undef, optional) |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub yoffset{ |
209
|
211
|
|
|
211
|
1
|
994
|
my $self = shift; |
210
|
|
|
|
|
|
|
|
211
|
211
|
100
|
|
|
|
447
|
return $self->{'yoffset'} = shift if @_; |
212
|
197
|
|
|
|
|
451
|
return $self->{'yoffset'}; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head2 xscale |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Title : xscale |
218
|
|
|
|
|
|
|
Usage : |
219
|
|
|
|
|
|
|
Function: |
220
|
|
|
|
|
|
|
Example : |
221
|
|
|
|
|
|
|
Returns : |
222
|
|
|
|
|
|
|
Args : |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=cut |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub xscale{ |
228
|
20
|
|
|
20
|
1
|
108
|
my ($self,@args) = @_; |
229
|
|
|
|
|
|
|
|
230
|
20
|
|
|
|
|
40
|
return $self->xsize / $self->group->xrange; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 yscale |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
Title : yscale |
236
|
|
|
|
|
|
|
Usage : |
237
|
|
|
|
|
|
|
Function: |
238
|
|
|
|
|
|
|
Example : |
239
|
|
|
|
|
|
|
Returns : |
240
|
|
|
|
|
|
|
Args : |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=cut |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub yscale{ |
246
|
20
|
|
|
20
|
1
|
112
|
my ($self,@args) = @_; |
247
|
|
|
|
|
|
|
|
248
|
20
|
|
|
|
|
35
|
return $self->ysize / $self->group->yrange; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head2 canvas |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Title : canvas |
254
|
|
|
|
|
|
|
Usage : $obj->canvas($newval) |
255
|
|
|
|
|
|
|
Function: |
256
|
|
|
|
|
|
|
Example : |
257
|
|
|
|
|
|
|
Returns : value of canvas (a scalar) |
258
|
|
|
|
|
|
|
Args : on set, new value (a scalar or undef, optional) |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=cut |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
sub canvas{ |
264
|
28
|
|
|
28
|
1
|
1064
|
my $self = shift; |
265
|
|
|
|
|
|
|
|
266
|
28
|
100
|
|
|
|
116
|
return $self->{'canvas'} = shift if @_; |
267
|
14
|
|
|
|
|
61
|
return $self->{'canvas'}; |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
1; |