| 1 | package Polyline; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | Polyline - A XFig file animator class - Polyline object | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | Polyline object - object code in FIG format: 2. | ||||||||||||||||||||||||||||||||||||||||||
| 10 | Here are all the attributes of this class: | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | B<sub_type, line_style, thickness, pen_color, fill_color, depth, pen_style, | ||||||||||||||||||||||||||||||||||||||||||
| 13 | area_fill, style_val, join_style, cap_style, radius, forward_arrow, | ||||||||||||||||||||||||||||||||||||||||||
| 14 | backward_arrow, npoints, f_arrow_type, f_arrow_style, | ||||||||||||||||||||||||||||||||||||||||||
| 15 | f_arrow_thickness, f_arrow_width, f_arrow_height, b_arrow_type, b_arrow_style, | ||||||||||||||||||||||||||||||||||||||||||
| 16 | b_arrow_thickness, b_arrow_width, b_arrow_height, xnpoints, ynpoints, | ||||||||||||||||||||||||||||||||||||||||||
| 17 | flipped, file, visibility, center_x, center_y> | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 FIG ATTRIBUTES | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | =item sub_type | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 1: polyline; | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 2: box; | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 3: polygon; | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 4: arc-box; | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 5: imported-picture bounding-box. | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | =item line_style | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | -1: Default; | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 0: Solid; | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 1: Dashed; | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 2: Dotted; | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 3: Dash-dotted; | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 4: Dash-double-dotted; | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 5: Dash-triple-dotted. | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | =item thickness | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 80-ths of an inch ("display units") | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | =item pen_color | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | -1..31: FIG colors; | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 32..543 (512 total): user colors. | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | =item fill_color | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | -1..31: FIG colors; | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 32..543 (512 total): user colors. | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | =item depth | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 ... 999: larger value means object is deeper than (under) | ||||||||||||||||||||||||||||||||||||||||||
| 58 | objects with smaller depth | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | =item pen_style | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | unused | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | =item area_fill | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | fill type | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | =item style_val | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | length, in 1/80 inches, of the on/off | ||||||||||||||||||||||||||||||||||||||||||
| 71 | dashes for dashed lines, and the distance between the dots, in 1/80 inches, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | for dotted lines | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | =item join_style | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 = Miter (default); | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 = Bevel; | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 2 = Round. | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | =item cap_style | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 = Butt (default); | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 = Round; | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 = Projecting. | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | =item radius | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 1/80 inch, radius of arc-boxes | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | =item forward_arrow | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0: no forward arrow; | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 1: on | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | =item backward_arrow | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0: no backward arrow; | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 1: on | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | =item npoints | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | number of points in line | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | =item f_arrow_type, b_arrow_type | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0: Stick-type (default); | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 1: Closed triangle; | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 2: Closed with "indented" butt; | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 3: Closed with "pointed" butt | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | =item f_arrow_style, b_arrow_style | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0: Hollow (filled with white); | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 1: Filled with pen_color | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | =item f_arrow_thickness, b_arrow_thickness | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 1/80 inch | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | =item f_arrow_width, b_arrow_width | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | Fig units | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | =item f_arrow_height, b_arrow_height | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | Fig units | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | =item xnpoints, ynpoints | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | arrays of points coordinates in Fig units | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | =item flipped | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | picture orientation: | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 0: normal; | ||||||||||||||||||||||||||||||||||||||||||
| 136 | 1: flipped. | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | =item file | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | name of picture file to import | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | =head1 ADDITONNAL ATTRIBUTES | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | =item visibility | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 0: hidden; | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 1: shown | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | =item center_x, center_y | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | calculated center (Fig units) | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | # useful classes | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | ▶ | use FigAnim::Utils; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | # constructor | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $proto = shift; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $self->{name} = shift; # object's name in comment | |||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | #$self->{object_code} = 2; | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $self->{sub_type} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $self->{line_style} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $self->{thickness} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $self->{pen_color} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $self->{fill_color} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $self->{depth} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $self->{pen_style} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $self->{area_fill} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $self->{style_val} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $self->{join_style} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $self->{cap_style} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $self->{radius} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $self->{forward_arrow} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $self->{backward_arrow} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | $self->{npoints} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | # forward arrow | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $self->{f_arrow_type} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $self->{f_arrow_style} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $self->{f_arrow_thickness} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | $self->{f_arrow_width} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $self->{f_arrow_height} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | # backward arrow | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $self->{b_arrow_type} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $self->{b_arrow_style} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $self->{b_arrow_thickness} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $self->{b_arrow_width} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $self->{b_arrow_height} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | # picture | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | $self->{flipped} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $self->{file} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | # points | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $self->{xnpoints} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $self->{ynpoints} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | # reference to the FigFile | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | $self->{fig_file} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | # object's visibility : 0=hidden 1=shown | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $self->{visibility} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | # calculated center | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $self->{center_x} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $self->{center_y} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | # animations | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $self->{animations} = []; | |||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | bless ($self, $class); | |||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | # methods | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | sub clone { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $obj = new Polyline; | |||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | foreach ('name','sub_type','line_style','thickness','pen_color', | |||||||||||||||||||||||||||||||||||||||||
| 238 | 'fill_color','depth','pen_style','area_fill','style_val', | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 'join_style','cap_style','radius','forward_arrow', | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 'backward_arrow','npoints','f_arrow_type','f_arrow_style', | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 'f_arrow_thickness','f_arrow_width','f_arrow_height', | ||||||||||||||||||||||||||||||||||||||||||
| 242 | 'b_arrow_type','b_arrow_style','b_arrow_thickness', | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 'b_arrow_width','b_arrow_height','flipped','file','fig_file', | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 'visibility','center_x','center_y') { | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $obj->{$_} = $self->{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | $obj->{xnpoints} = []; | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | push @{$obj->{xnpoints}}, @{$self->{xnpoints}}; | |||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $obj->{ynpoints} = []; | |||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | push @{$obj->{ynpoints}}, @{$self->{ynpoints}}; | |||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | return $obj; | |||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | sub output { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
output: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | return if ($self->{visibility} == 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | my $fh = shift; | |||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | foreach (split(/\n/, $self->{name})) { | |||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | printf $fh "# $_\n"; | |||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | printf $fh | ||||||||||||||||||||||||||||||||||||||||||
| 268 | "2 %d %d %d %d %d %d %d %d %.3f %d %d %d %d %d %d\n", | ||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | @$self{'sub_type','line_style','thickness','pen_color','fill_color', | |||||||||||||||||||||||||||||||||||||||||
| 270 | 'depth','pen_style','area_fill','style_val','join_style', | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 'cap_style','radius','forward_arrow','backward_arrow', | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 'npoints'}; | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | if ($self->{forward_arrow}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | printf $fh "\t%d %d %.2f %.2f %.2f\n", | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | @$self{'f_arrow_type','f_arrow_style','f_arrow_thickness', | |||||||||||||||||||||||||||||||||||||||||
| 277 | 'f_arrow_width','f_arrow_height'}; | ||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | if ($self->{backward_arrow}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | printf $fh "\t%d %d %.2f %.2f %.2f\n", | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | @$self{'b_arrow_type','b_arrow_style','b_arrow_thickness', | |||||||||||||||||||||||||||||||||||||||||
| 283 | 'b_arrow_width','b_arrow_height'}; | ||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | if ($self->{sub_type} == 5) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | printf $fh "\t%d %s\n", @$self{'flipped','file'}; | |||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | for (0..$self->{npoints}-1) { | |||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | printf $fh "\t" if (($_ % 6) == 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | printf $fh " %d %d", $self->{xnpoints}[$_], $self->{ynpoints}[$_]; | |||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | printf $fh "\n" if (($_ % 6) == 5); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | printf $fh "\n" if (($self->{npoints} % 6) != 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | sub calculateCenter { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
calculateCenter: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | if (($self->{npoints} > 1) && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->{"npoints"} > 1 and $self->{"xnpoints"}[$self->{"npoints"} - 1] == $self->{"xnpoints"}[0] and $self->{"ynpoints"}[$self->{"npoints"} - 1] == $self->{"ynpoints"}[0]
$self->{"npoints"} > 1 and $self->{"xnpoints"}[$self->{"npoints"} - 1] == $self->{"xnpoints"}[0]
MC/DC0%0/3
$self->{"npoints"} > 1 and $self->{"xnpoints"}[$self->{"npoints"} - 1] == $self->{"xnpoints"}[0] and $self->{"ynpoints"}[$self->{"npoints"} - 1] == $self->{"ynpoints"}[0]
$self->{"npoints"} > 1
$self->{"xnpoints"}[$self->{"npoints"} - 1] == $self->{"xnpoints"}[0]
$self->{"ynpoints"}[$self->{"npoints"} - 1] == $self->{"ynpoints"}[0]
Truth table0%0/4
A and B and C
A= $self->{"npoints"} > 1B= $self->{"xnpoints"}[$self->{"npoints"} - 1] == $self->{"xnpoints"}[0]C= $self->{"ynpoints"}[$self->{"npoints"} - 1] == $self->{"ynpoints"}[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | ($self->{xnpoints}[$self->{npoints}-1] == $self->{xnpoints}[0]) && | ||||||||||||||||||||||||||||||||||||||||||
| 302 | ($self->{ynpoints}[$self->{npoints}-1] == $self->{ynpoints}[0])) { | ||||||||||||||||||||||||||||||||||||||||||
| 303 | $self->{center_x} = | ||||||||||||||||||||||||||||||||||||||||||
| 304 | sprintf("%.0f", | ||||||||||||||||||||||||||||||||||||||||||
| 305 | eval(join('+', | ||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | @{$self->{xnpoints}}[0..$self->{npoints}-2] | |||||||||||||||||||||||||||||||||||||||||
| 307 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ) / ($self->{npoints}-1)); | |||||||||||||||||||||||||||||||||||||||||
| 309 | $self->{center_y} = | ||||||||||||||||||||||||||||||||||||||||||
| 310 | sprintf("%.0f", | ||||||||||||||||||||||||||||||||||||||||||
| 311 | eval(join('+', | ||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | @{$self->{ynpoints}}[0..$self->{npoints}-2] | |||||||||||||||||||||||||||||||||||||||||
| 313 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ) / ($self->{npoints}-1)); | |||||||||||||||||||||||||||||||||||||||||
| 315 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 316 | $self->{center_x} = | ||||||||||||||||||||||||||||||||||||||||||
| 317 | sprintf("%.0f", | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | eval(join('+',@{$self->{xnpoints}}))/$self->{npoints}); | |||||||||||||||||||||||||||||||||||||||||
| 319 | $self->{center_y} = | ||||||||||||||||||||||||||||||||||||||||||
| 320 | sprintf("%.0f", | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | eval(join('+',@{$self->{ynpoints}}))/$self->{npoints}); | |||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | # animation methods | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | sub setAttributeValue { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setAttributeValue: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | my @anim = (0, $self->{name}, shift, 0, shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | sub setPenColor { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setPenColor: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | my $time = shift; | |||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | my $color = $FigAnim::Utils::colors_codes{shift}; | |||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | if (defined $color) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | my @anim = (0, $self->{name}, $time, 0, 'pen_color', $color); | |||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | sub setFillColor { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setFillColor: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | my $time = shift; | |||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | my $color = $FigAnim::Utils::colors_codes{shift}; | |||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | if (defined $color) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my @anim = (0, $self->{name}, $time, 0, 'fill_color', $color); | |||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | sub hide { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hide: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my @anim = (0, $self->{name}, shift, 0, 'visibility', 0); | |||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | sub show { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
show: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | my @anim = (0, $self->{name}, shift, 0, 'visibility', 1); | |||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | sub changeThickness { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
changeThickness: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my @anim = (1, $self->{name}, shift, shift, int shift); | |||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | sub changeFillIntensity { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
changeFillIntensity: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | my @anim = (2, $self->{name}, shift, shift, int shift); | |||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | $anim[4] = 0 if ($anim[4] < 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | $anim[4] = 20 if ($anim[4] > 20); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | sub translate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
translate: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | my @anim = (12, $self->{name}, shift, shift, shift, shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | $anim[6] = '' if (!(defined $anim[6])); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | sub rotate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rotate: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | my @anim = (22, $self->{name}, shift, shift, shift, shift, shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | if (!((defined $anim[5]) && (defined $anim[6]))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $anim[5] and defined $anim[6]
MC/DC0%0/2
defined $anim[5] and defined $anim[6]
defined $anim[5]
defined $anim[6]
Truth table0%0/3
A and B
A= defined $anim[5]B= defined $anim[6]
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $anim[5] = $self->{center_x}; | |||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | $anim[6] = $self->{center_y}; | |||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | $anim[7] = '' if (!(defined $anim[7])); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | sub scale { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scale: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | my @anim = (32, $self->{name}, shift, shift, shift, shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | if (!((defined $anim[5]) && (defined $anim[6]))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $anim[5] and defined $anim[6]
MC/DC0%0/2
defined $anim[5] and defined $anim[6]
defined $anim[5]
defined $anim[6]
Truth table0%0/3
A and B
A= defined $anim[5]B= defined $anim[6]
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | $anim[5] = $self->{center_x}; | |||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | $anim[6] = $self->{center_y}; | |||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | push @{$self->{fig_file}->{animations}}, \@anim; | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | # outputs a SVG element | ||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | sub outputSVG { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
outputSVG: not called CC=25 SCAR=64.8
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | my $fh = shift; | |||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | my ($colors) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | foreach (split(/\n/, $self->{name})) { | |||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | print $fh "<!-- $_ -->\n"; | |||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | # converts values in SVG-CSS | ||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | my $style = "style=\""; | |||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | ▶ | if ($self->{sub_type} == 1) { # polyline | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | if ($self->{npoints} == 1) { # one point -> square in SVG | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | $style .= "stroke-width: 0; "; | |||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | # pen_color | ||||||||||||||||||||||||||||||||||||||||||
| 430 | $style .= | ||||||||||||||||||||||||||||||||||||||||||
| 431 | "fill: " . | ||||||||||||||||||||||||||||||||||||||||||
| 432 | ConvertSVG::pen_fill_colors_to_rgb($self->{pen_color}, | ||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | $colors); | |||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | # end of style | ||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | $style .= "\""; | |||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | # thickness | ||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | my $thickness = ConvertSVG::thickness_to_value($self->{thickness}); | |||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | # top, left | ||||||||||||||||||||||||||||||||||||||||||
| 442 | my $x = "x=\"" . | ||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | int($self->{xnpoints}[0] - ($thickness / 2)) . | |||||||||||||||||||||||||||||||||||||||||
| 444 | "\""; | ||||||||||||||||||||||||||||||||||||||||||
| 445 | my $y = "y=\"" . | ||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | int($self->{ynpoints}[0] - ($thickness / 2)) . | |||||||||||||||||||||||||||||||||||||||||
| 447 | "\""; | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | # width, height | ||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | my $width = "width=\"" . $thickness . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | my $height = "height=\"" . $thickness . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | print $fh "<rect $x $y $width $height $style />\n"; | |||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | } else { # two points at least | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | # converts arrows into SVG paths | ||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | my $f_arrow_name = ""; | |||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | my $b_arrow_name = ""; | |||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | if ($self->{forward_arrow} == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $_ = $self->{name}; | |||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | s/\W//g; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | $f_arrow_name = $_ . "_f_arrow"; | |||||||||||||||||||||||||||||||||||||||||
| 466 | my $f_arrow = | ||||||||||||||||||||||||||||||||||||||||||
| 467 | ConvertSVG::arrows_to_markers($f_arrow_name, | ||||||||||||||||||||||||||||||||||||||||||
| 468 | 1, | ||||||||||||||||||||||||||||||||||||||||||
| 469 | "auto", | ||||||||||||||||||||||||||||||||||||||||||
| 470 | $self->{f_arrow_type}, | ||||||||||||||||||||||||||||||||||||||||||
| 471 | $self->{f_arrow_style}, | ||||||||||||||||||||||||||||||||||||||||||
| 472 | $self->{f_arrow_thickness}, | ||||||||||||||||||||||||||||||||||||||||||
| 473 | $self->{f_arrow_width}, | ||||||||||||||||||||||||||||||||||||||||||
| 474 | $self->{f_arrow_height}, | ||||||||||||||||||||||||||||||||||||||||||
| 475 | $self->{pen_color}, | ||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $colors); | |||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | print $fh $f_arrow; | |||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | $style .= | |||||||||||||||||||||||||||||||||||||||||
| 479 | "marker-end: url(#" . $f_arrow_name . "); "; | ||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | ▶ | if ($self->{backward_arrow} == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | $_ = $self->{name}; | |||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | s/\W//g; | |||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $b_arrow_name = $_ . "_b_arrow"; | |||||||||||||||||||||||||||||||||||||||||
| 486 | my $b_arrow = | ||||||||||||||||||||||||||||||||||||||||||
| 487 | ConvertSVG::arrows_to_markers($b_arrow_name, | ||||||||||||||||||||||||||||||||||||||||||
| 488 | 0, | ||||||||||||||||||||||||||||||||||||||||||
| 489 | "auto", | ||||||||||||||||||||||||||||||||||||||||||
| 490 | $self->{b_arrow_type}, | ||||||||||||||||||||||||||||||||||||||||||
| 491 | $self->{b_arrow_style}, | ||||||||||||||||||||||||||||||||||||||||||
| 492 | $self->{b_arrow_thickness}, | ||||||||||||||||||||||||||||||||||||||||||
| 493 | $self->{b_arrow_width}, | ||||||||||||||||||||||||||||||||||||||||||
| 494 | $self->{b_arrow_height}, | ||||||||||||||||||||||||||||||||||||||||||
| 495 | $self->{pen_color}, | ||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | $colors); | |||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | print $fh $b_arrow; | |||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $style .= | |||||||||||||||||||||||||||||||||||||||||
| 499 | "marker-start: url(#" . $b_arrow_name . "); "; | ||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||
| 502 | # line_style, style_val, pen_color | ||||||||||||||||||||||||||||||||||||||||||
| 503 | $style .= ConvertSVG::line_style_to_stroke($self->{line_style}, | ||||||||||||||||||||||||||||||||||||||||||
| 504 | $self->{style_val}, | ||||||||||||||||||||||||||||||||||||||||||
| 505 | $self->{pen_color}, | ||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | $colors) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 507 | # thickness | ||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | $style .= ConvertSVG::thickness_to_stroke($self->{thickness}) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | # fill_color, area_fill | ||||||||||||||||||||||||||||||||||||||||||
| 511 | $style .= ConvertSVG::area_fill_to_fill($self->{area_fill}, | ||||||||||||||||||||||||||||||||||||||||||
| 512 | $self->{fill_color}, | ||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | $colors) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||
| 516 | # join_style | ||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | $style .= ConvertSVG::join_style_to_linejoin($self->{join_style}) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 518 | # cap_style | ||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | $style .= ConvertSVG::cap_style_to_linecap($self->{cap_style}); | |||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | # end of style | ||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | $style .= "\""; | |||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | # points | ||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | my $points = "points=\""; | |||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | for (0 .. $self->{npoints}-1) { | |||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | $points .= $self->{xnpoints}[$_] . " " . $self->{ynpoints}[$_]; | |||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | if ($_ < $self->{npoints}-1) { $points .= ", "; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | $points .= "\""; | |||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | print $fh "<polyline $points $style"; | |||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | if ($#{$self->{animations}} >= 0) { # SVG + SMIL | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | print $fh ">\n"; | |||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | for (my $i = 0; $i <= $#{$self->{animations}}; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | print $fh "\t"; | |||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | my $smil = ConvertSMIL::smil($self->{animations}[$i]); | |||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | print $fh $smil; | |||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | print $fh "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | print $fh "</polyline>\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 543 | } else { # SVG only | ||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | print $fh " />\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||
| 548 | } elsif ($self->{sub_type} == 2) { # box | ||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | # line_style, style_val, pen_color | ||||||||||||||||||||||||||||||||||||||||||
| 551 | $style .= ConvertSVG::line_style_to_stroke($self->{line_style}, | ||||||||||||||||||||||||||||||||||||||||||
| 552 | $self->{style_val}, | ||||||||||||||||||||||||||||||||||||||||||
| 553 | $self->{pen_color}, | ||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | $colors) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 555 | # thickness | ||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | $style .= ConvertSVG::thickness_to_stroke($self->{thickness}) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 557 | # fill_color, area_fill | ||||||||||||||||||||||||||||||||||||||||||
| 558 | $style .= ConvertSVG::area_fill_to_fill($self->{area_fill}, | ||||||||||||||||||||||||||||||||||||||||||
| 559 | $self->{fill_color}, | ||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $colors) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 561 | # join_style | ||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | $style .= ConvertSVG::join_style_to_linejoin($self->{join_style}) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 563 | # cap_style | ||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | $style .= ConvertSVG::cap_style_to_linecap($self->{cap_style}); | |||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||
| 566 | # end of style | ||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | $style .= "\""; | |||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||
| 569 | my $top = ConvertSVG::min($self->{ynpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 570 | $self->{ynpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 571 | $self->{ynpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | $self->{ynpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 573 | my $left = ConvertSVG::min($self->{xnpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 574 | $self->{xnpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 575 | $self->{xnpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | $self->{xnpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 577 | my $bottom = ConvertSVG::max($self->{ynpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 578 | $self->{ynpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 579 | $self->{ynpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | $self->{ynpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 581 | my $right = ConvertSVG::max($self->{xnpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 582 | $self->{xnpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 583 | $self->{xnpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | $self->{xnpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | my $x = "x=\"" . $left . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | my $y = "y=\"" . $top . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | my $width = "width=\"" . ($right - $left) . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | my $height = "height=\"" . ($bottom - $top) . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | print $fh "<rect $x $y $width $height $style"; | |||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | ▶ | if ($#{$self->{animations}} >= 0) { # SVG + SMIL | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | print $fh ">\n"; | |||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | for (my $i = 0; $i <= $#{$self->{animations}}; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | print $fh "\t"; | |||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | my $smil = ConvertSMIL::smil($self->{animations}[$i]); | |||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | print $fh $smil; | |||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | print $fh "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | print $fh "</rect>\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 603 | } else { # SVG only | ||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | print $fh " />\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||
| 607 | } elsif ($self->{sub_type} == 3) { # polygon | ||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | # line_style, style_val, pen_color | ||||||||||||||||||||||||||||||||||||||||||
| 610 | $style .= ConvertSVG::line_style_to_stroke($self->{line_style}, | ||||||||||||||||||||||||||||||||||||||||||
| 611 | $self->{style_val}, | ||||||||||||||||||||||||||||||||||||||||||
| 612 | $self->{pen_color}, | ||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | $colors) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 614 | # thickness | ||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | $style .= ConvertSVG::thickness_to_stroke($self->{thickness}) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||
| 617 | # fill_color, area_fill | ||||||||||||||||||||||||||||||||||||||||||
| 618 | $style .= ConvertSVG::area_fill_to_fill($self->{area_fill}, | ||||||||||||||||||||||||||||||||||||||||||
| 619 | $self->{fill_color}, | ||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | $colors) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 621 | # join_style | ||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $style .= ConvertSVG::join_style_to_linejoin($self->{join_style}) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 623 | # cap_style | ||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | $style .= ConvertSVG::cap_style_to_linecap($self->{cap_style}); | |||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||
| 626 | # end of style | ||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | $style .= "\""; | |||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||
| 629 | # points | ||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | my $points = "points=\""; | |||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | for (0 .. $self->{npoints}-1) { | |||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | $points .= $self->{xnpoints}[$_]; | |||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | $points .= " "; | |||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | $points .= $self->{ynpoints}[$_]; | |||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | ▶ | if ($_ < $self->{npoints}-1) { $points .= ", "; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | $points .= "\""; | |||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | print $fh "<polygon $points $style"; | |||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | ▶ | if ($#{$self->{animations}} >= 0) { # SVG + SMIL | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | print $fh ">\n"; | |||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | ▶ | for (my $i = 0; $i <= $#{$self->{animations}}; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | print $fh "\t"; | |||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | my $smil = ConvertSMIL::smil($self->{animations}[$i]); | |||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | print $fh $smil; | |||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | print $fh "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | print $fh "</polygon>\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 650 | } else { # SVG only | ||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | print $fh " />\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||
| 654 | } elsif ($self->{sub_type} == 4) { # arc-box | ||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | # line_style, style_val, pen_color | ||||||||||||||||||||||||||||||||||||||||||
| 657 | $style .= ConvertSVG::line_style_to_stroke($self->{line_style}, | ||||||||||||||||||||||||||||||||||||||||||
| 658 | $self->{style_val}, | ||||||||||||||||||||||||||||||||||||||||||
| 659 | $self->{pen_color}, | ||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | $colors) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 661 | # thickness | ||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | $style .= ConvertSVG::thickness_to_stroke($self->{thickness}) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 663 | # fill_color, area_fill | ||||||||||||||||||||||||||||||||||||||||||
| 664 | $style .= ConvertSVG::area_fill_to_fill($self->{area_fill}, | ||||||||||||||||||||||||||||||||||||||||||
| 665 | $self->{fill_color}, | ||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | $colors) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 667 | # join_style | ||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | $style .= ConvertSVG::join_style_to_linejoin($self->{join_style}) . "; "; | |||||||||||||||||||||||||||||||||||||||||
| 669 | # cap_style | ||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | $style .= ConvertSVG::cap_style_to_linecap($self->{cap_style}); | |||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||
| 672 | # end of style | ||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | $style .= "\""; | |||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||
| 675 | my $top = ConvertSVG::min($self->{ynpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 676 | $self->{ynpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 677 | $self->{ynpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | $self->{ynpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 679 | my $left = ConvertSVG::min($self->{xnpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 680 | $self->{xnpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 681 | $self->{xnpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | $self->{xnpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 683 | my $bottom = ConvertSVG::max($self->{ynpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 684 | $self->{ynpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 685 | $self->{ynpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | $self->{ynpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 687 | my $right = ConvertSVG::max($self->{xnpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 688 | $self->{xnpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 689 | $self->{xnpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | $self->{xnpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | my $x = "x=\"" . $left . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | my $y = "y=\"" . $top . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | my $width = "width=\"" . ($right - $left) . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | my $height = "height=\"" . ($bottom - $top) . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | my $rx = "rx=\"" . $self->{radius} * 15 . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | my $ry = "ry=\"" . $self->{radius} * 15 . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | print $fh "<rect $x $y $width $height $rx $ry $style"; | |||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | if ($#{$self->{animations}} >= 0) { # SVG + SMIL | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | print $fh ">\n"; | |||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | ▶ | for (my $i = 0; $i <= $#{$self->{animations}}; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | print $fh "\t"; | |||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | my $smil = ConvertSMIL::smil($self->{animations}[$i]); | |||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | print $fh $smil; | |||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | print $fh "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | print $fh "</rect>\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 712 | } else { # SVG only | ||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | print $fh " />\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||
| 716 | } elsif ($self->{sub_type} == 5) { # imported-picture bounding-box | ||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||
| 718 | # end of style | ||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | $style .= "\""; | |||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||
| 721 | my $top = ConvertSVG::min($self->{ynpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 722 | $self->{ynpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 723 | $self->{ynpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | $self->{ynpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 725 | my $left = ConvertSVG::min($self->{xnpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 726 | $self->{xnpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 727 | $self->{xnpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | $self->{xnpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 729 | my $bottom = ConvertSVG::max($self->{ynpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 730 | $self->{ynpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 731 | $self->{ynpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | $self->{ynpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 733 | my $right = ConvertSVG::max($self->{xnpoints}[0], | ||||||||||||||||||||||||||||||||||||||||||
| 734 | $self->{xnpoints}[1], | ||||||||||||||||||||||||||||||||||||||||||
| 735 | $self->{xnpoints}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | $self->{xnpoints}[3]); | |||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | my $x = "x=\"" . $left . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | my $y = "y=\"" . $top . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | my $width = "width=\"" . ($right - $left) . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | my $height = "height=\"" . ($bottom - $top) . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | # file | ||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | my $xlink = "xlink:href=\"" . @$self{'file'} . "\""; | |||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||
| 747 | # flipped | ||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | my $transform = ""; | |||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | ▶ | if ($self->{flipped} == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 750 | $transform = | ||||||||||||||||||||||||||||||||||||||||||
| 751 | "transform=\"" . | ||||||||||||||||||||||||||||||||||||||||||
| 752 | "translate(" . | ||||||||||||||||||||||||||||||||||||||||||
| 753 | ($self->{xnpoints}[2] - $self->{xnpoints}[0]) . | ||||||||||||||||||||||||||||||||||||||||||
| 754 | ", 0), " . | ||||||||||||||||||||||||||||||||||||||||||
| 755 | "rotate(90, " . | ||||||||||||||||||||||||||||||||||||||||||
| 756 | $self->{xnpoints}[0] . ", " . | ||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | $self->{ynpoints}[0] . ")\""; | |||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | print $fh "<image $xlink $x $y $width $height $transform"; | |||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | ▶ | if ($#{$self->{animations}} >= 0) { # SVG + SMIL | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | print $fh ">\n"; | |||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | ▶ | for (my $i = 0; $i <= $#{$self->{animations}}; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | print $fh "\t"; | |||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | my $smil = ConvertSMIL::smil($self->{animations}[$i]); | |||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | print $fh $smil; | |||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | print $fh "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 769 | } | ||||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | print $fh "</image>\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 771 | } else { # SVG only | ||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | print $fh " />\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 773 | } | ||||||||||||||||||||||||||||||||||||||||||
| 774 | } | ||||||||||||||||||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||
| 778 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||