FigAnim.pm

filter: Statementstmt 4.1% 41 / 983 Branchbran 0.0% 0 / 244 Conditioncond 0.0% 0 / 99 MC/DCmcdc 0.0% 0 / 58 Subroutinesub 40.6% 13 / 32 Podpod 47.3% 9 / 19 totaltotal 4.3% 63 / 1435 CC 194 SCAR 71.9
CC
194
Cov
3%
generateGif
3660.0
parseObjects
1332.0
writeSMILObjects
650.0
CRAP 1330.9
↑ Summary FigAnim/ConvertSVG.pm »
1 package FigAnim;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '0.1';
7  
8 # useful classes
9 1 ▶use FigAnim::Color;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use FigAnim::Arc;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use FigAnim::Compound;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use FigAnim::Ellipse;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use FigAnim::Polyline;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use FigAnim::Spline;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use FigAnim::Text;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use FigAnim::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use FigAnim::ConvertSVG;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use FigAnim::ConvertSMIL;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use Math::Trig qw(deg2rad
Subroutine BEGIN: called CC=1 SCAR=0.0
20 cartesian_to_cylindrical
21 1 cylindrical_to_cartesian);
22  
23 # constructor
24 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
25 0 my $proto = shift;
26 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
27 0 my $self = {};
28
29 0 $self->{title} = "";
30
31 # header
32 0 $self->{version} = undef;
33 0 $self->{orientation} = undef;
34 0 $self->{justification} = undef;
35 0 $self->{units} = undef;
36 0 $self->{papersize} = undef;
37 0 $self->{magnification} = undef;
38 0 $self->{multiple_page} = undef;
39 0 $self->{transparent_color} = undef;
40 0 $self->{resolution} = undef;
41 0 $self->{coord_system} = undef;
42
43 # array containing the Color objects
44 0 $self->{colors} = [];
45
46 # arrays containing every object's name classified by type
47 0 $self->{arcs} = [];
48 0 $self->{compounds} = [];
49 0 $self->{ellipses} = [];
50 0 $self->{polylines} = [];
51 0 $self->{splines} = [];
52 0 $self->{texts} = [];
53
54 # hash containing all the objects (except Color objects)
55 # with their names as keys
56 0 $self->{objects} = {};
57
58 # number of the current unnamed object
59 0 $self->{num} = 1;
60
61 # array containing all the animations
62 0 $self->{animations} = [];
63
64 0 bless ($self, $class);
65 0 return $self;
66 }
67  
68  
69 # methods
70 0 ▶sub clone {
Subroutine clone: not called CC=4 SCAR=30.0
Pod undocumented
71 0 my $self = shift;
72 0 my $obj = new FigAnim;
73
74 0 foreach ('title','version','orientation','justification','units',
75 'papersize','magnification','multiple_page','transparent_color',
76 'resolution','coord_system','arcs','compounds','ellipses',
77 'polylines','splines','texts') {
78 0 $obj->{$_} = $self->{$_};
79 }
80
81 0 foreach (@{$self->{colors}}) {
82 0 push @{$obj->{colors}}, $_->clone();
83 }
84
85 0 foreach (keys %{$self->{objects}}) {
86 0 $obj->{objects}->{$_} = $self->{objects}->{$_}->clone();
87 0 $obj->{objects}->{$_}->{fig_file} = $obj;
88 }
89
90 0 return $obj;
91 }
92  
93  
94 # parser
95 0 ▶sub parseFile {
Subroutine parseFile: not called CC=2 SCAR=17.9
Pod documented
96 0 my $self = shift;
97 0 my $filename = shift;
98
99 0 ▶ open IN, "<$filename" or die "Can't open $filename : $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open IN, "<$filename" or die "Can't open $filename : $!\n" 0 0 0
100
101 0 $self->parseHeader(\*IN);
102 0 $self->parseObjects(\*IN,$self);
103
104 0 close IN;
105 }
106  
107 0 ▶sub parseHeader {
Subroutine parseHeader: not called CC=3 SCAR=24.8
Pod undocumented
108 0 my $self = shift;
109 0 my $fh = shift;
110
111 0 my $line = <$fh>;
112 0 ▶ return unless ($line =~ /^\#FIG (\d(.\d)*)\n$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $line =~ /^\#FIG (\d(.\d)*)\n$/ 0 0 0
113 0 $self->{version} = $1;
114 0 $self->{orientation} = nextline($fh);
115 0 $self->{justification} = nextline($fh);
116 0 $self->{units} = nextline($fh);
117 0 $self->{papersize} = nextline($fh);
118 0 $self->{magnification} = nextline($fh);
119 0 $self->{multiple_page} = nextline($fh);
120 0 $self->{transparent_color} = nextline($fh);
121 0 ▶ while (($line = nextline($fh)) =~ /^\# /) {
Branch: 1 branch
BranchTrueFalseTotal
if (($line = nextline($fh)) =~ /^\# /) 0 0 0
122 0 $line =~ s/\# //;
123 0 $self->{title} .= $line . "\n";
124 }
125 0 ($self->{resolution}, $self->{coord_system}) = split / /, $line;
126 }
127  
128 0 ▶sub parseObjects {
Subroutine parseObjects: not called CC=36 SCAR=71.9
Pod undocumented
129 0 my $self = shift;
130 0 my $fh = shift;
131 0 my $current = shift;
132 0 my ($line, $object_code, $object, @attr);
133 0 my $name = "";
134
135 0 ▶ while ($line = nextline($fh)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line = nextline($fh)) 0 0 0
136 0 ▶ return if ($line =~ /^-6/);
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ /^-6/ 0 0 0
137
138 0 @attr = split / /, $line;
139 0 $object_code = shift @attr;
140
141 0 ▶ if ($object_code eq "0") { # Color
Branch: 8 branches
BranchTrueFalseTotal
if ($object_code eq '0') { } 0 0 0
elsif ($object_code eq '#') { } 0 0 0
elsif ($object_code eq '5') { } 0 0 0
elsif ($object_code eq '6') { } 0 0 0
elsif ($object_code eq '1') { } 0 0 0
elsif ($object_code eq '2') { } 0 0 0
elsif ($object_code eq '3') { } 0 0 0
elsif ($object_code eq '4') { } 0 0 0
142 0 $object = new Color(@attr);
143 0 push @{$self->{colors}}, $object;
144 }
145
146 elsif ($object_code eq "#") { # Comment
147 0 $line =~ s/^\# //;
148 0 $name .= $line . "\n";
149 }
150
151 elsif ($object_code eq "5") { # Arc
152 0 ▶ if ($attr[11]) { # forward_arrow == 1
Branch: 1 branch
BranchTrueFalseTotal
if ($attr[11]) { } 0 0 0
153 0 $line = nextline($fh);
154 0 $line =~ s/^[\t ]*//;
155 0 push @attr, (split / /, $line);
156 } else {
157 0 push @attr, (undef,undef,undef,undef,undef);
158 }
159
160 0 ▶ if ($attr[12]) { # backward_arrow == 1
Branch: 1 branch
BranchTrueFalseTotal
if ($attr[12]) { } 0 0 0
161 0 $line = nextline($fh);
162 0 $line =~ s/^[\t ]*//;
163 0 push @attr, (split / /, $line);
164 } else {
165 0 push @attr, (undef,undef,undef,undef,undef);
166 }
167
168 0 $name =~ s/\n$//;
169 0 ▶ if (($name =~ /^\n*$/) || (defined $self->{objects}->{$name})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^\n*$/ or defined $self->{"objects"}{$name}) 0 0 0
Condition0%0/3
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
l!l&&r!l&&!r
000
MC/DC0%0/2
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
$name =~ /^\n*$/ defined $self->{"objects"}{$name}
Truth table0%0/3
A or B
A= $name =~ /^\n*$/B= defined $self->{"objects"}{$name}
ABresult
1X1
011
000
170 0 $name = sprintf("untitled%04d", $self->{num}++);
171 }
172 0 $object = new Arc($name,@attr,$self);
173 0 push @{$current->{arcs}}, $name;
174 0 $self->{objects}->{$name} = $object;
175 0 $name = "";
176 }
177
178 elsif ($object_code eq "6") { # Compound
179 0 $name =~ s/\n$//;
180 0 ▶ if (($name =~ /^\n*$/) || (defined $self->{objects}->{$name})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^\n*$/ or defined $self->{"objects"}{$name}) 0 0 0
Condition0%0/3
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
l!l&&r!l&&!r
000
MC/DC0%0/2
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
$name =~ /^\n*$/ defined $self->{"objects"}{$name}
Truth table0%0/3
A or B
A= $name =~ /^\n*$/B= defined $self->{"objects"}{$name}
ABresult
1X1
011
000
181 0 $name = sprintf("untitled%04d", $self->{num}++);
182 }
183 0 $object = new Compound($name,@attr,$self);
184 0 $object->calculateCenter();
185 0 push @{$current->{compounds}}, $name;
186 0 $self->{objects}->{$name} = $object;
187 0 $name = "";
188 0 $self->parseObjects(\*IN,$object);
189 }
190
191 elsif ($object_code eq "1") { # Ellipse
192 0 $name =~ s/\n$//;
193 0 ▶ if (($name =~ /^\n*$/) || (defined $self->{objects}->{$name})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^\n*$/ or defined $self->{"objects"}{$name}) 0 0 0
Condition0%0/3
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
l!l&&r!l&&!r
000
MC/DC0%0/2
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
$name =~ /^\n*$/ defined $self->{"objects"}{$name}
Truth table0%0/3
A or B
A= $name =~ /^\n*$/B= defined $self->{"objects"}{$name}
ABresult
1X1
011
000
194 0 $name = sprintf("untitled%04d", $self->{num}++);
195 }
196 0 $object = new Ellipse($name,@attr,$self);
197 0 push @{$current->{ellipses}}, $name;
198 0 $self->{objects}->{$name} = $object;
199 0 $name = "";
200 }
201
202 elsif ($object_code eq "2") { # Polyline
203 0 ▶ if ($attr[12]) { # forward_arrow == 1
Branch: 1 branch
BranchTrueFalseTotal
if ($attr[12]) { } 0 0 0
204 0 $line = nextline($fh);
205 0 $line =~ s/^[\t ]*//;
206 0 push @attr, (split / /, $line);
207 } else {
208 0 push @attr, (undef,undef,undef,undef,undef);
209 }
210
211 0 ▶ if ($attr[13]) { # backward_arrow == 1
Branch: 1 branch
BranchTrueFalseTotal
if ($attr[13]) { } 0 0 0
212 0 $line = nextline($fh);
213 0 $line =~ s/^[\t ]*//;
214 0 push @attr, (split / /, $line);
215 } else {
216 0 push @attr, (undef,undef,undef,undef,undef);
217 }
218
219 0 ▶ if ($attr[0] == 5) { # sub_type == 5
Branch: 1 branch
BranchTrueFalseTotal
if ($attr[0] == 5) { } 0 0 0
220 0 $line = nextline($fh);
221 0 $line =~ s/^[\t ]*//;
222 0 push @attr, (split / /, $line);
223 } else {
224 0 push @attr, (undef,undef);
225 }
226
227 0 my $npoints = $attr[14];
228 0 my(@xnpoints, @ynpoints);
229 0 ▶ until ($npoints == 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($npoints == 0) 0 0 0
230 0 $line = nextline($fh);
231 0 $line =~ s/^[\t ]*//;
232 0 my @points = split / /, $line;
233 0 $npoints -= (scalar(@points) / 2);
234 0 ▶ while (@points) {
Branch: 1 branch
BranchTrueFalseTotal
if (@points) 0 0 0
235 0 push @xnpoints, (shift @points);
236 0 push @ynpoints, (shift @points);
237 }
238 }
239
240 0 $name =~ s/\n$//;
241 0 ▶ if (($name =~ /^\n*$/) || (defined $self->{objects}->{$name})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^\n*$/ or defined $self->{"objects"}{$name}) 0 0 0
Condition0%0/3
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
l!l&&r!l&&!r
000
MC/DC0%0/2
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
$name =~ /^\n*$/ defined $self->{"objects"}{$name}
Truth table0%0/3
A or B
A= $name =~ /^\n*$/B= defined $self->{"objects"}{$name}
ABresult
1X1
011
000
242 0 $name = sprintf("untitled%04d", $self->{num}++);
243 }
244 0 $object = new Polyline($name,@attr,\@xnpoints,\@ynpoints,$self);
245 0 $object->calculateCenter();
246 0 push @{$current->{polylines}}, $name;
247 0 $self->{objects}->{$name} = $object;
248 0 $name = "";
249 }
250
251 elsif ($object_code eq "3") { # Spline
252 0 ▶ if ($attr[10]) { # forward_arrow == 1
Branch: 1 branch
BranchTrueFalseTotal
if ($attr[10]) { } 0 0 0
253 0 $line = nextline($fh);
254 0 $line =~ s/^[\t ]*//;
255 0 push @attr, (split / /, $line);
256 } else {
257 0 push @attr, (undef,undef,undef,undef,undef);
258 }
259
260 0 ▶ if ($attr[11]) { # backward_arrow == 1
Branch: 1 branch
BranchTrueFalseTotal
if ($attr[11]) { } 0 0 0
261 0 $line = nextline($fh);
262 0 $line =~ s/^\t//;
263 0 push @attr, (split / /, $line);
264 } else {
265 0 push @attr, (undef,undef,undef,undef,undef);
266 }
267
268 0 my $npoints = $attr[12];
269 0 my(@xnpoints, @ynpoints);
270 0 ▶ until ($npoints == 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($npoints == 0) 0 0 0
271 0 $line = nextline($fh);
272 0 $line =~ s/^[\t ]*//;
273 0 my @points = split / /, $line;
274 0 $npoints -= (scalar(@points) / 2);
275 0 ▶ while (@points) {
Branch: 1 branch
BranchTrueFalseTotal
if (@points) 0 0 0
276 0 push @xnpoints, (shift @points);
277 0 push @ynpoints, (shift @points);
278 }
279 }
280
281 0 $npoints = $attr[12];
282 0 my @control_points;
283 0 ▶ until ($npoints == 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($npoints == 0) 0 0 0
284 0 $line = nextline($fh);
285 0 $line =~ s/^[\t ]*//;
286 0 my @points = split / /, $line;
287 0 $npoints -= scalar(@points);
288 0 push @control_points, @points;
289 }
290
291 0 $name =~ s/\n$//;
292 0 ▶ if (($name =~ /^\n*$/) || (defined $self->{objects}->{$name})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^\n*$/ or defined $self->{"objects"}{$name}) 0 0 0
Condition0%0/3
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
l!l&&r!l&&!r
000
MC/DC0%0/2
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
$name =~ /^\n*$/ defined $self->{"objects"}{$name}
Truth table0%0/3
A or B
A= $name =~ /^\n*$/B= defined $self->{"objects"}{$name}
ABresult
1X1
011
000
293 0 $name = sprintf("untitled%04d", $self->{num}++);
294 }
295 0 $object = new Spline($name,@attr,\@xnpoints,\@ynpoints,
296 \@control_points,$self);
297 0 $object->calculateCenter();
298 0 push @{$current->{splines}}, $name;
299 0 $self->{objects}->{$name} = $object;
300 0 $name = "";
301 }
302
303 elsif ($object_code eq "4") { # Text
304 0 my @new_attr = @attr[0..11];
305 0 my $chaine = "";
306 0 for (12..(scalar(@attr) - 1)) {
307 0 $chaine .= $attr[$_] . " ";
308 }
309 0 $chaine =~ s/\\001 $//;
310 0 push @new_attr, $chaine;
311
312 0 $name =~ s/\n$//;
313 0 ▶ if (($name =~ /^\n*$/) || (defined $self->{objects}->{$name})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^\n*$/ or defined $self->{"objects"}{$name}) 0 0 0
Condition0%0/3
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
l!l&&r!l&&!r
000
MC/DC0%0/2
$name =~ /^\n*$/ or defined $self->{"objects"}{$name}
$name =~ /^\n*$/ defined $self->{"objects"}{$name}
Truth table0%0/3
A or B
A= $name =~ /^\n*$/B= defined $self->{"objects"}{$name}
ABresult
1X1
011
000
314 0 $name = sprintf("untitled%04d", $self->{num}++);
315 }
316 0 $object = new Text($name,@new_attr,$self);
317 0 $object->calculateCenter();
318 0 push @{$current->{texts}}, $name;
319 0 $self->{objects}->{$name} = $object;
320 0 $name = "";
321 }
322
323 else {
324
325 }
326 }
327 }
328  
329  
330 # printer
331 0 ▶sub writeFile {
Subroutine writeFile: not called CC=2 SCAR=17.9
Pod documented
332 0 my $self = shift;
333 0 my $filename = shift;
334
335 0 ▶ open OUT, ">$filename" or die "Can't open $filename : $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open OUT, ">$filename" or die "Can't open $filename : $!\n" 0 0 0
336
337 0 $self->writeHeader(\*OUT);
338 0 $self->writeObjects(\*OUT);
339
340 0 close OUT;
341 }
342  
343 0 ▶sub writeHeader {
Subroutine writeHeader: not called CC=3 SCAR=24.8
Pod undocumented
344 0 my $self = shift;
345 0 my $fh = shift;
346
347 0 printf $fh "#FIG %s\n", $self->{version};
348 0 printf $fh "%s\n", $self->{orientation};
349 0 printf $fh "%s\n", $self->{justification};
350 0 printf $fh "%s\n", $self->{units};
351 0 printf $fh "%s\n", $self->{papersize};
352 0 printf $fh "%.2f\n", $self->{magnification};
353 0 printf $fh "%s\n", $self->{multiple_page};
354 0 printf $fh "%d\n", $self->{transparent_color};
355 0 ▶ if ($self->{title} ne "") {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"title"} ne "") 0 0 0
356 0 foreach (split(/\n/, $self->{title})) {
357 0 printf $fh "# $_\n";
358 }
359 }
360 0 printf $fh "%d %d\n", $self->{resolution}, $self->{coord_system};
361 }
362  
363 0 ▶sub writeObjects {
Subroutine writeObjects: not called CC=8 SCAR=42.8
Pod undocumented
364 0 my $self = shift;
365 0 my $fh = shift;
366
367 0 foreach (@{$self->{colors}}) {
368 0 $_->output($fh);
369 }
370
371 0 foreach (@{$self->{arcs}}) {
372 0 $self->{objects}->{$_}->output($fh);
373 }
374
375 0 foreach (@{$self->{compounds}}) {
376 0 $self->{objects}->{$_}->output($fh);
377 }
378
379 0 foreach (@{$self->{ellipses}}) {
380 0 $self->{objects}->{$_}->output($fh);
381 }
382
383 0 foreach (@{$self->{polylines}}) {
384 0 $self->{objects}->{$_}->output($fh);
385 }
386
387 0 foreach (@{$self->{splines}}) {
388 0 $self->{objects}->{$_}->output($fh);
389 }
390
391 0 foreach (@{$self->{texts}}) {
392 0 $self->{objects}->{$_}->output($fh);
393 }
394 }
395  
396  
397 # scheduler
398 0 ▶sub generateGif {
Subroutine generateGif: not called CC=60 SCAR=82.1
Pod documented
399 0 my $self = shift;
400 0 my $file = shift;
401 0 my $speed = shift;
402 0 my $loop = shift;
403 0 my $wait = shift;
404 0 ▶ $wait = 0 if (!(defined $wait));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $wait 0 0 0
405
406 0 my $length = 1;
407 0 ▶ for (my $i=0; $i<scalar(@{$self->{animations}}); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @{$self->{"animations"};}) 0 0 0
408 # calculates the number of frames = first frame + number of frames of the each animation
409 my $count = sprintf("%.0f",$self->{animations}[$i][2]*$speed) +
410 0 sprintf("%.0f",$self->{animations}[$i][3]*$speed);
411 0 ▶ $length = $count if ($count > $length); # we choose the biggest number of frame
Branch: 1 branch
BranchTrueFalseTotal
if $count > $length 0 0 0
412 }
413
414 0 my $last = $self->clone(); # The first frame is the copy of the static image
415 0 ▶ for (my $f=0; $f<=$length; $f++) { # for each frame do
Branch: 1 branch
BranchTrueFalseTotal
if ($f <= $length) 0 0 0
416 0 my $current = $last->clone(); # the current frame is the copy of precedent
417 0 ▶ for (my $i=0; $i<scalar(@{$self->{animations}}); $i++) { # for each animation do
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @{$self->{"animations"};}) 0 0 0
418 0 my $firstframe = sprintf("%.0f",$self->{animations}[$i][2]*$speed);
419 0 my $nbframes = sprintf("%.0f",$self->{animations}[$i][3]*$speed);
420 0 ▶ if (($f > $firstframe) && ($f <= $firstframe+$nbframes)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($f > $firstframe and $f <= $firstframe + $nbframes) { } 0 0 0
elsif ($f == $firstframe) { } 0 0 0
Condition0%0/3
$f > $firstframe and $f <= $firstframe + $nbframes
!ll&&!rl&&r
000
MC/DC0%0/2
$f > $firstframe and $f <= $firstframe + $nbframes
$f > $firstframe $f <= $firstframe + $nbframes
Truth table0%0/3
A and B
A= $f > $firstframeB= $f <= $firstframe + $nbframes
ABresult
0X0
100
111
421 # if the current frame is inside the current animation do
422
423 0 ▶ if ($self->{animations}[$i][0] == 1) { # changeThickness
Branch: 17 branches
BranchTrueFalseTotal
if ($self->{'animations'}[$i][0] == 1) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 2) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 11) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 12 or $self->{'animations'}[$i][0] == 13) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 14) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 15) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 16) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 21) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 22 or $self->{'animations'}[$i][0] == 23) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 24) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 25) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 26) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 31) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 32 or $self->{'animations'}[$i][0] == 33) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 34) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 35) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 36) { } 0 0 0
424 0 my $name = $self->{animations}[$i][1];
425 0 my $inc = $self->{animations}[$i][5];
426
427 $current->{objects}->{$name}->{thickness} =
428 0 $last->{objects}->{$name}->{thickness} + $inc;
429 }
430
431 elsif ($self->{animations}[$i][0] == 2) { # changeFillIntensity
432 0 my $name = $self->{animations}[$i][1];
433 0 my $inc = $self->{animations}[$i][5];
434
435 $current->{objects}->{$name}->{area_fill} =
436 0 $last->{objects}->{$name}->{area_fill} + $inc;
437 }
438
439 elsif ($self->{animations}[$i][0] == 11) { # translate Ellipse
440 0 my $name = $self->{animations}[$i][1];
441 0 my $inc_x = $self->{animations}[$i][7];
442 0 my $inc_y = $self->{animations}[$i][8];
443
444 $current->{objects}->{$name}->{center_x} =
445 0 $last->{objects}->{$name}->{center_x} + $inc_x;
446 $current->{objects}->{$name}->{center_y} =
447 0 $last->{objects}->{$name}->{center_y} + $inc_y;
448
449 $current->{objects}->{$name}->{start_x} =
450 0 $last->{objects}->{$name}->{start_x} + $inc_x;
451 $current->{objects}->{$name}->{start_y} =
452 0 $last->{objects}->{$name}->{start_y} + $inc_y;
453
454 $current->{objects}->{$name}->{end_x} =
455 0 $last->{objects}->{$name}->{end_x} + $inc_x;
456 $current->{objects}->{$name}->{end_y} =
457 0 $last->{objects}->{$name}->{end_y} + $inc_y;
458 }
459 ▶ elsif (($self->{animations}[$i][0] == 12) || # translate
Condition0%0/3
$self->{"animations"}[$i][0] == 12 or $self->{"animations"}[$i][0] == 13
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"animations"}[$i][0] == 12 or $self->{"animations"}[$i][0] == 13
$self->{"animations"}[$i][0] == 12 $self->{"animations"}[$i][0] == 13
Truth table0%0/3
A or B
A= $self->{"animations"}[$i][0] == 12B= $self->{"animations"}[$i][0] == 13
ABresult
1X1
011
000
460 ($self->{animations}[$i][0] == 13)) { # Polyline/Spline
461 0 my $name = $self->{animations}[$i][1];
462 0 my $inc_x = $self->{animations}[$i][7];
463 0 my $inc_y = $self->{animations}[$i][8];
464
465 0 ▶ for (my $i=0; $i<$current->{objects}->{$name}->{npoints};
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $current->{"objects"}{$name}{"npoints"}) 0 0 0
466 $i++) {
467 $current->{objects}->{$name}->{xnpoints}[$i] =
468 0 $last->{objects}->{$name}->{xnpoints}[$i] + $inc_x;
469 $current->{objects}->{$name}->{ynpoints}[$i] =
470 0 $last->{objects}->{$name}->{ynpoints}[$i] + $inc_y;
471 }
472
473 $current->{objects}->{$name}->{center_x} =
474 0 $last->{objects}->{$name}->{center_x} + $inc_x;
475 $current->{objects}->{$name}->{center_y} =
476 0 $last->{objects}->{$name}->{center_y} + $inc_y;
477 }
478 elsif ($self->{animations}[$i][0] == 14) { # translate Text
479 0 my $name = $self->{animations}[$i][1];
480 0 my $inc_x = $self->{animations}[$i][7];
481 0 my $inc_y = $self->{animations}[$i][8];
482
483 $current->{objects}->{$name}->{x} =
484 0 $last->{objects}->{$name}->{x} + $inc_x;
485 $current->{objects}->{$name}->{y} =
486 0 $last->{objects}->{$name}->{y} + $inc_y;
487
488 $current->{objects}->{$name}->{center_x} =
489 0 $last->{objects}->{$name}->{center_x} + $inc_x;
490 $current->{objects}->{$name}->{center_y} =
491 0 $last->{objects}->{$name}->{center_y} + $inc_y;
492 }
493 elsif ($self->{animations}[$i][0] == 15) { # translate Arc
494 0 my $name = $self->{animations}[$i][1];
495 0 my $inc_x = $self->{animations}[$i][7];
496 0 my $inc_y = $self->{animations}[$i][8];
497
498 $current->{objects}->{$name}->{center_x} =
499 0 $last->{objects}->{$name}->{center_x} + $inc_x;
500 $current->{objects}->{$name}->{center_y} =
501 0 $last->{objects}->{$name}->{center_y} + $inc_y;
502
503 $current->{objects}->{$name}->{x1} =
504 0 $last->{objects}->{$name}->{x1} + $inc_x;
505 $current->{objects}->{$name}->{y1} =
506 0 $last->{objects}->{$name}->{y1} + $inc_y;
507
508 $current->{objects}->{$name}->{x2} =
509 0 $last->{objects}->{$name}->{x2} + $inc_x;
510 $current->{objects}->{$name}->{y2} =
511 0 $last->{objects}->{$name}->{y2} + $inc_y;
512
513 $current->{objects}->{$name}->{x3} =
514 0 $last->{objects}->{$name}->{x3} + $inc_x;
515 $current->{objects}->{$name}->{y3} =
516 0 $last->{objects}->{$name}->{y3} + $inc_y;
517 }
518 elsif ($self->{animations}[$i][0] == 16) { # translate Compound
519 0 my $name = $self->{animations}[$i][1];
520 0 my $inc_x = $self->{animations}[$i][7];
521 0 my $inc_y = $self->{animations}[$i][8];
522
523 $current->{objects}->{$name}->{upperleft_corner_x} =
524 0 $last->{objects}->{$name}->{upperleft_corner_x}+$inc_x;
525 $current->{objects}->{$name}->{upperleft_corner_y} =
526 0 $last->{objects}->{$name}->{upperleft_corner_y}+$inc_y;
527
528 $current->{objects}->{$name}->{lowerright_corner_x} =
529 0 $last->{objects}->{$name}->{lowerright_corner_x}+$inc_x;
530 $current->{objects}->{$name}->{lowerright_corner_y} =
531 0 $last->{objects}->{$name}->{lowerright_corner_y}+$inc_y;
532
533 $current->{objects}->{$name}->{center_x} =
534 0 $last->{objects}->{$name}->{center_x} + $inc_x;
535 $current->{objects}->{$name}->{center_y} =
536 0 $last->{objects}->{$name}->{center_y} + $inc_y;
537 }
538
539 elsif ($self->{animations}[$i][0] == 21) { # rotate Ellipse
540 0 my $name = $self->{animations}[$i][1];
541 0 my $c_x = $self->{animations}[$i][5];
542 0 my $c_y = $self->{animations}[$i][6];
543 0 my $inc_angle = $self->{animations}[$i][8];
544 0 my ($r,$a);
545
546 ($r,$a) = cartesian_to_cylindrical(
547 $last->{objects}->{$name}->{center_x}-$c_x,
548 0 $last->{objects}->{$name}->{center_y}-$c_y,
549 0);
550 ($current->{objects}->{$name}->{center_x},
551 0 $current->{objects}->{$name}->{center_y}) =
552 cylindrical_to_cartesian($r,$a+$inc_angle,0);
553 0 $current->{objects}->{$name}->{center_x} += $c_x;
554 0 $current->{objects}->{$name}->{center_y} += $c_y;
555
556 ($r,$a) = cartesian_to_cylindrical(
557 $last->{objects}->{$name}->{start_x}-$c_x,
558 0 $last->{objects}->{$name}->{start_y}-$c_y,
559 0);
560 ($current->{objects}->{$name}->{start_x},
561 0 $current->{objects}->{$name}->{start_y}) =
562 cylindrical_to_cartesian($r,$a+$inc_angle,0);
563 0 $current->{objects}->{$name}->{start_x} += $c_x;
564 0 $current->{objects}->{$name}->{start_y} += $c_y;
565
566 ($r,$a) = cartesian_to_cylindrical(
567 $last->{objects}->{$name}->{end_x}-$c_x,
568 0 $last->{objects}->{$name}->{end_y}-$c_y,
569 0);
570 ($current->{objects}->{$name}->{end_x},
571 0 $current->{objects}->{$name}->{end_y}) =
572 cylindrical_to_cartesian($r,$a+$inc_angle,0);
573 0 $current->{objects}->{$name}->{end_x} += $c_x;
574 0 $current->{objects}->{$name}->{end_y} += $c_y;
575
576 $current->{objects}->{$name}->{angle} =
577 0 $last->{objects}->{$name}->{angle} - $inc_angle;
578 }
579 ▶ elsif (($self->{animations}[$i][0] == 22) || # rotate
Condition0%0/3
$self->{"animations"}[$i][0] == 22 or $self->{"animations"}[$i][0] == 23
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"animations"}[$i][0] == 22 or $self->{"animations"}[$i][0] == 23
$self->{"animations"}[$i][0] == 22 $self->{"animations"}[$i][0] == 23
Truth table0%0/3
A or B
A= $self->{"animations"}[$i][0] == 22B= $self->{"animations"}[$i][0] == 23
ABresult
1X1
011
000
580 ($self->{animations}[$i][0] == 23)) { # Polyline/Spline
581 0 my $name = $self->{animations}[$i][1];
582 0 my $c_x = $self->{animations}[$i][5];
583 0 my $c_y = $self->{animations}[$i][6];
584 0 my $inc_angle = $self->{animations}[$i][8];
585 0 my ($r,$a);
586
587 0 ▶ for (my $i=0; $i<$current->{objects}->{$name}->{npoints};
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $current->{"objects"}{$name}{"npoints"}) 0 0 0
588 $i++) {
589 ($r,$a) = cartesian_to_cylindrical(
590 $last->{objects}->{$name}->{xnpoints}[$i]
591 - $c_x,
592 0 $last->{objects}->{$name}->{ynpoints}[$i]
593 - $c_y,
594 0);
595 ($current->{objects}->{$name}->{xnpoints}[$i],
596 0 $current->{objects}->{$name}->{ynpoints}[$i]) =
597 cylindrical_to_cartesian($r,$a+$inc_angle,0);
598 0 $current->{objects}->{$name}->{xnpoints}[$i] += $c_x;
599 0 $current->{objects}->{$name}->{ynpoints}[$i] += $c_y;
600 }
601
602 ($r,$a) = cartesian_to_cylindrical(
603 $last->{objects}->{$name}->{center_x}-$c_x,
604 0 $last->{objects}->{$name}->{center_y}-$c_y,
605 0);
606 ($current->{objects}->{$name}->{center_x},
607 0 $current->{objects}->{$name}->{center_y}) =
608 cylindrical_to_cartesian($r,$a+$inc_angle,0);
609 0 $current->{objects}->{$name}->{center_x} += $c_x;
610 0 $current->{objects}->{$name}->{center_y} += $c_y;
611 }
612 elsif ($self->{animations}[$i][0] == 24) { # rotate Text
613 0 my $name = $self->{animations}[$i][1];
614 0 my $c_x = $self->{animations}[$i][5];
615 0 my $c_y = $self->{animations}[$i][6];
616 0 my $inc_angle = $self->{animations}[$i][8];
617 0 my ($r,$a);
618
619 ($r,$a) = cartesian_to_cylindrical(
620 $last->{objects}->{$name}->{x}-$c_x,
621 0 $last->{objects}->{$name}->{y}-$c_y,
622 0);
623 ($current->{objects}->{$name}->{x},
624 0 $current->{objects}->{$name}->{y}) =
625 cylindrical_to_cartesian($r,$a+$inc_angle,0);
626 0 $current->{objects}->{$name}->{x} += $c_x;
627 0 $current->{objects}->{$name}->{y} += $c_y;
628
629 $current->{objects}->{$name}->{angle} =
630 0 $last->{objects}->{$name}->{angle} - $inc_angle;
631
632 ($r,$a) = cartesian_to_cylindrical(
633 $last->{objects}->{$name}->{center_x}-$c_x,
634 0 $last->{objects}->{$name}->{center_y}-$c_y,
635 0);
636 ($current->{objects}->{$name}->{center_x},
637 0 $current->{objects}->{$name}->{center_y}) =
638 cylindrical_to_cartesian($r,$a+$inc_angle,0);
639 0 $current->{objects}->{$name}->{center_x} += $c_x;
640 0 $current->{objects}->{$name}->{center_y} += $c_y;
641 }
642 elsif ($self->{animations}[$i][0] == 25) { # rotate Arc
643 0 my $name = $self->{animations}[$i][1];
644 0 my $c_x = $self->{animations}[$i][5];
645 0 my $c_y = $self->{animations}[$i][6];
646 0 my $inc_angle = $self->{animations}[$i][8];
647 0 my ($r,$a);
648
649 ($r,$a) = cartesian_to_cylindrical(
650 $last->{objects}->{$name}->{center_x}-$c_x,
651 0 $last->{objects}->{$name}->{center_y}-$c_y,
652 0);
653 ($current->{objects}->{$name}->{center_x},
654 0 $current->{objects}->{$name}->{center_y}) =
655 cylindrical_to_cartesian($r,$a+$inc_angle,0);
656 0 $current->{objects}->{$name}->{center_x} += $c_x;
657 0 $current->{objects}->{$name}->{center_y} += $c_y;
658
659 ($r,$a) = cartesian_to_cylindrical(
660 $last->{objects}->{$name}->{x1}-$c_x,
661 0 $last->{objects}->{$name}->{y1}-$c_y,
662 0);
663 ($current->{objects}->{$name}->{x1},
664 0 $current->{objects}->{$name}->{y1}) =
665 cylindrical_to_cartesian($r,$a+$inc_angle,0);
666 0 $current->{objects}->{$name}->{x1} += $c_x;
667 0 $current->{objects}->{$name}->{y1} += $c_y;
668
669 ($r,$a) = cartesian_to_cylindrical(
670 $last->{objects}->{$name}->{x2}-$c_x,
671 0 $last->{objects}->{$name}->{y2}-$c_y,
672 0);
673 ($current->{objects}->{$name}->{x2},
674 0 $current->{objects}->{$name}->{y2}) =
675 cylindrical_to_cartesian($r,$a+$inc_angle,0);
676 0 $current->{objects}->{$name}->{x2} += $c_x;
677 0 $current->{objects}->{$name}->{y2} += $c_y;
678
679 ($r,$a) = cartesian_to_cylindrical(
680 $last->{objects}->{$name}->{x3}-$c_x,
681 0 $last->{objects}->{$name}->{y3}-$c_y,
682 0);
683 ($current->{objects}->{$name}->{x3},
684 0 $current->{objects}->{$name}->{y3}) =
685 cylindrical_to_cartesian($r,$a+$inc_angle,0);
686 0 $current->{objects}->{$name}->{x3} += $c_x;
687 0 $current->{objects}->{$name}->{y3} += $c_y;
688 }
689 elsif ($self->{animations}[$i][0] == 26) { # rotate Compound
690 0 my $name = $self->{animations}[$i][1];
691 0 my $c_x = $self->{animations}[$i][5];
692 0 my $c_y = $self->{animations}[$i][6];
693 0 my $inc_angle = $self->{animations}[$i][8];
694 0 my ($r,$a);
695
696 ($r,$a) = cartesian_to_cylindrical(
697 $last->{objects}->{$name}->{upperleft_corner_x}-$c_x,
698 0 $last->{objects}->{$name}->{upperleft_corner_y}-$c_y,
699 0);
700 ($current->{objects}->{$name}->{upperleft_corner_x},
701 0 $current->{objects}->{$name}->{upperleft_corner_y}) =
702 cylindrical_to_cartesian($r,$a+$inc_angle,0);
703 0 $current->{objects}->{$name}->{upperleft_corner_x} += $c_x;
704 0 $current->{objects}->{$name}->{upperleft_corner_y} += $c_y;
705
706 ($r,$a) = cartesian_to_cylindrical(
707 $last->{objects}->{$name}->{lowerright_corner_x}-$c_x,
708 0 $last->{objects}->{$name}->{lowerright_corner_y}-$c_y,
709 0);
710 ($current->{objects}->{$name}->{lowerright_corner_x},
711 0 $current->{objects}->{$name}->{lowerright_corner_y}) =
712 cylindrical_to_cartesian($r,$a+$inc_angle,0);
713 0 $current->{objects}->{$name}->{lowerright_corner_x} +=$c_x;
714 0 $current->{objects}->{$name}->{lowerright_corner_y} +=$c_y;
715
716 ($r,$a) = cartesian_to_cylindrical(
717 $last->{objects}->{$name}->{center_x}-$c_x,
718 0 $last->{objects}->{$name}->{center_y}-$c_y,
719 0);
720 ($current->{objects}->{$name}->{center_x},
721 0 $current->{objects}->{$name}->{center_y}) =
722 cylindrical_to_cartesian($r,$a+$inc_angle,0);
723 0 $current->{objects}->{$name}->{center_x} += $c_x;
724 0 $current->{objects}->{$name}->{center_y} += $c_y;
725 }
726
727 elsif ($self->{animations}[$i][0] == 31) { # scale Ellipse
728 0 my $name = $self->{animations}[$i][1];
729 0 my $scale = $self->{animations}[$i][4];
730 0 my $c_x = $self->{animations}[$i][5];
731 0 my $c_y = $self->{animations}[$i][6];
732 0 my @incs_x = @{$self->{animations}[$i][7]};
733 0 my @incs_y = @{$self->{animations}[$i][8]};
734 0 my $r_x = $self->{animations}[$i][9];
735 0 my $r_y = $self->{animations}[$i][10];
736
737 $current->{objects}->{$name}->{center_x} =
738 0 $last->{objects}->{$name}->{center_x} + $incs_x[0];
739 $current->{objects}->{$name}->{center_y} =
740 0 $last->{objects}->{$name}->{center_y} + $incs_y[0];
741
742 $current->{objects}->{$name}->{start_x} =
743 0 $last->{objects}->{$name}->{start_x} + $incs_x[1];
744 $current->{objects}->{$name}->{start_y} =
745 0 $last->{objects}->{$name}->{start_y} + $incs_y[1];
746
747 $current->{objects}->{$name}->{end_x} =
748 0 $last->{objects}->{$name}->{end_x} + $incs_x[2];
749 $current->{objects}->{$name}->{end_y} =
750 0 $last->{objects}->{$name}->{end_y} + $incs_y[2];
751
752 $current->{objects}->{$name}->{radius_x} =
753 0 $last->{objects}->{$name}->{radius_x} + $r_x;
754 $current->{objects}->{$name}->{radius_y} =
755 0 $last->{objects}->{$name}->{radius_y} + $r_y;
756 }
757 ▶ elsif (($self->{animations}[$i][0] == 32) || # scale
Condition0%0/3
$self->{"animations"}[$i][0] == 32 or $self->{"animations"}[$i][0] == 33
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"animations"}[$i][0] == 32 or $self->{"animations"}[$i][0] == 33
$self->{"animations"}[$i][0] == 32 $self->{"animations"}[$i][0] == 33
Truth table0%0/3
A or B
A= $self->{"animations"}[$i][0] == 32B= $self->{"animations"}[$i][0] == 33
ABresult
1X1
011
000
758 ($self->{animations}[$i][0] == 33)) { # Polyline/Spline
759 0 my $name = $self->{animations}[$i][1];
760 0 my $scale = $self->{animations}[$i][4];
761 0 my $c_x = $self->{animations}[$i][5];
762 0 my $c_y = $self->{animations}[$i][6];
763 0 my @incs_x = @{$self->{animations}[$i][7]};
764 0 my @incs_y = @{$self->{animations}[$i][8]};
765
766 0 ▶ for (my $i=0; $i<$current->{objects}->{$name}->{npoints};
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $current->{"objects"}{$name}{"npoints"}) 0 0 0
767 $i++) {
768 $current->{objects}->{$name}->{xnpoints}[$i] =
769 0 $last->{objects}->{$name}->{xnpoints}[$i] +
770 $incs_x[$i];
771 $current->{objects}->{$name}->{ynpoints}[$i] =
772 0 $last->{objects}->{$name}->{ynpoints}[$i] +
773 $incs_y[$i];
774 }
775
776 $current->{objects}->{$name}->{center_x} =
777 $last->{objects}->{$name}->{center_x} +
778 0 $incs_x[$current->{objects}->{$name}->{npoints}];
779 $current->{objects}->{$name}->{center_y} =
780 $last->{objects}->{$name}->{center_y} +
781 0 $incs_y[$current->{objects}->{$name}->{npoints}];
782 }
783 elsif ($self->{animations}[$i][0] == 34) { # scale Text
784 0 my $name = $self->{animations}[$i][1];
785 0 my $scale = $self->{animations}[$i][4];
786 0 my $c_x = $self->{animations}[$i][5];
787 0 my $c_y = $self->{animations}[$i][6];
788 0 my @incs_x = @{$self->{animations}[$i][7]};
789 0 my @incs_y = @{$self->{animations}[$i][8]};
790 0 my $font_size = $self->{animations}[$i][9];
791 0 my $height = $self->{animations}[$i][10];
792
793 $current->{objects}->{$name}->{x} =
794 0 $last->{objects}->{$name}->{x} + $incs_x[0];
795 $current->{objects}->{$name}->{y} =
796 0 $last->{objects}->{$name}->{y} + $incs_y[0];
797
798 $current->{objects}->{$name}->{center_x} =
799 0 $last->{objects}->{$name}->{center_x} + $incs_x[1];
800 $current->{objects}->{$name}->{center_y} =
801 0 $last->{objects}->{$name}->{center_y} + $incs_y[1];
802
803 $current->{objects}->{$name}->{font_size} =
804 0 $last->{objects}->{$name}->{font_size} + $font_size;
805 $current->{objects}->{$name}->{height} =
806 0 $last->{objects}->{$name}->{height} + $height;
807 }
808 elsif ($self->{animations}[$i][0] == 35) { # scale Arc
809 0 my $name = $self->{animations}[$i][1];
810 0 my $scale = $self->{animations}[$i][4];
811 0 my $c_x = $self->{animations}[$i][5];
812 0 my $c_y = $self->{animations}[$i][6];
813 0 my @incs_x = @{$self->{animations}[$i][7]};
814 0 my @incs_y = @{$self->{animations}[$i][8]};
815
816 $current->{objects}->{$name}->{center_x} =
817 0 $last->{objects}->{$name}->{center_x} + $incs_x[0];
818 $current->{objects}->{$name}->{center_y} =
819 0 $last->{objects}->{$name}->{center_y} + $incs_y[0];
820
821 $current->{objects}->{$name}->{x1} =
822 0 $last->{objects}->{$name}->{x1} + $incs_x[1];
823 $current->{objects}->{$name}->{y1} =
824 0 $last->{objects}->{$name}->{y1} + $incs_y[1];
825
826 $current->{objects}->{$name}->{x2} =
827 0 $last->{objects}->{$name}->{x2} + $incs_x[2];
828 $current->{objects}->{$name}->{y2} =
829 0 $last->{objects}->{$name}->{y2} + $incs_y[2];
830
831 $current->{objects}->{$name}->{x3} =
832 0 $last->{objects}->{$name}->{x3} + $incs_x[3];
833 $current->{objects}->{$name}->{y3} =
834 0 $last->{objects}->{$name}->{y3} + $incs_y[3];
835 }
836 elsif ($self->{animations}[$i][0] == 36) { # scale Compound
837 0 my $name = $self->{animations}[$i][1];
838 0 my $scale = $self->{animations}[$i][4];
839 0 my $c_x = $self->{animations}[$i][5];
840 0 my $c_y = $self->{animations}[$i][6];
841 0 my @incs_x = @{$self->{animations}[$i][7]};
842 0 my @incs_y = @{$self->{animations}[$i][8]};
843
844 $current->{objects}->{$name}->{upperleft_corner_x} =
845 $last->{objects}->{$name}->{upperleft_corner_x} +
846 0 $incs_x[0];
847 $current->{objects}->{$name}->{upperleft_corner_y} =
848 $last->{objects}->{$name}->{upperleft_corner_y} +
849 0 $incs_y[0];
850
851 $current->{objects}->{$name}->{lowerright_corner_x} =
852 $last->{objects}->{$name}->{lowerright_corner_x} +
853 0 $incs_x[1];
854 $current->{objects}->{$name}->{lowerright_corner_y} =
855 $last->{objects}->{$name}->{lowerright_corner_y} +
856 0 $incs_y[1];
857
858 $current->{objects}->{$name}->{center_x} =
859 0 $last->{objects}->{$name}->{center_x} + $incs_x[2];
860 $current->{objects}->{$name}->{center_y} =
861 0 $last->{objects}->{$name}->{center_y} + $incs_y[2];
862 }
863
864 } elsif ($f == $firstframe) { # if the current frame is the first frame then initiate increment
865
866 0 ▶ if ($self->{animations}[$i][0] == 0) { # setAttributeValue
Branch: 10 branches
BranchTrueFalseTotal
if ($self->{'animations'}[$i][0] == 0) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 1) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 2) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 11 or $self->{'animations'}[$i][0] == 12 or $self->{'animations'}[$i][0] == 13 or $self->{'animations'}[$i][0] == 14 or $self->{'animations'}[$i][0] == 15 or $self->{'animations'}[$i][0] == 16) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 21 or $self->{'animations'}[$i][0] == 22 or $self->{'animations'}[$i][0] == 23 or $self->{'animations'}[$i][0] == 24 or $self->{'animations'}[$i][0] == 25 or $self->{'animations'}[$i][0] == 26) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 31) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 32 or $self->{'animations'}[$i][0] == 33) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 34) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 35) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 36) { } 0 0 0
867 0 my $name = $self->{animations}[$i][1];
868 0 my $attribute = $self->{animations}[$i][4];
869 0 my $value = $self->{animations}[$i][5];
870
871 0 $current->{objects}->{$name}->{$attribute} = $value;
872 }
873
874 elsif ($self->{animations}[$i][0] == 1) { # changeThickness
875 0 my $name = $self->{animations}[$i][1];
876 0 my $thickness = $self->{animations}[$i][4];
877
878 0 my $firstthick = $current->{objects}->{$name}->{thickness};
879 0 $self->{animations}[$i][5] =
880 ($thickness-$firstthick) / $nbframes;
881 }
882
883 elsif ($self->{animations}[$i][0] == 2) { # changeFillIntensity
884 0 my $name = $self->{animations}[$i][1];
885 0 my $intensity = $self->{animations}[$i][4];
886
887 0 my $firstinten = $current->{objects}->{$name}->{area_fill};
888 0 $self->{animations}[$i][5] =
889 ($intensity-$firstinten) / $nbframes;
890 }
891
892 ▶ elsif (($self->{animations}[$i][0] == 11) ||
Condition0%0/15
$self->{"animations"}[$i][0] == 11 or $self->{"animations"}[$i][0] == 12 or $self->{"animations"}[$i][0] == 13 or $self->{"animations"}[$i][0] == 14 or $self->{"animations"}[$i][0] == 15 or $self->{"animations"}[$i][0] == 16
l!l&&r!l&&!r
000
$self->{"animations"}[$i][0] == 11 or $self->{"animations"}[$i][0] == 12 or $self->{"animations"}[$i][0] == 13 or $self->{"animations"}[$i][0] == 14 or $self->{"animations"}[$i][0] == 15
l!l&&r!l&&!r
000
$self->{"animations"}[$i][0] == 11 or $self->{"animations"}[$i][0] == 12 or $self->{"animations"}[$i][0] == 13 or $self->{"animations"}[$i][0] == 14
l!l&&r!l&&!r
000
$self->{"animations"}[$i][0] == 11 or $self->{"animations"}[$i][0] == 12 or $self->{"animations"}[$i][0] == 13
l!l&&r!l&&!r
000
$self->{"animations"}[$i][0] == 11 or $self->{"animations"}[$i][0] == 12
l!l&&r!l&&!r
000
MC/DC0%0/6
$self->{"animations"}[$i][0] == 11 or $self->{"animations"}[$i][0] == 12 or $self->{"animations"}[$i][0] == 13 or $self->{"animations"}[$i][0] == 14 or $self->{"animations"}[$i][0] == 15 or $self->{"animations"}[$i][0] == 16
$self->{"animations"}[$i][0] == 11 $self->{"animations"}[$i][0] == 12 $self->{"animations"}[$i][0] == 13 $self->{"animations"}[$i][0] == 14 $self->{"animations"}[$i][0] == 15 $self->{"animations"}[$i][0] == 16
Truth table0%0/7
A or B or C or D or E or F
A= $self->{"animations"}[$i][0] == 11B= $self->{"animations"}[$i][0] == 12C= $self->{"animations"}[$i][0] == 13D= $self->{"animations"}[$i][0] == 14E= $self->{"animations"}[$i][0] == 15F= $self->{"animations"}[$i][0] == 16
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
00001X1
0000011
0000000
893 ($self->{animations}[$i][0] == 12) ||
894 ($self->{animations}[$i][0] == 13) ||
895 ($self->{animations}[$i][0] == 14) ||
896 ($self->{animations}[$i][0] == 15) ||
897 ($self->{animations}[$i][0] == 16)) { # translate
898 0 my $name = $self->{animations}[$i][1];
899 0 my $x = $self->{animations}[$i][4];
900 0 my $y = $self->{animations}[$i][5];
901 0 my $unit = $self->{animations}[$i][6];
902
903 0 ▶ if ($unit eq 'in') {
Branch: 3 branches
BranchTrueFalseTotal
if ($unit eq 'in') { } 0 0 0
elsif ($unit eq 'cm') { } 0 0 0
elsif ($unit eq 'px') { } 0 0 0
904 0 $self->{animations}[$i][7] = 1200 * $x / $nbframes;
905 0 $self->{animations}[$i][8] = 1200 * $y / $nbframes;
906 } elsif ($unit eq 'cm') {
907 0 $self->{animations}[$i][7] = 450 * $x / $nbframes;
908 0 $self->{animations}[$i][8] = 450 * $y / $nbframes;
909 } elsif ($unit eq 'px') {
910 0 $self->{animations}[$i][7] = 15 * $x / $nbframes;
911 0 $self->{animations}[$i][8] = 15 * $y / $nbframes;
912 } else {
913 0 $self->{animations}[$i][7] = $x / $nbframes;
914 0 $self->{animations}[$i][8] = $y / $nbframes;
915 }
916 }
917
918 ▶ elsif (($self->{animations}[$i][0] == 21) ||
Condition0%0/15
$self->{"animations"}[$i][0] == 21 or $self->{"animations"}[$i][0] == 22 or $self->{"animations"}[$i][0] == 23 or $self->{"animations"}[$i][0] == 24 or $self->{"animations"}[$i][0] == 25 or $self->{"animations"}[$i][0] == 26
l!l&&r!l&&!r
000
$self->{"animations"}[$i][0] == 21 or $self->{"animations"}[$i][0] == 22 or $self->{"animations"}[$i][0] == 23 or $self->{"animations"}[$i][0] == 24 or $self->{"animations"}[$i][0] == 25
l!l&&r!l&&!r
000
$self->{"animations"}[$i][0] == 21 or $self->{"animations"}[$i][0] == 22 or $self->{"animations"}[$i][0] == 23 or $self->{"animations"}[$i][0] == 24
l!l&&r!l&&!r
000
$self->{"animations"}[$i][0] == 21 or $self->{"animations"}[$i][0] == 22 or $self->{"animations"}[$i][0] == 23
l!l&&r!l&&!r
000
$self->{"animations"}[$i][0] == 21 or $self->{"animations"}[$i][0] == 22
l!l&&r!l&&!r
000
MC/DC0%0/6
$self->{"animations"}[$i][0] == 21 or $self->{"animations"}[$i][0] == 22 or $self->{"animations"}[$i][0] == 23 or $self->{"animations"}[$i][0] == 24 or $self->{"animations"}[$i][0] == 25 or $self->{"animations"}[$i][0] == 26
$self->{"animations"}[$i][0] == 21 $self->{"animations"}[$i][0] == 22 $self->{"animations"}[$i][0] == 23 $self->{"animations"}[$i][0] == 24 $self->{"animations"}[$i][0] == 25 $self->{"animations"}[$i][0] == 26
Truth table0%0/7
A or B or C or D or E or F
A= $self->{"animations"}[$i][0] == 21B= $self->{"animations"}[$i][0] == 22C= $self->{"animations"}[$i][0] == 23D= $self->{"animations"}[$i][0] == 24E= $self->{"animations"}[$i][0] == 25F= $self->{"animations"}[$i][0] == 26
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
00001X1
0000011
0000000
919 ($self->{animations}[$i][0] == 22) ||
920 ($self->{animations}[$i][0] == 23) ||
921 ($self->{animations}[$i][0] == 24) ||
922 ($self->{animations}[$i][0] == 25) ||
923 ($self->{animations}[$i][0] == 26)) { # rotate
924 0 my $name = $self->{animations}[$i][1];
925 0 my $angle = $self->{animations}[$i][4];
926
927 0 ▶ if ($self->{animations}[$i][7] eq 'in') { # $unit eq 'in'
Branch: 3 branches
BranchTrueFalseTotal
if ($self->{'animations'}[$i][7] eq 'in') { } 0 0 0
elsif ($self->{'animations'}[$i][7] eq 'cm') { } 0 0 0
elsif ($self->{'animations'}[$i][7] eq 'px') { } 0 0 0
928 0 $self->{animations}[$i][5] *= 1200; # $c_x *= 1200
929 0 $self->{animations}[$i][6] *= 1200; # $c_y *= 1200
930 } elsif ($self->{animations}[$i][7] eq 'cm') {
931 0 $self->{animations}[$i][5] *= 450;
932 0 $self->{animations}[$i][6] *= 450;
933 } elsif ($self->{animations}[$i][7] eq 'px') {
934 0 $self->{animations}[$i][5] *= 15;
935 0 $self->{animations}[$i][6] *= 15;
936 }
937 0 $self->{animations}[$i][7] = ''; # $unit = ''
938
939 0 $self->{animations}[$i][8] = deg2rad($angle / $nbframes);
940 }
941
942 elsif ($self->{animations}[$i][0] == 31) { # scale Ellipse
943 0 my $name = $self->{animations}[$i][1];
944 0 my $scale = $self->{animations}[$i][4];
945 0 my $c_x = $self->{animations}[$i][5];
946 0 my $c_y = $self->{animations}[$i][6];
947 0 my (@incs_x,@incs_y);
948
949 push @incs_x, (($scale-1) *
950 ($current->{objects}->{$name}->{center_x} -
951 0 $c_x) / $nbframes);
952 push @incs_y, (($scale-1) *
953 ($current->{objects}->{$name}->{center_y} -
954 0 $c_y) / $nbframes);
955
956 push @incs_x, (($scale-1) *
957 ($current->{objects}->{$name}->{start_x} -
958 0 $c_x) / $nbframes);
959 push @incs_y, (($scale-1) *
960 ($current->{objects}->{$name}->{start_y} -
961 0 $c_y) / $nbframes);
962
963 push @incs_x, (($scale-1) *
964 ($current->{objects}->{$name}->{end_x} -
965 0 $c_x) / $nbframes);
966 push @incs_y, (($scale-1) *
967 ($current->{objects}->{$name}->{end_y} -
968 0 $c_y) / $nbframes);
969
970 0 $self->{animations}[$i][7] = \@incs_x;
971 0 $self->{animations}[$i][8] = \@incs_y;
972
973 $self->{animations}[$i][9] = ($scale - 1) *
974 0 $current->{objects}->{$name}->{radius_x} / $nbframes;
975 $self->{animations}[$i][10] = ($scale - 1) *
976 0 $current->{objects}->{$name}->{radius_y} / $nbframes;
977 }
978 ▶ elsif (($self->{animations}[$i][0] == 32) || # scale
Condition0%0/3
$self->{"animations"}[$i][0] == 32 or $self->{"animations"}[$i][0] == 33
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"animations"}[$i][0] == 32 or $self->{"animations"}[$i][0] == 33
$self->{"animations"}[$i][0] == 32 $self->{"animations"}[$i][0] == 33
Truth table0%0/3
A or B
A= $self->{"animations"}[$i][0] == 32B= $self->{"animations"}[$i][0] == 33
ABresult
1X1
011
000
979 ($self->{animations}[$i][0] == 33)) { # Polyline/Spline
980 0 my $name = $self->{animations}[$i][1];
981 0 my $scale = $self->{animations}[$i][4];
982 0 my $c_x = $self->{animations}[$i][5];
983 0 my $c_y = $self->{animations}[$i][6];
984 0 my (@incs_x,@incs_y);
985
986 0 ▶ for (my $i=0; $i<$current->{objects}->{$name}->{npoints};
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $current->{"objects"}{$name}{"npoints"}) 0 0 0
987 $i++) {
988 push @incs_x, (($scale-1) *
989 0 ($current->{objects}->{$name}->{xnpoints}[$i]
990 - $c_x) / $nbframes);
991 push @incs_y, (($scale-1) *
992 0 ($current->{objects}->{$name}->{ynpoints}[$i]
993 - $c_y) / $nbframes);
994 }
995
996 push @incs_x, (($scale-1) *
997 ($current->{objects}->{$name}->{center_x} -
998 0 $c_x) / $nbframes);
999 push @incs_y, (($scale-1) *
1000 ($current->{objects}->{$name}->{center_y} -
1001 0 $c_y) / $nbframes);
1002
1003 0 $self->{animations}[$i][7] = \@incs_x;
1004 0 $self->{animations}[$i][8] = \@incs_y;
1005 }
1006 elsif ($self->{animations}[$i][0] == 34) { # scale Text
1007 0 my $name = $self->{animations}[$i][1];
1008 0 my $scale = $self->{animations}[$i][4];
1009 0 my $c_x = $self->{animations}[$i][5];
1010 0 my $c_y = $self->{animations}[$i][6];
1011 0 my (@incs_x,@incs_y);
1012
1013 push @incs_x, (($scale-1) *
1014 ($current->{objects}->{$name}->{x} -
1015 0 $c_x) / $nbframes);
1016 push @incs_y, (($scale-1) *
1017 ($current->{objects}->{$name}->{y} -
1018 0 $c_y) / $nbframes);
1019
1020 push @incs_x, (($scale-1) *
1021 ($current->{objects}->{$name}->{center_x} -
1022 0 $c_x) / $nbframes);
1023 push @incs_y, (($scale-1) *
1024 ($current->{objects}->{$name}->{center_y} -
1025 0 $c_y) / $nbframes);
1026
1027 0 $self->{animations}[$i][7] = \@incs_x;
1028 0 $self->{animations}[$i][8] = \@incs_y;
1029
1030 $self->{animations}[$i][9] = ($scale - 1) *
1031 0 $current->{objects}->{$name}->{font_size} / $nbframes;
1032 $self->{animations}[$i][10] = ($scale - 1) *
1033 0 $current->{objects}->{$name}->{height} / $nbframes;
1034 }
1035 elsif ($self->{animations}[$i][0] == 35) { # scale Arc
1036 0 my $name = $self->{animations}[$i][1];
1037 0 my $scale = $self->{animations}[$i][4];
1038 0 my $c_x = $self->{animations}[$i][5];
1039 0 my $c_y = $self->{animations}[$i][6];
1040 0 my (@incs_x,@incs_y);
1041
1042 push @incs_x, (($scale-1) *
1043 ($current->{objects}->{$name}->{center_x} -
1044 0 $c_x) / $nbframes);
1045 push @incs_y, (($scale-1) *
1046 ($current->{objects}->{$name}->{center_y} -
1047 0 $c_y) / $nbframes);
1048
1049 push @incs_x, (($scale-1) *
1050 ($current->{objects}->{$name}->{x1} -
1051 0 $c_x) / $nbframes);
1052 push @incs_y, (($scale-1) *
1053 ($current->{objects}->{$name}->{y1} -
1054 0 $c_y) / $nbframes);
1055
1056 push @incs_x, (($scale-1) *
1057 ($current->{objects}->{$name}->{x2} -
1058 0 $c_x) / $nbframes);
1059 push @incs_y, (($scale-1) *
1060 ($current->{objects}->{$name}->{y2} -
1061 0 $c_y) / $nbframes);
1062
1063 push @incs_x, (($scale-1) *
1064 ($current->{objects}->{$name}->{x3} -
1065 0 $c_x) / $nbframes);
1066 push @incs_y, (($scale-1) *
1067 ($current->{objects}->{$name}->{y3} -
1068 0 $c_y) / $nbframes);
1069
1070 0 $self->{animations}[$i][7] = \@incs_x;
1071 0 $self->{animations}[$i][8] = \@incs_y;
1072 }
1073 elsif ($self->{animations}[$i][0] == 36) { # scale Compound
1074 0 my $name = $self->{animations}[$i][1];
1075 0 my $scale = $self->{animations}[$i][4];
1076 0 my $c_x = $self->{animations}[$i][5];
1077 0 my $c_y = $self->{animations}[$i][6];
1078 0 my (@incs_x,@incs_y);
1079
1080 push @incs_x, (($scale-1) *
1081 ($current->{objects}->{$name}->{upperleft_corner_x}
1082 0 - $c_x) / $nbframes);
1083 push @incs_y, (($scale-1) *
1084 ($current->{objects}->{$name}->{upperleft_corner_y}
1085 0 - $c_y) / $nbframes);
1086
1087 push @incs_x, (($scale-1) *
1088 ($current->{objects}->{$name}->{lowerright_corner_x}
1089 0 - $c_x) / $nbframes);
1090 push @incs_y, (($scale-1) *
1091 ($current->{objects}->{$name}->{lowerright_corner_y}
1092 0 - $c_y) / $nbframes);
1093
1094 push @incs_x, (($scale-1) *
1095 ($current->{objects}->{$name}->{center_x} -
1096 0 $c_x) / $nbframes);
1097 push @incs_y, (($scale-1) *
1098 ($current->{objects}->{$name}->{center_y} -
1099 0 $c_y) / $nbframes);
1100
1101 0 $self->{animations}[$i][7] = \@incs_x;
1102 0 $self->{animations}[$i][8] = \@incs_y;
1103 }
1104
1105 }
1106 0 my $framename = sprintf(".frame%04d",$f);
1107 0 $current->writeFile($framename.".fig");
1108 0 `fig2dev -L gif $framename.fig $framename.gif`;
1109 0 `rm $framename.fig`;
1110 0 $last = $current; # the current frame becomes the last frame
1111 }
1112 }
1113 # possible optimization
1114 0 my $delay = 100 / $speed;
1115 0 my $final_delay = $delay + $wait * 100;
1116 0 my @frames = split /\n/, `ls .frame????.gif`;
1117 0 `convert -loop $loop -delay $delay @frames[0..$length-1] -delay $final_delay $frames[$length] $file`;
1118 0 `rm @frames`;
1119 }
1120  
1121  
1122 # objects selectors
1123 0 ▶sub selectByType {
Subroutine selectByType: not called CC=4 SCAR=30.0
Pod documented
1124 0 my $self = shift;
1125 0 my $res = new Compound("",0,0,0,0,$self);
1126
1127 0 foreach (@_) {
1128 0 push @{$res->{$_}}, @{$self->{$_}};
1129 }
1130
1131 0 foreach (@{$self->{compounds}}) {
1132 0 my $aux = $self->{objects}->{$_}->selectByType(@_);
1133 0 foreach (@_) {
1134 0 push @{$res->{$_}}, @{$aux->{$_}};
1135 }
1136 }
1137
1138 0 return $res;
1139 }
1140  
1141 0 ▶sub selectByPenColor {
Subroutine selectByPenColor: not called CC=14 SCAR=53.5
Pod documented
1142 0 my $self = shift;
1143 0 my $res = new Compound("",0,0,0,0,$self);
1144
1145 0 foreach (@_) {
1146 0 my $color = $FigAnim::Utils::colors_codes{$_};
1147 0 ▶ if (defined $color) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $color) 0 0 0
1148 0 foreach (@{$self->{arcs}}) {
1149 0 ▶ if ($self->{objects}->{$_}->{pen_color} == $color) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"objects"}{$_}{"pen_color"} == $color) 0 0 0
1150 0 push @{$res->{arcs}}, $_;
1151 }
1152 }
1153 0 foreach (@{$self->{ellipses}}) {
1154 0 ▶ if ($self->{objects}->{$_}->{pen_color} == $color) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"objects"}{$_}{"pen_color"} == $color) 0 0 0
1155 0 push @{$res->{ellipses}}, $_;
1156 }
1157 }
1158 0 foreach (@{$self->{polylines}}) {
1159 0 ▶ if ($self->{objects}->{$_}->{pen_color} == $color) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"objects"}{$_}{"pen_color"} == $color) 0 0 0
1160 0 push @{$res->{polylines}}, $_;
1161 }
1162 }
1163 0 foreach (@{$self->{splines}}) {
1164 0 ▶ if ($self->{objects}->{$_}->{pen_color} == $color) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"objects"}{$_}{"pen_color"} == $color) 0 0 0
1165 0 push @{$res->{splines}}, $_;
1166 }
1167 }
1168 0 foreach (@{$self->{texts}}) {
1169 0 ▶ if ($self->{objects}->{$_}->{pen_color} == $color) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"objects"}{$_}{"pen_color"} == $color) 0 0 0
1170 0 push @{$res->{texts}}, $_;
1171 }
1172 }
1173 }
1174 }
1175
1176 0 foreach (@{$self->{compounds}}) {
1177 0 my $aux = $self->{objects}->{$_}->selectByPenColor(@_);
1178 0 push @{$res->{arcs}}, @{$aux->{arcs}};
1179 0 push @{$res->{ellipses}}, @{$aux->{ellipses}};
1180 0 push @{$res->{polylines}}, @{$aux->{polylines}};
1181 0 push @{$res->{splines}}, @{$aux->{splines}};
1182 0 push @{$res->{texts}}, @{$aux->{texts}};
1183 }
1184
1185 0 return $res;
1186 }
1187  
1188 0 ▶sub selectByFillColor {
Subroutine selectByFillColor: not called CC=12 SCAR=50.5
Pod documented
1189 0 my $self = shift;
1190 0 my $res = new Compound("",0,0,0,0,$self);
1191
1192 0 foreach (@_) {
1193 0 my $color = $FigAnim::Utils::colors_codes{$_};
1194 0 ▶ if (defined $color) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $color) 0 0 0
1195 0 foreach (@{$self->{arcs}}) {
1196 0 ▶ if ($self->{objects}->{$_}->{fill_color} == $color) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"objects"}{$_}{"fill_color"} == $color) 0 0 0
1197 0 push @{$res->{arcs}}, $_;
1198 }
1199 }
1200 0 foreach (@{$self->{ellipses}}) {
1201 0 ▶ if ($self->{objects}->{$_}->{fill_color} == $color) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"objects"}{$_}{"fill_color"} == $color) 0 0 0
1202 0 push @{$res->{ellipses}}, $_;
1203 }
1204 }
1205 0 foreach (@{$self->{polylines}}) {
1206 0 ▶ if ($self->{objects}->{$_}->{fill_color} == $color) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"objects"}{$_}{"fill_color"} == $color) 0 0 0
1207 0 push @{$res->{polylines}}, $_;
1208 }
1209 }
1210 0 foreach (@{$self->{splines}}) {
1211 0 ▶ if ($self->{objects}->{$_}->{fill_color} == $color) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"objects"}{$_}{"fill_color"} == $color) 0 0 0
1212 0 push @{$res->{splines}}, $_;
1213 }
1214 }
1215 }
1216 }
1217
1218 0 foreach (@{$self->{compounds}}) {
1219 0 my $aux = $self->{objects}->{$_}->selectByFillColor(@_);
1220 0 push @{$res->{arcs}}, @{$aux->{arcs}};
1221 0 push @{$res->{ellipses}}, @{$aux->{ellipses}};
1222 0 push @{$res->{polylines}}, @{$aux->{polylines}};
1223 0 push @{$res->{splines}}, @{$aux->{splines}};
1224 }
1225
1226 0 return $res;
1227 }
1228  
1229 0 ▶sub selectByAttributeValue {
Subroutine selectByAttributeValue: not called CC=21 SCAR=61.4
Pod documented
1230 0 my $self = shift;
1231 0 my $res = new Compound("",0,0,0,0,$self);
1232 0 my @params = @_;
1233
1234 0 ▶ while (@params) {
Branch: 1 branch
BranchTrueFalseTotal
if (@params) 0 0 0
1235 0 my $attribute = shift @params;
1236 0 my $value = shift @params;
1237
1238 0 foreach (@{$self->{arcs}}) {
1239 0 ▶ if ((defined $self->{objects}->{$_}->{$attribute}) &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value) 0 0 0
Condition0%0/3
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
defined $self->{"objects"}{$_}{$attribute} $self->{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"objects"}{$_}{$attribute}B= $self->{"objects"}{$_}{$attribute} eq $value
ABresult
0X0
100
111
1240 ($self->{objects}->{$_}->{$attribute} eq $value)) {
1241 0 push @{$res->{arcs}}, $_;
1242 }
1243 }
1244 0 foreach (@{$self->{compounds}}) {
1245 0 ▶ if ((defined $self->{objects}->{$_}->{$attribute}) &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value) 0 0 0
Condition0%0/3
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
defined $self->{"objects"}{$_}{$attribute} $self->{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"objects"}{$_}{$attribute}B= $self->{"objects"}{$_}{$attribute} eq $value
ABresult
0X0
100
111
1246 ($self->{objects}->{$_}->{$attribute} eq $value)) {
1247 0 push @{$res->{compounds}}, $_;
1248 }
1249 }
1250 0 foreach (@{$self->{ellipses}}) {
1251 0 ▶ if ((defined $self->{objects}->{$_}->{$attribute}) &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value) 0 0 0
Condition0%0/3
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
defined $self->{"objects"}{$_}{$attribute} $self->{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"objects"}{$_}{$attribute}B= $self->{"objects"}{$_}{$attribute} eq $value
ABresult
0X0
100
111
1252 ($self->{objects}->{$_}->{$attribute} eq $value)) {
1253 0 push @{$res->{ellipses}}, $_;
1254 }
1255 }
1256 0 foreach (@{$self->{polylines}}) {
1257 0 ▶ if ((defined $self->{objects}->{$_}->{$attribute}) &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value) 0 0 0
Condition0%0/3
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
defined $self->{"objects"}{$_}{$attribute} $self->{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"objects"}{$_}{$attribute}B= $self->{"objects"}{$_}{$attribute} eq $value
ABresult
0X0
100
111
1258 ($self->{objects}->{$_}->{$attribute} eq $value)) {
1259 0 push @{$res->{polylines}}, $_;
1260 }
1261 }
1262 0 foreach (@{$self->{splines}}) {
1263 0 ▶ if ((defined $self->{objects}->{$_}->{$attribute}) &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value) 0 0 0
Condition0%0/3
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
defined $self->{"objects"}{$_}{$attribute} $self->{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"objects"}{$_}{$attribute}B= $self->{"objects"}{$_}{$attribute} eq $value
ABresult
0X0
100
111
1264 ($self->{objects}->{$_}->{$attribute} eq $value)) {
1265 0 push @{$res->{splines}}, $_;
1266 }
1267 }
1268 0 foreach (@{$self->{texts}}) {
1269 0 ▶ if ((defined $self->{objects}->{$_}->{$attribute}) &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value) 0 0 0
Condition0%0/3
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"objects"}{$_}{$attribute} and $self->{"objects"}{$_}{$attribute} eq $value
defined $self->{"objects"}{$_}{$attribute} $self->{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"objects"}{$_}{$attribute}B= $self->{"objects"}{$_}{$attribute} eq $value
ABresult
0X0
100
111
1270 ($self->{objects}->{$_}->{$attribute} eq $value)) {
1271 0 push @{$res->{texts}}, $_;
1272 }
1273 }
1274 }
1275
1276
1277 0 foreach (@{$self->{compounds}}) {
1278 0 my $aux = $self->{objects}->{$_}->selectByAttributeValue(@_);
1279 0 push @{$res->{arcs}}, @{$aux->{arcs}};
1280 0 push @{$res->{compounds}}, @{$aux->{compounds}};
1281 0 push @{$res->{ellipses}}, @{$aux->{ellipses}};
1282 0 push @{$res->{polylines}}, @{$aux->{polylines}};
1283 0 push @{$res->{splines}}, @{$aux->{splines}};
1284 0 push @{$res->{texts}}, @{$aux->{texts}};
1285 }
1286
1287 0 return $res;
1288 }
1289  
1290  
1291 # writes a SVG file
1292 0 ▶sub writeSVGFile {
Subroutine writeSVGFile: not called CC=2 SCAR=17.9
Pod undocumented
1293 0 my $self = shift;
1294 0 my $filename = shift;
1295
1296 0 ▶ open OUT, ">$filename" or die "Can't open $filename : $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open OUT, ">$filename" or die "Can't open $filename : $!\n" 0 0 0
1297
1298 0 $self->writeSVGHeader(\*OUT);
1299 0 $self->writeSVGObjects(\*OUT);
1300  
1301 0 print OUT "</svg>\n";
1302
1303 0 close OUT;
1304 }
1305  
1306 # writes SVG header
1307 0 ▶sub writeSVGHeader {
Subroutine writeSVGHeader: not called CC=4 SCAR=30.0
Pod undocumented
1308 0 my $self = shift;
1309 0 my $fh = shift;
1310  
1311 0 print $fh "<?xml version=\"1.0\"?>\n";
1312 0 print $fh "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\"\n";
1313 0 print $fh "\"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n\n";
1314  
1315 0 print $fh "<svg ";
1316  
1317 print $fh
1318 ConvertSVG::papersize_to_units($self->{papersize},
1319 $self->{orientation},
1320 $self->{magnification},
1321 0 $self->{resolution});
1322 0 print $fh ">\n";
1323  
1324 0 print $fh "<title>";
1325 0 ▶ print $fh split(/\n/, $self->{title}, 0) if ($self->{title});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"title"} 0 0 0
1326 0 print $fh "</title>\n";
1327  
1328 0 print $fh "<desc>\n";
1329 0 ▶ if ($self->{title} ne "") {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"title"} ne "") 0 0 0
1330 0 foreach (split(/\n/, $self->{title})) {
1331 0 print $fh "$_\n";
1332 }
1333 }
1334 0 print $fh "</desc>\n\n";
1335 }
1336  
1337 # write SVG objects
1338 0 ▶sub writeSVGObjects {
Subroutine writeSVGObjects: not called CC=5 SCAR=34.0
Pod undocumented
1339 0 my $self = shift;
1340 0 my $fh = shift;
1341  
1342 0 my @objects;
1343 0 push @objects, @{$self->{arcs}};
1344 0 push @objects, @{$self->{ellipses}};
1345 0 push @objects, @{$self->{polylines}};
1346 0 push @objects, @{$self->{splines}};
1347 0 push @objects, @{$self->{texts}};
1348  
1349 # sorts objects by depth
1350 @objects =
1351 sort {
1352 0 ▶ if ($self->{objects}->{$a}->{depth} <
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'objects'}{$a}{'depth'} < $self->{'objects'}{$b}{'depth'}) { } 0 0 0
elsif ($self->{'objects'}{$a}{'depth'} == $self->{'objects'}{$b}{'depth'}) { } 0 0 0
1353 $self->{objects}->{$b}->{depth}) {
1354 0 return 1;
1355 } elsif ($self->{objects}->{$a}->{depth} ==
1356 $self->{objects}->{$b}->{depth}) {
1357 0 return 0;
1358 } else {
1359 0 return -1;
1360 }
1361 } @objects;
1362  
1363 0 foreach (@objects) {
1364 0 $self->{objects}->{$_}->outputSVG($fh, \@{$self->{colors}});
1365 }
1366  
1367 0 foreach (@{$self->{compounds}}) {
1368 0 $self->{objects}->{$_}->outputSVG($fh, \@{$self->{colors}});
1369 }
1370 }
1371  
1372  
1373 0 ▶sub generateSMIL {
Subroutine generateSMIL: not called CC=2 SCAR=17.9
Pod documented
1374 0 my $self = shift;
1375 0 my $file = shift;
1376
1377 0 ▶ open OUT, ">$file" or die "Can't open $file : $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open OUT, ">$file" or die "Can't open $file : $!\n" 0 0 0
1378  
1379 0 $self->writeSVGHeader(\*OUT);
1380 0 $self->writeSMILObjects(\*OUT);
1381  
1382 0 print OUT "</svg>\n";
1383  
1384 0 close OUT;
1385 }
1386  
1387 0 ▶sub writeSMILObjects {
Subroutine writeSMILObjects: not called CC=25 SCAR=64.8
Pod undocumented
1388 0 my $self = shift;
1389 0 my $fh = shift;
1390  
1391 # sorts animations by start time
1392 0 @{$self->{animations}} =
1393 sort {
1394 0 ▶ if (@$a[2] < @$b[2]) { return -1; }
Branch: 2 branches
BranchTrueFalseTotal
if (@$a[2] < @$b[2]) { } 0 0 0
elsif (@$a[2] == @$b[2]) { } 0 0 0
1395 0 elsif (@$a[2] == @$b[2]) { return 0; }
1396 0 else { return 1; }
1397 0 } @{$self->{animations}};
1398  
1399 0 my @setAttributeValue;
1400 my @changeThickness;
1401 0 my @changeFillIntensity;
1402 0 my @translate;
1403 0 my @rotate;
1404 0 my @scale;
1405  
1406 0 ▶ for (my $i = 0; $i <= $#{$self->{animations}}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#{$$self{"animations"};}) 0 0 0
1407 0 ▶ if ($self->{animations}[$i][0] == 0) { # setAttributeValue (0)
Branch: 6 branches
BranchTrueFalseTotal
if ($self->{'animations'}[$i][0] == 0) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 1) { } 0 0 0
elsif ($self->{'animations'}[$i][0] == 2) { } 0 0 0
elsif ($self->{'animations'}[$i][0] >= 11 and $self->{'animations'}[$i][0] <= 16) { } 0 0 0
elsif ($self->{'animations'}[$i][0] >= 21 and $self->{'animations'}[$i][0] <= 26) { } 0 0 0
elsif ($self->{'animations'}[$i][0] >= 31 and $self->{'animations'}[$i][0] <= 36) { } 0 0 0
1408 0 push @setAttributeValue, $self->{animations}[$i];
1409  
1410 } elsif ($self->{animations}[$i][0] == 1) { # changeThickness (1)
1411 0 push @changeThickness, $self->{animations}[$i];
1412  
1413 } elsif ($self->{animations}[$i][0] == 2) { # changeFillIntensity (2)
1414 0 push @changeFillIntensity, $self->{animations}[$i];
1415  
1416 ▶ } elsif (($self->{animations}[$i][0] >= 11) &&
Condition0%0/3
$self->{"animations"}[$i][0] >= 11 and $self->{"animations"}[$i][0] <= 16
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"animations"}[$i][0] >= 11 and $self->{"animations"}[$i][0] <= 16
$self->{"animations"}[$i][0] >= 11 $self->{"animations"}[$i][0] <= 16
Truth table0%0/3
A and B
A= $self->{"animations"}[$i][0] >= 11B= $self->{"animations"}[$i][0] <= 16
ABresult
0X0
100
111
1417 ($self->{animations}[$i][0] <= 16)) { # translate (11 - 16)
1418 0 push @translate, $self->{animations}[$i];
1419  
1420 ▶ } elsif (($self->{animations}[$i][0] >= 21) &&
Condition0%0/3
$self->{"animations"}[$i][0] >= 21 and $self->{"animations"}[$i][0] <= 26
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"animations"}[$i][0] >= 21 and $self->{"animations"}[$i][0] <= 26
$self->{"animations"}[$i][0] >= 21 $self->{"animations"}[$i][0] <= 26
Truth table0%0/3
A and B
A= $self->{"animations"}[$i][0] >= 21B= $self->{"animations"}[$i][0] <= 26
ABresult
0X0
100
111
1421 ($self->{animations}[$i][0] <= 26)) { # rotate (21 - 26)
1422 0 push @rotate, $self->{animations}[$i];
1423  
1424 ▶ } elsif (($self->{animations}[$i][0] >= 31) &&
Condition0%0/3
$self->{"animations"}[$i][0] >= 31 and $self->{"animations"}[$i][0] <= 36
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"animations"}[$i][0] >= 31 and $self->{"animations"}[$i][0] <= 36
$self->{"animations"}[$i][0] >= 31 $self->{"animations"}[$i][0] <= 36
Truth table0%0/3
A and B
A= $self->{"animations"}[$i][0] >= 31B= $self->{"animations"}[$i][0] <= 36
ABresult
0X0
100
111
1425 ($self->{animations}[$i][0] <= 36)) { # scale (31 - 36)
1426 0 push @scale, $self->{animations}[$i];
1427 }
1428 }
1429  
1430 0 my $i;
1431  
1432 0 ▶ for ($i = 0; $i <= $#setAttributeValue; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#setAttributeValue) 0 0 0
1433 0 my $name = $setAttributeValue[$i][1];
1434 0 my $begin = $setAttributeValue[$i][2];
1435 0 my $dur = $setAttributeValue[$i][3];
1436 0 my $attribute = $setAttributeValue[$i][4];
1437 0 my $value = $setAttributeValue[$i][5];
1438  
1439 0 my $last = $#{$self->{objects}->{$name}->{animations}} + 1;
1440  
1441 0 $self->{objects}->{$name}->{animations}[$last][0] = 0; # type
1442 0 $self->{objects}->{$name}->{animations}[$last][1] = $begin; # begin
1443 0 $self->{objects}->{$name}->{animations}[$last][2] = $dur; # dur
1444 0 $self->{objects}->{$name}->{animations}[$last][3] = $attribute; # attr
1445 0 $self->{objects}->{$name}->{animations}[$last][4] = $value; # value
1446 $self->{objects}->{$name}->{animations}[$last][5] =
1447 0 \@{$self->{colors}}; # colors
1448 }
1449  
1450 0 ▶ for ($i = 0; $i <= $#changeThickness; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#changeThickness) 0 0 0
1451 0 my $name = $changeThickness[$i][1];
1452 0 my $begin = $changeThickness[$i][2];
1453 0 my $dur = $changeThickness[$i][3];
1454 0 my $to = $changeThickness[$i][4];
1455 0 my $from;
1456  
1457 0 my $j = $i;
1458 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$j >= 0 and $name ne $changeThickness[$j][1] and do { do { --$j } } 0 0 0
Condition0%0/3
$j >= 0 and $name ne $changeThickness[$j][1]
!ll&&!rl&&r
000
MC/DC0%0/2
$j >= 0 and $name ne $changeThickness[$j][1]
$j >= 0 $name ne $changeThickness[$j][1]
Truth table0%0/3
A and B
A= $j >= 0B= $name ne $changeThickness[$j][1]
ABresult
0X0
100
111
1459 0 $j--;
1460 } while (($j >= 0) && ($name ne $changeThickness[$j][1]));
1461  
1462 0 ▶ if ($j == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j == -1) { } 0 0 0
1463 0 $from = $self->{objects}->{$name}->{thickness};
1464 } else {
1465 0 $from = $changeThickness[$j][4];
1466 }
1467  
1468 0 my $last = $#{$self->{objects}->{$name}->{animations}} + 1;
1469  
1470 0 $self->{objects}->{$name}->{animations}[$last][0] = 1; # type
1471 0 $self->{objects}->{$name}->{animations}[$last][1] = $from; # from
1472 0 $self->{objects}->{$name}->{animations}[$last][2] = $to; # to
1473 0 $self->{objects}->{$name}->{animations}[$last][3] = $begin; # begin
1474 0 $self->{objects}->{$name}->{animations}[$last][4] = $dur; # dur
1475 }
1476  
1477 0 ▶ for ($i = 0; $i <= $#changeFillIntensity; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#changeFillIntensity) 0 0 0
1478 0 my $name = $changeFillIntensity[$i][1];
1479 0 my $begin = $changeFillIntensity[$i][2];
1480 0 my $dur = $changeFillIntensity[$i][3];
1481 0 my $to = $changeFillIntensity[$i][4];
1482 0 my $from;
1483  
1484 0 my $j = $i;
1485 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$j >= 0 and $name ne $changeFillIntensity[$j][1] and do { do { --$j } } 0 0 0
Condition0%0/3
$j >= 0 and $name ne $changeFillIntensity[$j][1]
!ll&&!rl&&r
000
MC/DC0%0/2
$j >= 0 and $name ne $changeFillIntensity[$j][1]
$j >= 0 $name ne $changeFillIntensity[$j][1]
Truth table0%0/3
A and B
A= $j >= 0B= $name ne $changeFillIntensity[$j][1]
ABresult
0X0
100
111
1486 0 $j--;
1487 } while (($j >= 0) && ($name ne $changeFillIntensity[$j][1]));
1488  
1489 0 ▶ if ($j == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j == -1) { } 0 0 0
1490 0 $from = $self->{objects}->{$name}->{area_fill};
1491 } else {
1492 0 $from = $changeFillIntensity[$j][4];
1493 }
1494  
1495 0 my $last = $#{$self->{objects}->{$name}->{animations}} + 1;
1496  
1497 0 $self->{objects}->{$name}->{animations}[$last][0] = 2; # type
1498 0 $self->{objects}->{$name}->{animations}[$last][1] = $begin; # from
1499 0 $self->{objects}->{$name}->{animations}[$last][2] = $dur; # to
1500 0 $self->{objects}->{$name}->{animations}[$last][3] = $from; # begin
1501 0 $self->{objects}->{$name}->{animations}[$last][4] = $to; # dur
1502 $self->{objects}->{$name}->{animations}[$last][5] =
1503 0 $self->{objects}->{$name}->{fill_color}; # color
1504 $self->{objects}->{$name}->{animations}[$last][6] =
1505 0 \@{$self->{colors}}; # colors
1506 }
1507  
1508 0 ▶ for ($i = 0; $i <= $#translate; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#translate) 0 0 0
1509 0 my $type = $translate[$i][0];
1510 0 my $name = $translate[$i][1];
1511 0 my $begin = $translate[$i][2];
1512 0 my $dur = $translate[$i][3];
1513 0 my $x = $translate[$i][4];
1514 0 my $y = $translate[$i][5];
1515 0 my $unit = $translate[$i][6];
1516  
1517 0 my $last = $#{$self->{objects}->{$name}->{animations}} + 1;
1518  
1519 0 $self->{objects}->{$name}->{animations}[$last][0] = $type; # type
1520 0 $self->{objects}->{$name}->{animations}[$last][1] = $begin; # begin
1521 0 $self->{objects}->{$name}->{animations}[$last][2] = $dur; # dur
1522 0 $self->{objects}->{$name}->{animations}[$last][3] = $x; # x
1523 0 $self->{objects}->{$name}->{animations}[$last][4] = $y; # y
1524 0 $self->{objects}->{$name}->{animations}[$last][5] = $unit; # unit
1525 }
1526  
1527 0 ▶ for ($i = 0; $i <= $#rotate; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#rotate) 0 0 0
1528 0 my $type = $rotate[$i][0];
1529 0 my $name = $rotate[$i][1];
1530 0 my $begin = $rotate[$i][2];
1531 0 my $dur = $rotate[$i][3];
1532 0 my $angle = $rotate[$i][4];
1533 0 my $x = $rotate[$i][5];
1534 0 my $y = $rotate[$i][6];
1535 0 my $unit = $rotate[$i][7];
1536  
1537 0 my $last = $#{$self->{objects}->{$name}->{animations}} + 1;
1538  
1539 0 $self->{objects}->{$name}->{animations}[$last][0] = $type; # type
1540 0 $self->{objects}->{$name}->{animations}[$last][1] = $begin; # begin
1541 0 $self->{objects}->{$name}->{animations}[$last][2] = $dur; # dur
1542 0 $self->{objects}->{$name}->{animations}[$last][3] = $angle; # angle
1543 0 $self->{objects}->{$name}->{animations}[$last][4] = $x; # x
1544 0 $self->{objects}->{$name}->{animations}[$last][5] = $y; # y
1545 0 $self->{objects}->{$name}->{animations}[$last][6] = $unit; # unit
1546 }
1547  
1548 0 ▶ for ($i = 0; $i <= $#scale; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#scale) 0 0 0
1549 0 my $type = $scale[$i][0];
1550 0 my $name = $scale[$i][1];
1551 0 my $begin = $scale[$i][2];
1552 0 my $dur = $scale[$i][3];
1553 0 my $factor = $scale[$i][4];
1554 0 my $x = $scale[$i][5];
1555 0 my $y = $scale[$i][6];
1556  
1557 0 my $last = $#{$self->{objects}->{$name}->{animations}} + 1;
1558  
1559 0 $self->{objects}->{$name}->{animations}[$last][0] = $type; # type
1560 0 $self->{objects}->{$name}->{animations}[$last][1] = $begin; # begin
1561 0 $self->{objects}->{$name}->{animations}[$last][2] = $dur; # dur
1562 0 $self->{objects}->{$name}->{animations}[$last][3] = $factor; # factor
1563 0 $self->{objects}->{$name}->{animations}[$last][4] = $x; # x
1564 0 $self->{objects}->{$name}->{animations}[$last][5] = $y; # y
1565 }
1566  
1567 0 $self->writeSVGObjects($fh);
1568 }
1569  
1570  
1571 # useful functions
1572 0 ▶sub nextline {
Subroutine nextline: not called CC=3 SCAR=24.8
Pod undocumented
1573 0 my $fh = shift;
1574 0 ▶ if (eof $fh) {
Branch: 1 branch
BranchTrueFalseTotal
if (eof $fh) 0 0 0
1575 0 return;
1576 }
1577
1578 0 my $line = <$fh>;
1579 0 ▶ $line = nextline($fh) if ($line eq "\n");
Branch: 1 branch
BranchTrueFalseTotal
if $line eq "\n" 0 0 0
1580 0 chomp $line;
1581 0 return $line;
1582 }
1583  
1584  
1585 1 1;
1586 __END__
↑ Summary FigAnim/ConvertSVG.pm »