| 1 | package Compound; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | Compound - A XFig file animator class - Compound object | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | Compound object - object code in FIG format: 6. | ||||||||||||||||||||||||||||
| 10 | Here are all the attributes of this class: | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | B<upperleft_corner_x, upperleft_corner_y, lowerright_corner_x, | ||||||||||||||||||||||||||||
| 13 | lowerright_corner_y, arcs, compounds, ellipses, polylines, splines, texts, | ||||||||||||||||||||||||||||
| 14 | center_x, center_y> | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head1 FIG ATTRIBUTES | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =over | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =item upperleft_corner_x | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | Fig units | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =item upperleft_corner_y | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | Fig units | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =item lowerright_corner_x | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | Fig units | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =item lowerright_corner_y | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | Fig units | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =back | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 ADDITIONNAL ATTRIBUTES | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | =over | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =item arcs, compounds, ellipses, polylines, splines, texts | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | arrays containing every object's name classified by type | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =item center_x, center_y | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | calculated center (Fig units) | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =back | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =cut | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 55 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | # useful classes | ||||||||||||||||||||||||||||
| 58 | 1 | ▶ | use FigAnim::Utils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | # constructor | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 62 | 0 | my $proto = shift; | |||||||||||||||||||||||||||
| 63 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||
| 64 | 0 | my $self = {}; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | $self->{name} = shift; # object's name in comment | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | #$self->{object_code} = 6; | ||||||||||||||||||||||||||||
| 69 | 0 | $self->{upperleft_corner_x} = shift; | |||||||||||||||||||||||||||
| 70 | 0 | $self->{upperleft_corner_y} = shift; | |||||||||||||||||||||||||||
| 71 | 0 | $self->{lowerright_corner_x} = shift; | |||||||||||||||||||||||||||
| 72 | 0 | $self->{lowerright_corner_y} = shift; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | # reference to the FigFile | ||||||||||||||||||||||||||||
| 75 | 0 | $self->{fig_file} = shift; | |||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | # arrays containing every object's name classified by type | ||||||||||||||||||||||||||||
| 78 | 0 | $self->{arcs} = []; | |||||||||||||||||||||||||||
| 79 | 0 | $self->{compounds} = []; | |||||||||||||||||||||||||||
| 80 | 0 | $self->{ellipses} = []; | |||||||||||||||||||||||||||
| 81 | 0 | $self->{polylines} = []; | |||||||||||||||||||||||||||
| 82 | 0 | $self->{splines} = []; | |||||||||||||||||||||||||||
| 83 | 0 | $self->{texts} = []; | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | # calculated center | ||||||||||||||||||||||||||||
| 86 | 0 | $self->{center_x} = undef; | |||||||||||||||||||||||||||
| 87 | 0 | $self->{center_y} = undef; | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 0 | bless ($self, $class); | |||||||||||||||||||||||||||
| 90 | 0 | return $self; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | # methods | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | sub clone { | ||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 96 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 97 | 0 | my $obj = new Compound; | |||||||||||||||||||||||||||
| 98 | 0 | $obj->{$_} = $self->{$_} foreach (keys %{$self}); | |||||||||||||||||||||||||||
| 99 | 0 | return $obj; | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 0 | ▶ | sub output { | ||||||||||||||||||||||||||
|
Subroutine
output: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 103 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 0 | my $fh = shift; | |||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 0 | foreach (split(/\n/, $self->{name})) { | |||||||||||||||||||||||||||
| 108 | 0 | printf $fh "# $_\n"; | |||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | printf $fh "6 %d %d %d %d\n", | ||||||||||||||||||||||||||||
| 112 | 0 | @$self{'upperleft_corner_x','upperleft_corner_y','lowerright_corner_x', | |||||||||||||||||||||||||||
| 113 | 'lowerright_corner_y'}; | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 116 | 0 | $self->{fig_file}->{objects}->{$_}->output($fh); | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 120 | 0 | $self->{fig_file}->{objects}->{$_}->output($fh); | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 124 | 0 | $self->{fig_file}->{objects}->{$_}->output($fh); | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 128 | 0 | $self->{fig_file}->{objects}->{$_}->output($fh); | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 132 | 0 | $self->{fig_file}->{objects}->{$_}->output($fh); | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 0 | foreach (@{$self->{texts}}) { | |||||||||||||||||||||||||||
| 136 | 0 | $self->{fig_file}->{objects}->{$_}->output($fh); | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | print $fh "-6\n"; | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub calculateCenter { | ||||||||||||||||||||||||||
|
Subroutine
calculateCenter: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 143 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 144 | $self->{center_x} = sprintf("%.0f",($self->{upperleft_corner_x} + | ||||||||||||||||||||||||||||
| 145 | 0 | $self->{lowerright_corner_x}) / 2); | |||||||||||||||||||||||||||
| 146 | $self->{center_y} = sprintf("%.0f",($self->{upperleft_corner_y} + | ||||||||||||||||||||||||||||
| 147 | 0 | $self->{lowerright_corner_y}) / 2); | |||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | # objects selectors | ||||||||||||||||||||||||||||
| 152 | 0 | ▶ | sub selectByType { | ||||||||||||||||||||||||||
|
Subroutine
selectByType: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 153 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 154 | 0 | my $res = new Compound("",0,0,0,0,$self->{fig_file}); | |||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | foreach (@_) { | |||||||||||||||||||||||||||
| 157 | 0 | push @{$res->{$_}}, @{$self->{$_}}; | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 161 | 0 | my $aux = $self->{fig_file}->{objects}->{$_}->selectByType(@_); | |||||||||||||||||||||||||||
| 162 | 0 | foreach (@_) { | |||||||||||||||||||||||||||
| 163 | 0 | push @{$res->{$_}}, @{$aux->{$_}}; | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 0 | return $res; | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 0 | ▶ | sub selectByPenColor { | ||||||||||||||||||||||||||
|
Subroutine
selectByPenColor: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||
| 171 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 172 | 0 | my $res = new Compound("",0,0,0,0,$self->{fig_file}); | |||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 0 | foreach (@_) { | |||||||||||||||||||||||||||
| 175 | 0 | my $color = $FigAnim::Utils::colors_codes{$_}; | |||||||||||||||||||||||||||
| 176 | 0 | ▶ | if (defined $color) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 178 | 0 | ▶ | if ($self->{fig_file}->{objects}->{$_}->{pen_color} == $color){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 179 | 0 | push @{$res->{arcs}}, $_; | |||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 183 | 0 | ▶ | if ($self->{fig_file}->{objects}->{$_}->{pen_color} == $color){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | 0 | push @{$res->{ellipses}}, $_; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 188 | 0 | ▶ | if ($self->{fig_file}->{objects}->{$_}->{pen_color} == $color){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 189 | 0 | push @{$res->{polylines}}, $_; | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ($self->{fig_file}->{objects}->{$_}->{pen_color} == $color){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 194 | 0 | push @{$res->{splines}}, $_; | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | 0 | foreach (@{$self->{texts}}) { | |||||||||||||||||||||||||||
| 198 | 0 | ▶ | if ($self->{fig_file}->{objects}->{$_}->{pen_color} == $color){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 0 | push @{$res->{texts}}, $_; | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 206 | 0 | my $aux = $self->{fig_file}->{objects}->{$_}->selectByPenColor(@_); | |||||||||||||||||||||||||||
| 207 | 0 | push @{$res->{arcs}}, @{$aux->{arcs}}; | |||||||||||||||||||||||||||
| 208 | 0 | push @{$res->{ellipses}}, @{$aux->{ellipses}}; | |||||||||||||||||||||||||||
| 209 | 0 | push @{$res->{polylines}}, @{$aux->{polylines}}; | |||||||||||||||||||||||||||
| 210 | 0 | push @{$res->{splines}}, @{$aux->{splines}}; | |||||||||||||||||||||||||||
| 211 | 0 | push @{$res->{texts}}, @{$aux->{texts}}; | |||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | 0 | return $res; | |||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub selectByFillColor { | ||||||||||||||||||||||||||
|
Subroutine
selectByFillColor: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||
| 218 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 219 | 0 | my $res = new Compound("",0,0,0,0,$self->{fig_file}); | |||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | foreach (@_) { | |||||||||||||||||||||||||||
| 222 | 0 | my $color = $FigAnim::Utils::colors_codes{$_}; | |||||||||||||||||||||||||||
| 223 | 0 | ▶ | if (defined $color) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 224 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 225 | 0 | ▶ | if ($self->{fig_file}->{objects}->{$_}->{fill_color}==$color) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 226 | 0 | push @{$res->{arcs}}, $_; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 230 | 0 | ▶ | if ($self->{fig_file}->{objects}->{$_}->{fill_color}==$color) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 231 | 0 | push @{$res->{ellipses}}, $_; | |||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 235 | 0 | ▶ | if ($self->{fig_file}->{objects}->{$_}->{fill_color}==$color) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | 0 | push @{$res->{polylines}}, $_; | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 240 | 0 | ▶ | if ($self->{fig_file}->{objects}->{$_}->{fill_color}==$color) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 241 | 0 | push @{$res->{splines}}, $_; | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 248 | 0 | my $aux = $self->{fig_file}->{objects}->{$_}->selectByFillColor(@_); | |||||||||||||||||||||||||||
| 249 | 0 | push @{$res->{arcs}}, @{$aux->{arcs}}; | |||||||||||||||||||||||||||
| 250 | 0 | push @{$res->{ellipses}}, @{$aux->{ellipses}}; | |||||||||||||||||||||||||||
| 251 | 0 | push @{$res->{polylines}}, @{$aux->{polylines}}; | |||||||||||||||||||||||||||
| 252 | 0 | push @{$res->{splines}}, @{$aux->{splines}}; | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 0 | return $res; | |||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 0 | ▶ | sub selectByAttributeValue { | ||||||||||||||||||||||||||
|
Subroutine
selectByAttributeValue: not called CC=21 SCAR=61.4
| |||||||||||||||||||||||||||||
| 259 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 260 | 0 | my $res = new Compound("",0,0,0,0,$self); | |||||||||||||||||||||||||||
| 261 | 0 | my @params = @_; | |||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | 0 | ▶ | while (@params) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 264 | 0 | my $attribute = shift @params; | |||||||||||||||||||||||||||
| 265 | 0 | my $value = shift @params; | |||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 268 | 0 | ▶ | if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
MC/DC0%0/2
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
defined $self->{"fig_file"}{"objects"}{$_}{$attribute}
$self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"fig_file"}{"objects"}{$_}{$attribute}B= $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
| |||||||||||||||||||||||||||||
| 269 | ($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { | ||||||||||||||||||||||||||||
| 270 | 0 | push @{$res->{arcs}}, $_; | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 274 | 0 | ▶ | if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
MC/DC0%0/2
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
defined $self->{"fig_file"}{"objects"}{$_}{$attribute}
$self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"fig_file"}{"objects"}{$_}{$attribute}B= $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
| |||||||||||||||||||||||||||||
| 275 | ($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { | ||||||||||||||||||||||||||||
| 276 | 0 | push @{$res->{compounds}}, $_; | |||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 280 | 0 | ▶ | if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
MC/DC0%0/2
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
defined $self->{"fig_file"}{"objects"}{$_}{$attribute}
$self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"fig_file"}{"objects"}{$_}{$attribute}B= $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
| |||||||||||||||||||||||||||||
| 281 | ($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { | ||||||||||||||||||||||||||||
| 282 | 0 | push @{$res->{ellipses}}, $_; | |||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 286 | 0 | ▶ | if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
MC/DC0%0/2
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
defined $self->{"fig_file"}{"objects"}{$_}{$attribute}
$self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"fig_file"}{"objects"}{$_}{$attribute}B= $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
| |||||||||||||||||||||||||||||
| 287 | ($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { | ||||||||||||||||||||||||||||
| 288 | 0 | push @{$res->{polylines}}, $_; | |||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||
| 291 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 292 | 0 | ▶ | if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
MC/DC0%0/2
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
defined $self->{"fig_file"}{"objects"}{$_}{$attribute}
$self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"fig_file"}{"objects"}{$_}{$attribute}B= $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
| |||||||||||||||||||||||||||||
| 293 | ($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { | ||||||||||||||||||||||||||||
| 294 | 0 | push @{$res->{splines}}, $_; | |||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||
| 297 | 0 | foreach (@{$self->{texts}}) { | |||||||||||||||||||||||||||
| 298 | 0 | ▶ | if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
MC/DC0%0/2
defined $self->{"fig_file"}{"objects"}{$_}{$attribute} and $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
defined $self->{"fig_file"}{"objects"}{$_}{$attribute}
$self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
Truth table0%0/3
A and B
A= defined $self->{"fig_file"}{"objects"}{$_}{$attribute}B= $self->{"fig_file"}{"objects"}{$_}{$attribute} eq $value
| |||||||||||||||||||||||||||||
| 299 | ($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { | ||||||||||||||||||||||||||||
| 300 | 0 | push @{$res->{texts}}, $_; | |||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 306 | 0 | my $aux=$self->{fig_file}->{objects}->{$_}->selectByAttributeValue(@_); | |||||||||||||||||||||||||||
| 307 | 0 | push @{$res->{arcs}}, @{$aux->{arcs}}; | |||||||||||||||||||||||||||
| 308 | 0 | push @{$res->{compounds}}, @{$aux->{compounds}}; | |||||||||||||||||||||||||||
| 309 | 0 | push @{$res->{ellipses}}, @{$aux->{ellipses}}; | |||||||||||||||||||||||||||
| 310 | 0 | push @{$res->{polylines}}, @{$aux->{polylines}}; | |||||||||||||||||||||||||||
| 311 | 0 | push @{$res->{splines}}, @{$aux->{splines}}; | |||||||||||||||||||||||||||
| 312 | 0 | push @{$res->{texts}}, @{$aux->{texts}}; | |||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 0 | return $res; | |||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | # animation methods | ||||||||||||||||||||||||||||
| 320 | 0 | ▶ | sub setAttributeValue { | ||||||||||||||||||||||||||
|
Subroutine
setAttributeValue: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 321 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 322 | 0 | my $time = shift; | |||||||||||||||||||||||||||
| 323 | 0 | my $attribute = shift; | |||||||||||||||||||||||||||
| 324 | 0 | my $value = shift; | |||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 327 | 0 | $self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, | |||||||||||||||||||||||||||
| 328 | $value); | ||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||
| 330 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 331 | 0 | $self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, | |||||||||||||||||||||||||||
| 332 | $value); | ||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||
| 334 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 335 | 0 | $self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, | |||||||||||||||||||||||||||
| 336 | $value); | ||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||
| 338 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 339 | 0 | $self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, | |||||||||||||||||||||||||||
| 340 | $value); | ||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 343 | 0 | $self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, | |||||||||||||||||||||||||||
| 344 | $value); | ||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||
| 346 | 0 | foreach (@{$self->{texts}}) { | |||||||||||||||||||||||||||
| 347 | 0 | $self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, | |||||||||||||||||||||||||||
| 348 | $value); | ||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | 0 | ▶ | sub setPenColor { | ||||||||||||||||||||||||||
|
Subroutine
setPenColor: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 353 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 354 | 0 | my $time = shift; | |||||||||||||||||||||||||||
| 355 | 0 | my $color = $FigAnim::Utils::colors_codes{shift}; | |||||||||||||||||||||||||||
| 356 | 0 | ▶ | if (defined $color) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 357 | 0 | $self->setAttributeValue($time,'pen_color',$color); | |||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | 0 | ▶ | sub setFillColor { | ||||||||||||||||||||||||||
|
Subroutine
setFillColor: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 362 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 363 | 0 | my $time = shift; | |||||||||||||||||||||||||||
| 364 | 0 | my $color = $FigAnim::Utils::colors_codes{shift}; | |||||||||||||||||||||||||||
| 365 | 0 | ▶ | if (defined $color) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 366 | 0 | $self->setAttributeValue($time,'fill_color',$color); | |||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | 0 | ▶ | sub hide { | ||||||||||||||||||||||||||
|
Subroutine
hide: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 371 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 372 | 0 | my $time = shift; | |||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 375 | 0 | $self->{fig_file}->{objects}->{$_}->hide($time); | |||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||
| 377 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 378 | 0 | $self->{fig_file}->{objects}->{$_}->hide($time); | |||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||
| 380 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 381 | 0 | $self->{fig_file}->{objects}->{$_}->hide($time); | |||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||
| 383 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 384 | 0 | $self->{fig_file}->{objects}->{$_}->hide($time); | |||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||
| 386 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 387 | 0 | $self->{fig_file}->{objects}->{$_}->hide($time); | |||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||
| 389 | 0 | foreach (@{$self->{texts}}) { | |||||||||||||||||||||||||||
| 390 | 0 | $self->{fig_file}->{objects}->{$_}->hide($time); | |||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | 0 | ▶ | sub show { | ||||||||||||||||||||||||||
|
Subroutine
show: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 395 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 396 | 0 | my $time = shift; | |||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 399 | 0 | $self->{fig_file}->{objects}->{$_}->show($time); | |||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||
| 401 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 402 | 0 | $self->{fig_file}->{objects}->{$_}->show($time); | |||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||
| 404 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 405 | 0 | $self->{fig_file}->{objects}->{$_}->show($time); | |||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||
| 407 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 408 | 0 | $self->{fig_file}->{objects}->{$_}->show($time); | |||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||
| 410 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 411 | 0 | $self->{fig_file}->{objects}->{$_}->show($time); | |||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||
| 413 | 0 | foreach (@{$self->{texts}}) { | |||||||||||||||||||||||||||
| 414 | 0 | $self->{fig_file}->{objects}->{$_}->show($time); | |||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | 0 | ▶ | sub changeThickness { | ||||||||||||||||||||||||||
|
Subroutine
changeThickness: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 419 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 420 | 0 | my $beginning = shift; | |||||||||||||||||||||||||||
| 421 | 0 | my $duration = shift; | |||||||||||||||||||||||||||
| 422 | 0 | my $thickness = shift; | |||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 425 | 0 | $self->{fig_file}->{objects}->{$_}->changeThickness($beginning, | |||||||||||||||||||||||||||
| 426 | $duration, | ||||||||||||||||||||||||||||
| 427 | $thickness); | ||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||
| 429 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 430 | 0 | $self->{fig_file}->{objects}->{$_}->changeThickness($beginning, | |||||||||||||||||||||||||||
| 431 | $duration, | ||||||||||||||||||||||||||||
| 432 | $thickness); | ||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||
| 434 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 435 | 0 | $self->{fig_file}->{objects}->{$_}->changeThickness($beginning, | |||||||||||||||||||||||||||
| 436 | $duration, | ||||||||||||||||||||||||||||
| 437 | $thickness); | ||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||
| 439 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 440 | 0 | $self->{fig_file}->{objects}->{$_}->changeThickness($beginning, | |||||||||||||||||||||||||||
| 441 | $duration, | ||||||||||||||||||||||||||||
| 442 | $thickness); | ||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||
| 444 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 445 | 0 | $self->{fig_file}->{objects}->{$_}->changeThickness($beginning, | |||||||||||||||||||||||||||
| 446 | $duration, | ||||||||||||||||||||||||||||
| 447 | $thickness); | ||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | 0 | ▶ | sub changeFillIntensity { | ||||||||||||||||||||||||||
|
Subroutine
changeFillIntensity: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 452 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 453 | 0 | my $beginning = shift; | |||||||||||||||||||||||||||
| 454 | 0 | my $duration = shift; | |||||||||||||||||||||||||||
| 455 | 0 | my $intensity = shift; | |||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 458 | 0 | $self->{fig_file}->{objects}->{$_}->changeFillIntensity($beginning, | |||||||||||||||||||||||||||
| 459 | $duration, | ||||||||||||||||||||||||||||
| 460 | $intensity); | ||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||
| 462 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 463 | 0 | $self->{fig_file}->{objects}->{$_}->changeFillIntensity($beginning, | |||||||||||||||||||||||||||
| 464 | $duration, | ||||||||||||||||||||||||||||
| 465 | $intensity); | ||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||
| 467 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 468 | 0 | $self->{fig_file}->{objects}->{$_}->changeFillIntensity($beginning, | |||||||||||||||||||||||||||
| 469 | $duration, | ||||||||||||||||||||||||||||
| 470 | $intensity); | ||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||
| 472 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 473 | 0 | $self->{fig_file}->{objects}->{$_}->changeFillIntensity($beginning, | |||||||||||||||||||||||||||
| 474 | $duration, | ||||||||||||||||||||||||||||
| 475 | $intensity); | ||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||
| 477 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 478 | 0 | $self->{fig_file}->{objects}->{$_}->changeFillIntensity($beginning, | |||||||||||||||||||||||||||
| 479 | $duration, | ||||||||||||||||||||||||||||
| 480 | $intensity); | ||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||
| 484 | 0 | ▶ | sub translate { | ||||||||||||||||||||||||||
|
Subroutine
translate: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 485 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 486 | 0 | my $beginning = shift; | |||||||||||||||||||||||||||
| 487 | 0 | my $duration = shift; | |||||||||||||||||||||||||||
| 488 | 0 | my $x = shift; | |||||||||||||||||||||||||||
| 489 | 0 | my $y = shift; | |||||||||||||||||||||||||||
| 490 | 0 | my $unit = shift; | |||||||||||||||||||||||||||
| 491 | 0 | ▶ | $unit = '' if (!(defined $unit)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | 0 | my @anim = (16, $self->{name}, $beginning, $duration, $x, $y, $unit); | |||||||||||||||||||||||||||
| 494 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||
| 496 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 497 | 0 | $self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, | |||||||||||||||||||||||||||
| 498 | $x, $y, $unit); | ||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||
| 500 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 501 | 0 | $self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, | |||||||||||||||||||||||||||
| 502 | $x, $y, $unit); | ||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||
| 504 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 505 | 0 | $self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, | |||||||||||||||||||||||||||
| 506 | $x, $y, $unit); | ||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||
| 508 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 509 | 0 | $self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, | |||||||||||||||||||||||||||
| 510 | $x, $y, $unit); | ||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||
| 512 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 513 | 0 | $self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, | |||||||||||||||||||||||||||
| 514 | $x, $y, $unit); | ||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||
| 516 | 0 | foreach (@{$self->{texts}}) { | |||||||||||||||||||||||||||
| 517 | 0 | $self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, | |||||||||||||||||||||||||||
| 518 | $x, $y, $unit); | ||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||
| 522 | 0 | ▶ | sub rotate { | ||||||||||||||||||||||||||
|
Subroutine
rotate: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||
| 523 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 524 | 0 | my $beginning = shift; | |||||||||||||||||||||||||||
| 525 | 0 | my $duration = shift; | |||||||||||||||||||||||||||
| 526 | 0 | my $angle = shift; | |||||||||||||||||||||||||||
| 527 | 0 | my $c_x = shift; | |||||||||||||||||||||||||||
| 528 | 0 | my $c_y = shift; | |||||||||||||||||||||||||||
| 529 | 0 | ▶ | if (!((defined $c_x) && (defined $c_y))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $c_x and defined $c_y
MC/DC0%0/2
defined $c_x and defined $c_y
defined $c_x
defined $c_y
Truth table0%0/3
A and B
A= defined $c_xB= defined $c_y
| |||||||||||||||||||||||||||||
| 530 | 0 | $c_x = $self->{center_x}; | |||||||||||||||||||||||||||
| 531 | 0 | $c_y = $self->{center_y}; | |||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||
| 533 | 0 | my $unit = shift; | |||||||||||||||||||||||||||
| 534 | 0 | ▶ | $unit = '' if (!(defined $unit)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||
| 536 | 0 | my @anim = (26, $self->{name},$beginning,$duration,$angle,$c_x,$c_y,$unit); | |||||||||||||||||||||||||||
| 537 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||
| 539 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 540 | 0 | $self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, | |||||||||||||||||||||||||||
| 541 | $c_x,$c_y,$unit); | ||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||
| 543 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 544 | 0 | $self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, | |||||||||||||||||||||||||||
| 545 | $c_x,$c_y,$unit); | ||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||
| 547 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 548 | 0 | $self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, | |||||||||||||||||||||||||||
| 549 | $c_x,$c_y,$unit); | ||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||
| 551 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 552 | 0 | $self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, | |||||||||||||||||||||||||||
| 553 | $c_x,$c_y,$unit); | ||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||
| 555 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 556 | 0 | $self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, | |||||||||||||||||||||||||||
| 557 | $c_x,$c_y,$unit); | ||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||
| 559 | 0 | foreach (@{$self->{texts}}) { | |||||||||||||||||||||||||||
| 560 | 0 | $self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, | |||||||||||||||||||||||||||
| 561 | $c_x,$c_y,$unit); | ||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||
| 565 | 0 | ▶ | sub scale { | ||||||||||||||||||||||||||
|
Subroutine
scale: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||
| 566 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 567 | 0 | my $beginning = shift; | |||||||||||||||||||||||||||
| 568 | 0 | my $duration = shift; | |||||||||||||||||||||||||||
| 569 | 0 | my $scale = shift; | |||||||||||||||||||||||||||
| 570 | 0 | my $c_x = shift; | |||||||||||||||||||||||||||
| 571 | 0 | my $c_y = shift; | |||||||||||||||||||||||||||
| 572 | 0 | ▶ | if (!((defined $c_x) && (defined $c_y))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $c_x and defined $c_y
MC/DC0%0/2
defined $c_x and defined $c_y
defined $c_x
defined $c_y
Truth table0%0/3
A and B
A= defined $c_xB= defined $c_y
| |||||||||||||||||||||||||||||
| 573 | 0 | $c_x = $self->{center_x}; | |||||||||||||||||||||||||||
| 574 | 0 | $c_y = $self->{center_y}; | |||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||
| 577 | 0 | my @anim = (36, $self->{name},$beginning,$duration,$scale,$c_x,$c_y); | |||||||||||||||||||||||||||
| 578 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||
| 580 | 0 | foreach (@{$self->{arcs}}) { | |||||||||||||||||||||||||||
| 581 | 0 | $self->{fig_file}->{objects}->{$_}->scale($beginning,$duration,$scale, | |||||||||||||||||||||||||||
| 582 | $c_x,$c_y); | ||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||
| 584 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 585 | 0 | $self->{fig_file}->{objects}->{$_}->scale($beginning,$duration,$scale, | |||||||||||||||||||||||||||
| 586 | $c_x,$c_y); | ||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||
| 588 | 0 | foreach (@{$self->{ellipses}}) { | |||||||||||||||||||||||||||
| 589 | 0 | $self->{fig_file}->{objects}->{$_}->scale($beginning,$duration,$scale, | |||||||||||||||||||||||||||
| 590 | $c_x,$c_y); | ||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||
| 592 | 0 | foreach (@{$self->{polylines}}) { | |||||||||||||||||||||||||||
| 593 | 0 | $self->{fig_file}->{objects}->{$_}->scale($beginning,$duration,$scale, | |||||||||||||||||||||||||||
| 594 | $c_x,$c_y); | ||||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||
| 596 | 0 | foreach (@{$self->{splines}}) { | |||||||||||||||||||||||||||
| 597 | 0 | $self->{fig_file}->{objects}->{$_}->scale($beginning,$duration,$scale, | |||||||||||||||||||||||||||
| 598 | $c_x,$c_y); | ||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||
| 600 | 0 | foreach (@{$self->{texts}}) { | |||||||||||||||||||||||||||
| 601 | 0 | $self->{fig_file}->{objects}->{$_}->scale($beginning,$duration,$scale, | |||||||||||||||||||||||||||
| 602 | $c_x,$c_y); | ||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||
| 607 | # outputs a SVG element | ||||||||||||||||||||||||||||
| 608 | 0 | ▶ | sub outputSVG { | ||||||||||||||||||||||||||
|
Subroutine
outputSVG: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 609 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 610 | 0 | my $fh = shift; | |||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||
| 612 | 0 | my ($colors) = @_; | |||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||
| 614 | 0 | foreach (split(/\n/, $self->{name})) { | |||||||||||||||||||||||||||
| 615 | 0 | print $fh "<!-- $_ -->\n"; | |||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||
| 618 | 0 | print $fh "<g>\n"; | |||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||
| 620 | 0 | my @objects = @{$self->{arcs}}; | |||||||||||||||||||||||||||
| 621 | 0 | push @objects, @{$self->{ellipses}}; | |||||||||||||||||||||||||||
| 622 | 0 | push @objects, @{$self->{polylines}}; | |||||||||||||||||||||||||||
| 623 | 0 | push @objects, @{$self->{splines}}; | |||||||||||||||||||||||||||
| 624 | 0 | push @objects, @{$self->{texts}}; | |||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||
| 626 | # sorts objects by depth | ||||||||||||||||||||||||||||
| 627 | @objects = | ||||||||||||||||||||||||||||
| 628 | sort { | ||||||||||||||||||||||||||||
| 629 | 0 | ▶ | if ($self->{fig_file}->{objects}->{$a}->{depth} < | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 630 | $self->{fig_file}->{objects}->{$b}->{depth}) { | ||||||||||||||||||||||||||||
| 631 | 0 | return 1; | |||||||||||||||||||||||||||
| 632 | } elsif ($self->{fig_file}->{objects}->{$a}->{depth} == | ||||||||||||||||||||||||||||
| 633 | $self->{fig_file}->{objects}->{$b}->{depth}) { | ||||||||||||||||||||||||||||
| 634 | 0 | return 0; | |||||||||||||||||||||||||||
| 635 | } else { | ||||||||||||||||||||||||||||
| 636 | 0 | return -1; | |||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||
| 638 | } @objects; | ||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||
| 640 | 0 | foreach (@objects) { | |||||||||||||||||||||||||||
| 641 | 0 | $self->{fig_file}->{objects}->{$_}->outputSVG($fh, $colors); | |||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||
| 644 | 0 | foreach (@{$self->{compounds}}) { | |||||||||||||||||||||||||||
| 645 | 0 | $self->{fig_file}->{objects}->{$_}->outputSVG($fh, $colors); | |||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||
| 648 | 0 | print $fh "</g>\n\n"; | |||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||
| 652 | 1 | 1; | |||||||||||||||||||||||||||