lib/App/SeismicUnixGui/specs/plot/xmovie_spec.pm untested

filter: Statementstmt 0.0% 0 / 129 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 13 totaltotal 0.0% 0 / 174 CC 8 SCAR 14.4
CC
8
Cov
0%
get_binding_index_aref
6.0
get_binding_length
6.0
get_file_dialog_type_aref
6.0
CRAP 4.2
1 package App::SeismicUnixGui::specs::plot::xmovie_spec;
2 use Moose;
3 our $VERSION = '0.0.1';
4  
5 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
6 use App::SeismicUnixGui::misc::SeismicUnix qw($su $bin $suffix_bin $suffix_su);
7 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
8 use aliased 'App::SeismicUnixGui::sunix::plot::xmovie';
9 my $get = L_SU_global_constants->new();
10 my $Project = Project_config->new();
11 my $xmovie = xmovie->new();
12  
13 my $var = $get->var();
14  
15 my $empty_string = $var->{_empty_string};
16 my $true = $var->{_true};
17 my $false = $var->{_false};
18 my $file_dialog_type = $get->file_dialog_type_href();
19 my $flow_type = $get->flow_type_href();
20  
21 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); # input data directory
22 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory
23 my $PL_SEISMIC = $Project->PL_SEISMIC();
24 my $max_index = $xmovie->get_max_index();
25  
26 my $xmovie_spec = {
27 _CONFIG => $PL_SEISMIC,
28 _DATA_DIR_OUT => $DATA_SEISMIC_SU,
29 _DATA_DIR_IN => $DATA_SEISMIC_BIN,
30 _DATA_DIR_OUT => $DATA_SEISMIC_SU,
31 _binding_index_aref => '',
32 _suffix_type_in => $su,
33 _data_suffix_in => $suffix_su,
34 _suffix_type_out => $su,
35 _data_suffix_out => $suffix_su,
36 _file_dialog_type_aref => '',
37 _flow_type_aref => '',
38 _has_infile => $true,
39 _has_pipe_in => $true,
40 _has_outpar => $false,
41 _has_pipe_out => $false,
42 _has_redirect_in => $true,
43 _has_redirect_out => $false,
44 _has_subin_in => $false,
45 _has_subin_out => $false,
46 _is_data => $false,
47 _is_first_of_2 => $true,
48 _is_first_of_3or_more => $false,
49 _is_first_of_4or_more => $false,
50 _is_last_of_2 => $true,
51 _is_last_of_3or_more => $true,
52 _is_last_of_4or_more => $true,
53 _is_suprog => $true,
54 _is_superflow => $false,
55 _max_index => $max_index,
56 };
57  
58 =head2 sub binding_index_aref
59  
60 =cut
61  
62 sub binding_index_aref {
63  
64 my $self = @_;
65  
66 my @index;
67  
68 $index[0] = 0;
69  
70 $xmovie_spec->{_binding_index_aref} = \@index;
71 return ();
72  
73 }
74  
75 =head2 sub file_dialog_type_aref
76  
77 type of dialog (Data, Flow, SaveAs) is needed by binding
78 one type of dialog for each index
79 =cut
80  
81 sub file_dialog_type_aref {
82  
83 my $self = @_;
84  
85 my @type;
86  
87 $type[0] = '';
88  
89 $xmovie_spec->{_file_dialog_type_aref} = \@type;
90 return ();
91  
92 }
93  
94 =head2 sub flow_type_aref
95  
96 =cut
97  
98 sub flow_type_aref {
99  
100 my $self = @_;
101  
102 my @type;
103  
104 $type[0] = $flow_type->{_user_built};
105  
106 $xmovie_spec->{_flow_type_aref} = \@type;
107 return ();
108  
109 }
110  
111 =head2 sub get_binding_index_aref
112  
113 =cut
114  
115 sub get_binding_index_aref {
116  
117 my $self = @_;
118 my @index;
119  
120 if ( $xmovie_spec->{_binding_index_aref} ) {
121  
122 my $index_aref = $xmovie_spec->{_binding_index_aref};
123 return ($index_aref);
124  
125 } else {
126 print("xmovie_spec, get_binding_index_aref, missing binding_index_aref\n");
127 return ();
128 }
129  
130 my $index_aref = $xmovie_spec->{_binding_index_aref};
131 }
132  
133 =head2 sub get_binding_length
134  
135 =cut
136  
137 sub get_binding_length {
138  
139 my $self = @_;
140  
141 if ( $xmovie_spec->{_binding_index_aref} ) {
142  
143 my $binding_length = scalar @{ $xmovie_spec->{_binding_index_aref} };
144 return ($binding_length);
145  
146 } else {
147 print("xmovie_spec, get_binding_length, missing binding_length\n");
148 return ();
149 }
150  
151 return ();
152 }
153  
154 =head2 sub get_file_dialog_type_aref
155  
156 =cut
157  
158 sub get_file_dialog_type_aref {
159  
160 my $self = @_;
161 if ( $xmovie_spec->{_file_dialog_type_aref} ) {
162  
163 my $index_aref = $xmovie_spec->{_file_dialog_type_aref};
164 return ($index_aref);
165  
166 } else {
167 print("xmovie_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n");
168 return ();
169 }
170  
171 return ();
172 }
173  
174 =head2 sub get_flow_type_aref
175  
176 =cut
177  
178 sub get_flow_type_aref {
179  
180 my $self = @_;
181  
182 if ( $xmovie_spec->{_flow_type_aref} ) {
183  
184 my $index_aref = $xmovie_spec->{_flow_type_aref};
185 return ($index_aref);
186  
187 } else {
188 print("xmovie_spec, get_flow_type_aref, missing flow_type_aref\n");
189 return ();
190 }
191  
192 }
193  
194 =head2 sub get_incompatibles
195  
196 =cut
197  
198 sub get_incompatibles {
199  
200 my $self = @_;
201 my @needed;
202  
203 my @_need_both;
204  
205 my @_need_only_1;
206  
207 my @_none_needed;
208  
209 my @_all_needed;
210  
211 my $params = {
212  
213 _need_both => \@_need_both,
214 _need_only_1 => \@_need_only_1,
215 _none_needed => \@_none_needed,
216 _all_needed => \@_all_needed,
217  
218 };
219  
220 my @of_two = ( 'xx', 'yy' );
221 push @{ $params->{_need_only_1} }, \@of_two;
222  
223 my $len_1_needed = scalar @{ $params->{_need_only_1} };
224  
225 if ( $len_1_needed >= 1 ) {
226  
227 for ( my $i = 0; $i < $len_1_needed; $i++ ) {
228  
229 print("xmovie, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n");
230  
231 }
232  
233 } else {
234 print("get_incompatibles, no incompatibles\n");
235 }
236  
237 return ($params);
238  
239 }
240  
241 =head2 sub get_prefix_aref
242  
243 =cut
244  
245 sub get_prefix_aref {
246  
247 my $self = @_;
248  
249 if ( $xmovie_spec->{_prefix_aref} ) {
250  
251 my $prefix_aref = $xmovie_spec->{_prefix_aref};
252 return ($prefix_aref);
253  
254 } else {
255 print("xmovie_spec, get_prefix_aref, missing prefix_aref\n");
256 return ();
257 }
258  
259 return ();
260 }
261  
262 =head2 sub get_suffix_aref
263  
264 =cut
265  
266 sub get_suffix_aref {
267  
268 my $self = @_;
269  
270 if ( $xmovie_spec->{_suffix_aref} ) {
271  
272 my $suffix_aref = $xmovie_spec->{_suffix_aref};
273 return ($suffix_aref);
274  
275 } else {
276 print("$xmovie_spec, get_suffix_aref, missing suffix_aref\n");
277 return ();
278 }
279  
280 return ();
281 }
282  
283 =head2 sub prefix_aref
284  
285 Include in the Set up
286 sections of an output Poop flow.
287  
288 prefixes and suffixes to parameter labels
289 are filtered by sunix_pl
290  
291 =cut
292  
293 sub prefix_aref {
294  
295 my $self = @_;
296  
297 my @prefix;
298  
299 for ( my $i = 0; $i < $max_index; $i++ ) {
300  
301 $prefix[$i] = $empty_string;
302  
303 }
304 $xmovie_spec->{_prefix_aref} = \@prefix;
305 return ();
306  
307 }
308  
309 =head2 sub suffix_aref
310  
311 Initialize suffixes as empty
312 values
313  
314 =cut
315  
316 sub suffix_aref {
317  
318 my $self = @_;
319  
320 my @suffix;
321  
322 for ( my $i = 0; $i < $max_index; $i++ ) {
323  
324 $suffix[$i] = $empty_string;
325  
326 }
327 $xmovie_spec->{_suffix_aref} = \@suffix;
328 return ();
329  
330 }
331  
332 =head2 sub variables
333  
334  
335 return a hash array
336 with definitions
337
338 =cut
339  
340 sub variables {
341  
342 my ($self) = @_;
343 my $hash_ref = $xmovie_spec;
344 return ($hash_ref);
345 }
346  
347 1;