| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
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
|
|
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
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
45
|
|
|
55
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# useful classes |
|
58
|
1
|
|
|
1
|
|
5
|
use FigAnim::Utils; |
|
|
1
|
|
|
|
|
10
|
|
|
|
1
|
|
|
|
|
4569
|
|
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# constructor |
|
61
|
|
|
|
|
|
|
sub new { |
|
62
|
0
|
|
|
0
|
|
|
my $proto = shift; |
|
63
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $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
|
|
|
|
|
|
|
sub clone { |
|
96
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
97
|
0
|
|
|
|
|
|
my $obj = new Compound; |
|
98
|
0
|
|
|
|
|
|
$obj->{$_} = $self->{$_} foreach (keys %{$self}); |
|
|
0
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
return $obj; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub output { |
|
103
|
0
|
|
|
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
|
0
|
|
|
|
|
|
printf $fh "6 %d %d %d %d\n", |
|
112
|
|
|
|
|
|
|
@$self{'upperleft_corner_x','upperleft_corner_y','lowerright_corner_x', |
|
113
|
|
|
|
|
|
|
'lowerright_corner_y'}; |
|
114
|
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
foreach (@{$self->{arcs}}) { |
|
|
0
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->output($fh); |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->output($fh); |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->output($fh); |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->output($fh); |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->output($fh); |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
foreach (@{$self->{texts}}) { |
|
|
0
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->output($fh); |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
print $fh "-6\n"; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub calculateCenter { |
|
143
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
144
|
0
|
|
|
|
|
|
$self->{center_x} = sprintf("%.0f",($self->{upperleft_corner_x} + |
|
145
|
|
|
|
|
|
|
$self->{lowerright_corner_x}) / 2); |
|
146
|
0
|
|
|
|
|
|
$self->{center_y} = sprintf("%.0f",($self->{upperleft_corner_y} + |
|
147
|
|
|
|
|
|
|
$self->{lowerright_corner_y}) / 2); |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
# objects selectors |
|
152
|
|
|
|
|
|
|
sub selectByType { |
|
153
|
0
|
|
|
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->{$_}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
my $aux = $self->{fig_file}->{objects}->{$_}->selectByType(@_); |
|
162
|
0
|
|
|
|
|
|
foreach (@_) { |
|
163
|
0
|
|
|
|
|
|
push @{$res->{$_}}, @{$aux->{$_}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
} |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
0
|
|
|
|
|
|
return $res; |
|
168
|
|
|
|
|
|
|
} |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub selectByPenColor { |
|
171
|
0
|
|
|
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
|
0
|
|
|
|
|
if (defined $color) { |
|
177
|
0
|
|
|
|
|
|
foreach (@{$self->{arcs}}) { |
|
|
0
|
|
|
|
|
|
|
|
178
|
0
|
0
|
|
|
|
|
if ($self->{fig_file}->{objects}->{$_}->{pen_color} == $color){ |
|
179
|
0
|
|
|
|
|
|
push @{$res->{arcs}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
} |
|
182
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
183
|
0
|
0
|
|
|
|
|
if ($self->{fig_file}->{objects}->{$_}->{pen_color} == $color){ |
|
184
|
0
|
|
|
|
|
|
push @{$res->{ellipses}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
} |
|
186
|
|
|
|
|
|
|
} |
|
187
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
188
|
0
|
0
|
|
|
|
|
if ($self->{fig_file}->{objects}->{$_}->{pen_color} == $color){ |
|
189
|
0
|
|
|
|
|
|
push @{$res->{polylines}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
} |
|
192
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
193
|
0
|
0
|
|
|
|
|
if ($self->{fig_file}->{objects}->{$_}->{pen_color} == $color){ |
|
194
|
0
|
|
|
|
|
|
push @{$res->{splines}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
} |
|
197
|
0
|
|
|
|
|
|
foreach (@{$self->{texts}}) { |
|
|
0
|
|
|
|
|
|
|
|
198
|
0
|
0
|
|
|
|
|
if ($self->{fig_file}->{objects}->{$_}->{pen_color} == $color){ |
|
199
|
0
|
|
|
|
|
|
push @{$res->{texts}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
} |
|
201
|
|
|
|
|
|
|
} |
|
202
|
|
|
|
|
|
|
} |
|
203
|
|
|
|
|
|
|
} |
|
204
|
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
206
|
0
|
|
|
|
|
|
my $aux = $self->{fig_file}->{objects}->{$_}->selectByPenColor(@_); |
|
207
|
0
|
|
|
|
|
|
push @{$res->{arcs}}, @{$aux->{arcs}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
208
|
0
|
|
|
|
|
|
push @{$res->{ellipses}}, @{$aux->{ellipses}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
209
|
0
|
|
|
|
|
|
push @{$res->{polylines}}, @{$aux->{polylines}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
210
|
0
|
|
|
|
|
|
push @{$res->{splines}}, @{$aux->{splines}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
|
push @{$res->{texts}}, @{$aux->{texts}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
} |
|
213
|
|
|
|
|
|
|
|
|
214
|
0
|
|
|
|
|
|
return $res; |
|
215
|
|
|
|
|
|
|
} |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub selectByFillColor { |
|
218
|
0
|
|
|
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
|
0
|
|
|
|
|
if (defined $color) { |
|
224
|
0
|
|
|
|
|
|
foreach (@{$self->{arcs}}) { |
|
|
0
|
|
|
|
|
|
|
|
225
|
0
|
0
|
|
|
|
|
if ($self->{fig_file}->{objects}->{$_}->{fill_color}==$color) { |
|
226
|
0
|
|
|
|
|
|
push @{$res->{arcs}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
} |
|
228
|
|
|
|
|
|
|
} |
|
229
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
230
|
0
|
0
|
|
|
|
|
if ($self->{fig_file}->{objects}->{$_}->{fill_color}==$color) { |
|
231
|
0
|
|
|
|
|
|
push @{$res->{ellipses}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
} |
|
234
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
235
|
0
|
0
|
|
|
|
|
if ($self->{fig_file}->{objects}->{$_}->{fill_color}==$color) { |
|
236
|
0
|
|
|
|
|
|
push @{$res->{polylines}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
} |
|
238
|
|
|
|
|
|
|
} |
|
239
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
240
|
0
|
0
|
|
|
|
|
if ($self->{fig_file}->{objects}->{$_}->{fill_color}==$color) { |
|
241
|
0
|
|
|
|
|
|
push @{$res->{splines}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
} |
|
243
|
|
|
|
|
|
|
} |
|
244
|
|
|
|
|
|
|
} |
|
245
|
|
|
|
|
|
|
} |
|
246
|
|
|
|
|
|
|
|
|
247
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
248
|
0
|
|
|
|
|
|
my $aux = $self->{fig_file}->{objects}->{$_}->selectByFillColor(@_); |
|
249
|
0
|
|
|
|
|
|
push @{$res->{arcs}}, @{$aux->{arcs}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
250
|
0
|
|
|
|
|
|
push @{$res->{ellipses}}, @{$aux->{ellipses}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
251
|
0
|
|
|
|
|
|
push @{$res->{polylines}}, @{$aux->{polylines}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
252
|
0
|
|
|
|
|
|
push @{$res->{splines}}, @{$aux->{splines}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
} |
|
254
|
|
|
|
|
|
|
|
|
255
|
0
|
|
|
|
|
|
return $res; |
|
256
|
|
|
|
|
|
|
} |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub selectByAttributeValue { |
|
259
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
260
|
0
|
|
|
|
|
|
my $res = new Compound("",0,0,0,0,$self); |
|
261
|
0
|
|
|
|
|
|
my @params = @_; |
|
262
|
|
|
|
|
|
|
|
|
263
|
0
|
|
|
|
|
|
while (@params) { |
|
264
|
0
|
|
|
|
|
|
my $attribute = shift @params; |
|
265
|
0
|
|
|
|
|
|
my $value = shift @params; |
|
266
|
|
|
|
|
|
|
|
|
267
|
0
|
|
|
|
|
|
foreach (@{$self->{arcs}}) { |
|
|
0
|
|
|
|
|
|
|
|
268
|
0
|
0
|
0
|
|
|
|
if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && |
|
269
|
|
|
|
|
|
|
($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { |
|
270
|
0
|
|
|
|
|
|
push @{$res->{arcs}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
} |
|
272
|
|
|
|
|
|
|
} |
|
273
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
274
|
0
|
0
|
0
|
|
|
|
if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && |
|
275
|
|
|
|
|
|
|
($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { |
|
276
|
0
|
|
|
|
|
|
push @{$res->{compounds}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
} |
|
278
|
|
|
|
|
|
|
} |
|
279
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
280
|
0
|
0
|
0
|
|
|
|
if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && |
|
281
|
|
|
|
|
|
|
($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { |
|
282
|
0
|
|
|
|
|
|
push @{$res->{ellipses}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
} |
|
284
|
|
|
|
|
|
|
} |
|
285
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
286
|
0
|
0
|
0
|
|
|
|
if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && |
|
287
|
|
|
|
|
|
|
($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { |
|
288
|
0
|
|
|
|
|
|
push @{$res->{polylines}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
} |
|
290
|
|
|
|
|
|
|
} |
|
291
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
292
|
0
|
0
|
0
|
|
|
|
if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && |
|
293
|
|
|
|
|
|
|
($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { |
|
294
|
0
|
|
|
|
|
|
push @{$res->{splines}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
} |
|
296
|
|
|
|
|
|
|
} |
|
297
|
0
|
|
|
|
|
|
foreach (@{$self->{texts}}) { |
|
|
0
|
|
|
|
|
|
|
|
298
|
0
|
0
|
0
|
|
|
|
if ((defined $self->{fig_file}->{objects}->{$_}->{$attribute}) && |
|
299
|
|
|
|
|
|
|
($self->{fig_file}->{objects}->{$_}->{$attribute} eq $value)) { |
|
300
|
0
|
|
|
|
|
|
push @{$res->{texts}}, $_; |
|
|
0
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
} |
|
302
|
|
|
|
|
|
|
} |
|
303
|
|
|
|
|
|
|
} |
|
304
|
|
|
|
|
|
|
|
|
305
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
306
|
0
|
|
|
|
|
|
my $aux=$self->{fig_file}->{objects}->{$_}->selectByAttributeValue(@_); |
|
307
|
0
|
|
|
|
|
|
push @{$res->{arcs}}, @{$aux->{arcs}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
push @{$res->{compounds}}, @{$aux->{compounds}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
309
|
0
|
|
|
|
|
|
push @{$res->{ellipses}}, @{$aux->{ellipses}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
310
|
0
|
|
|
|
|
|
push @{$res->{polylines}}, @{$aux->{polylines}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
311
|
0
|
|
|
|
|
|
push @{$res->{splines}}, @{$aux->{splines}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
312
|
0
|
|
|
|
|
|
push @{$res->{texts}}, @{$aux->{texts}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
} |
|
314
|
|
|
|
|
|
|
|
|
315
|
0
|
|
|
|
|
|
return $res; |
|
316
|
|
|
|
|
|
|
} |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
# animation methods |
|
320
|
|
|
|
|
|
|
sub setAttributeValue { |
|
321
|
0
|
|
|
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}}) { |
|
|
0
|
|
|
|
|
|
|
|
327
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, |
|
328
|
|
|
|
|
|
|
$value); |
|
329
|
|
|
|
|
|
|
} |
|
330
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
331
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, |
|
332
|
|
|
|
|
|
|
$value); |
|
333
|
|
|
|
|
|
|
} |
|
334
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
335
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, |
|
336
|
|
|
|
|
|
|
$value); |
|
337
|
|
|
|
|
|
|
} |
|
338
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
339
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, |
|
340
|
|
|
|
|
|
|
$value); |
|
341
|
|
|
|
|
|
|
} |
|
342
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
343
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, |
|
344
|
|
|
|
|
|
|
$value); |
|
345
|
|
|
|
|
|
|
} |
|
346
|
0
|
|
|
|
|
|
foreach (@{$self->{texts}}) { |
|
|
0
|
|
|
|
|
|
|
|
347
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->setAttributeValue($time,$attribute, |
|
348
|
|
|
|
|
|
|
$value); |
|
349
|
|
|
|
|
|
|
} |
|
350
|
|
|
|
|
|
|
} |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
sub setPenColor { |
|
353
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
354
|
0
|
|
|
|
|
|
my $time = shift; |
|
355
|
0
|
|
|
|
|
|
my $color = $FigAnim::Utils::colors_codes{shift}; |
|
356
|
0
|
0
|
|
|
|
|
if (defined $color) { |
|
357
|
0
|
|
|
|
|
|
$self->setAttributeValue($time,'pen_color',$color); |
|
358
|
|
|
|
|
|
|
} |
|
359
|
|
|
|
|
|
|
} |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
sub setFillColor { |
|
362
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
363
|
0
|
|
|
|
|
|
my $time = shift; |
|
364
|
0
|
|
|
|
|
|
my $color = $FigAnim::Utils::colors_codes{shift}; |
|
365
|
0
|
0
|
|
|
|
|
if (defined $color) { |
|
366
|
0
|
|
|
|
|
|
$self->setAttributeValue($time,'fill_color',$color); |
|
367
|
|
|
|
|
|
|
} |
|
368
|
|
|
|
|
|
|
} |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
sub hide { |
|
371
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
372
|
0
|
|
|
|
|
|
my $time = shift; |
|
373
|
|
|
|
|
|
|
|
|
374
|
0
|
|
|
|
|
|
foreach (@{$self->{arcs}}) { |
|
|
0
|
|
|
|
|
|
|
|
375
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->hide($time); |
|
376
|
|
|
|
|
|
|
} |
|
377
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
378
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->hide($time); |
|
379
|
|
|
|
|
|
|
} |
|
380
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
381
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->hide($time); |
|
382
|
|
|
|
|
|
|
} |
|
383
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
384
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->hide($time); |
|
385
|
|
|
|
|
|
|
} |
|
386
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
387
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->hide($time); |
|
388
|
|
|
|
|
|
|
} |
|
389
|
0
|
|
|
|
|
|
foreach (@{$self->{texts}}) { |
|
|
0
|
|
|
|
|
|
|
|
390
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->hide($time); |
|
391
|
|
|
|
|
|
|
} |
|
392
|
|
|
|
|
|
|
} |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
sub show { |
|
395
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
396
|
0
|
|
|
|
|
|
my $time = shift; |
|
397
|
|
|
|
|
|
|
|
|
398
|
0
|
|
|
|
|
|
foreach (@{$self->{arcs}}) { |
|
|
0
|
|
|
|
|
|
|
|
399
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->show($time); |
|
400
|
|
|
|
|
|
|
} |
|
401
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
402
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->show($time); |
|
403
|
|
|
|
|
|
|
} |
|
404
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
405
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->show($time); |
|
406
|
|
|
|
|
|
|
} |
|
407
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
408
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->show($time); |
|
409
|
|
|
|
|
|
|
} |
|
410
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
411
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->show($time); |
|
412
|
|
|
|
|
|
|
} |
|
413
|
0
|
|
|
|
|
|
foreach (@{$self->{texts}}) { |
|
|
0
|
|
|
|
|
|
|
|
414
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->show($time); |
|
415
|
|
|
|
|
|
|
} |
|
416
|
|
|
|
|
|
|
} |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
sub changeThickness { |
|
419
|
0
|
|
|
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}}) { |
|
|
0
|
|
|
|
|
|
|
|
425
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->changeThickness($beginning, |
|
426
|
|
|
|
|
|
|
$duration, |
|
427
|
|
|
|
|
|
|
$thickness); |
|
428
|
|
|
|
|
|
|
} |
|
429
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
430
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->changeThickness($beginning, |
|
431
|
|
|
|
|
|
|
$duration, |
|
432
|
|
|
|
|
|
|
$thickness); |
|
433
|
|
|
|
|
|
|
} |
|
434
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
435
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->changeThickness($beginning, |
|
436
|
|
|
|
|
|
|
$duration, |
|
437
|
|
|
|
|
|
|
$thickness); |
|
438
|
|
|
|
|
|
|
} |
|
439
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
440
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->changeThickness($beginning, |
|
441
|
|
|
|
|
|
|
$duration, |
|
442
|
|
|
|
|
|
|
$thickness); |
|
443
|
|
|
|
|
|
|
} |
|
444
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
445
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->changeThickness($beginning, |
|
446
|
|
|
|
|
|
|
$duration, |
|
447
|
|
|
|
|
|
|
$thickness); |
|
448
|
|
|
|
|
|
|
} |
|
449
|
|
|
|
|
|
|
} |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
sub changeFillIntensity { |
|
452
|
0
|
|
|
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}}) { |
|
|
0
|
|
|
|
|
|
|
|
458
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->changeFillIntensity($beginning, |
|
459
|
|
|
|
|
|
|
$duration, |
|
460
|
|
|
|
|
|
|
$intensity); |
|
461
|
|
|
|
|
|
|
} |
|
462
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
463
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->changeFillIntensity($beginning, |
|
464
|
|
|
|
|
|
|
$duration, |
|
465
|
|
|
|
|
|
|
$intensity); |
|
466
|
|
|
|
|
|
|
} |
|
467
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
468
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->changeFillIntensity($beginning, |
|
469
|
|
|
|
|
|
|
$duration, |
|
470
|
|
|
|
|
|
|
$intensity); |
|
471
|
|
|
|
|
|
|
} |
|
472
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
473
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->changeFillIntensity($beginning, |
|
474
|
|
|
|
|
|
|
$duration, |
|
475
|
|
|
|
|
|
|
$intensity); |
|
476
|
|
|
|
|
|
|
} |
|
477
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
478
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->changeFillIntensity($beginning, |
|
479
|
|
|
|
|
|
|
$duration, |
|
480
|
|
|
|
|
|
|
$intensity); |
|
481
|
|
|
|
|
|
|
} |
|
482
|
|
|
|
|
|
|
} |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
sub translate { |
|
485
|
0
|
|
|
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
|
0
|
|
|
|
|
$unit = '' if (!(defined $unit)); |
|
492
|
|
|
|
|
|
|
|
|
493
|
0
|
|
|
|
|
|
my @anim = (16, $self->{name}, $beginning, $duration, $x, $y, $unit); |
|
494
|
0
|
|
|
|
|
|
push @{$self->{fig_file}->{animations}}, \@anim; |
|
|
0
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
|
|
496
|
0
|
|
|
|
|
|
foreach (@{$self->{arcs}}) { |
|
|
0
|
|
|
|
|
|
|
|
497
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, |
|
498
|
|
|
|
|
|
|
$x, $y, $unit); |
|
499
|
|
|
|
|
|
|
} |
|
500
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
501
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, |
|
502
|
|
|
|
|
|
|
$x, $y, $unit); |
|
503
|
|
|
|
|
|
|
} |
|
504
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
505
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, |
|
506
|
|
|
|
|
|
|
$x, $y, $unit); |
|
507
|
|
|
|
|
|
|
} |
|
508
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
509
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, |
|
510
|
|
|
|
|
|
|
$x, $y, $unit); |
|
511
|
|
|
|
|
|
|
} |
|
512
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
513
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, |
|
514
|
|
|
|
|
|
|
$x, $y, $unit); |
|
515
|
|
|
|
|
|
|
} |
|
516
|
0
|
|
|
|
|
|
foreach (@{$self->{texts}}) { |
|
|
0
|
|
|
|
|
|
|
|
517
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->translate($beginning, $duration, |
|
518
|
|
|
|
|
|
|
$x, $y, $unit); |
|
519
|
|
|
|
|
|
|
} |
|
520
|
|
|
|
|
|
|
} |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
sub rotate { |
|
523
|
0
|
|
|
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
|
0
|
0
|
|
|
|
if (!((defined $c_x) && (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
|
0
|
|
|
|
|
$unit = '' if (!(defined $unit)); |
|
535
|
|
|
|
|
|
|
|
|
536
|
0
|
|
|
|
|
|
my @anim = (26, $self->{name},$beginning,$duration,$angle,$c_x,$c_y,$unit); |
|
537
|
0
|
|
|
|
|
|
push @{$self->{fig_file}->{animations}}, \@anim; |
|
|
0
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
|
|
539
|
0
|
|
|
|
|
|
foreach (@{$self->{arcs}}) { |
|
|
0
|
|
|
|
|
|
|
|
540
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, |
|
541
|
|
|
|
|
|
|
$c_x,$c_y,$unit); |
|
542
|
|
|
|
|
|
|
} |
|
543
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
544
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, |
|
545
|
|
|
|
|
|
|
$c_x,$c_y,$unit); |
|
546
|
|
|
|
|
|
|
} |
|
547
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
548
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, |
|
549
|
|
|
|
|
|
|
$c_x,$c_y,$unit); |
|
550
|
|
|
|
|
|
|
} |
|
551
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
552
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, |
|
553
|
|
|
|
|
|
|
$c_x,$c_y,$unit); |
|
554
|
|
|
|
|
|
|
} |
|
555
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
556
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, |
|
557
|
|
|
|
|
|
|
$c_x,$c_y,$unit); |
|
558
|
|
|
|
|
|
|
} |
|
559
|
0
|
|
|
|
|
|
foreach (@{$self->{texts}}) { |
|
|
0
|
|
|
|
|
|
|
|
560
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->rotate($beginning,$duration,$angle, |
|
561
|
|
|
|
|
|
|
$c_x,$c_y,$unit); |
|
562
|
|
|
|
|
|
|
} |
|
563
|
|
|
|
|
|
|
} |
|
564
|
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
sub scale { |
|
566
|
0
|
|
|
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
|
0
|
0
|
|
|
|
if (!((defined $c_x) && (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; |
|
|
0
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
|
|
580
|
0
|
|
|
|
|
|
foreach (@{$self->{arcs}}) { |
|
|
0
|
|
|
|
|
|
|
|
581
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->scale($beginning,$duration,$scale, |
|
582
|
|
|
|
|
|
|
$c_x,$c_y); |
|
583
|
|
|
|
|
|
|
} |
|
584
|
0
|
|
|
|
|
|
foreach (@{$self->{compounds}}) { |
|
|
0
|
|
|
|
|
|
|
|
585
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->scale($beginning,$duration,$scale, |
|
586
|
|
|
|
|
|
|
$c_x,$c_y); |
|
587
|
|
|
|
|
|
|
} |
|
588
|
0
|
|
|
|
|
|
foreach (@{$self->{ellipses}}) { |
|
|
0
|
|
|
|
|
|
|
|
589
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->scale($beginning,$duration,$scale, |
|
590
|
|
|
|
|
|
|
$c_x,$c_y); |
|
591
|
|
|
|
|
|
|
} |
|
592
|
0
|
|
|
|
|
|
foreach (@{$self->{polylines}}) { |
|
|
0
|
|
|
|
|
|
|
|
593
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->scale($beginning,$duration,$scale, |
|
594
|
|
|
|
|
|
|
$c_x,$c_y); |
|
595
|
|
|
|
|
|
|
} |
|
596
|
0
|
|
|
|
|
|
foreach (@{$self->{splines}}) { |
|
|
0
|
|
|
|
|
|
|
|
597
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->scale($beginning,$duration,$scale, |
|
598
|
|
|
|
|
|
|
$c_x,$c_y); |
|
599
|
|
|
|
|
|
|
} |
|
600
|
0
|
|
|
|
|
|
foreach (@{$self->{texts}}) { |
|
|
0
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
sub outputSVG { |
|
609
|
0
|
|
|
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 "\n"; |
|
619
|
|
|
|
|
|
|
|
|
620
|
0
|
|
|
|
|
|
my @objects = @{$self->{arcs}}; |
|
|
0
|
|
|
|
|
|
|
|
621
|
0
|
|
|
|
|
|
push @objects, @{$self->{ellipses}}; |
|
|
0
|
|
|
|
|
|
|
|
622
|
0
|
|
|
|
|
|
push @objects, @{$self->{polylines}}; |
|
|
0
|
|
|
|
|
|
|
|
623
|
0
|
|
|
|
|
|
push @objects, @{$self->{splines}}; |
|
|
0
|
|
|
|
|
|
|
|
624
|
0
|
|
|
|
|
|
push @objects, @{$self->{texts}}; |
|
|
0
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
# sorts objects by depth |
|
627
|
|
|
|
|
|
|
@objects = |
|
628
|
|
|
|
|
|
|
sort { |
|
629
|
0
|
0
|
|
|
|
|
if ($self->{fig_file}->{objects}->{$a}->{depth} < |
|
|
0
|
0
|
|
|
|
|
|
|
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}}) { |
|
|
0
|
|
|
|
|
|
|
|
645
|
0
|
|
|
|
|
|
$self->{fig_file}->{objects}->{$_}->outputSVG($fh, $colors); |
|
646
|
|
|
|
|
|
|
} |
|
647
|
|
|
|
|
|
|
|
|
648
|
0
|
|
|
|
|
|
print $fh "\n\n"; |
|
649
|
|
|
|
|
|
|
} |
|
650
|
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
1; |