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

filter: Statementstmt 0.0% 0 / 146 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 / 191 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::pscubecontour_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($bin $ps $su $suffix_bin $suffix_ps $suffix_su $suffix_txt $txt);
7 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
8 use aliased 'App::SeismicUnixGui::sunix::plot::pscubecontour';
9 my $get = L_SU_global_constants->new();
10 my $Project = Project_config->new();
11 my $pscubecontour = pscubecontour->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();
22 my $PS_SEISMIC = $Project->PS_SEISMIC(); # output data directory
23 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); # output data directory
24 my $PL_SEISMIC = $Project->PL_SEISMIC();
25 my $max_index = 63;
26  
27 my $pscubecontour_spec = {
28 _CONFIG => $PL_SEISMIC,
29 _DATA_DIR_IN => $DATA_SEISMIC_BIN,
30 _DATA_DIR_OUT => $PS_SEISMIC,
31 _binding_index_aref => '',
32 _suffix_type_in => $bin,
33 _data_suffix_in => $suffix_bin,
34 _suffix_type_out => $ps,
35 _data_suffix_out => $suffix_ps,
36 _file_dialog_type_aref => '',
37 _flow_type_aref => '',
38 _has_infile => $true,
39 _has_outpar => $false,
40 _has_pipe_in => $true,
41 _has_pipe_out => $false,
42 _has_redirect_in => $true,
43 _has_redirect_out => $true,
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 => $true,
49 _is_first_of_4or_more => $false,
50 _is_last_of_2 => $false,
51 _is_last_of_3or_more => $false,
52 _is_last_of_4or_more => $false,
53 _is_suprog => $true,
54 _is_superflow => $false,
55 _max_index => $max_index,
56 _prefix_aref => '',
57 _suffix_aref => '',
58 };
59  
60 =head2 sub binding_index_aref
61  
62 =cut
63  
64 sub binding_index_aref {
65  
66 my $self = @_;
67  
68 my @index;
69  
70 # first binding index (index=0)
71 # connects to second item (index=1)
72 # in the parameter list
73 $index[0] = 25; # inbound item is bound
74 $index[1] = 49; # inbound item is bound
75 $index[2] = 57; # outbound item is bound
76  
77 $pscubecontour_spec->{_binding_index_aref} = \@index;
78 return ();
79  
80 }
81  
82 =head2 sub file_dialog_type_aref
83  
84 type of dialog (Data, Flow, SaveAs) is needed by binding
85 one type of dialog for each index
86 =cut
87  
88 sub file_dialog_type_aref {
89  
90 my $self = @_;
91  
92 my @type;
93  
94 my $index_aref = get_binding_index_aref();
95 my @index = @$index_aref;
96  
97 # bound index will look for data
98 $type[ $index[0] ] = $file_dialog_type->{_Data};
99 $type[ $index[1] ] = $file_dialog_type->{_Data};
100 $type[ $index[2] ] = $file_dialog_type->{_Data};
101  
102 $pscubecontour_spec->{_file_dialog_type_aref} = \@type;
103 return ();
104  
105 }
106  
107 =head2 sub flow_type_aref
108  
109 =cut
110  
111 sub flow_type_aref {
112  
113 my $self = @_;
114  
115 my @type;
116  
117 $type[0] = $flow_type->{_user_built};
118  
119 $pscubecontour_spec->{_flow_type_aref} = \@type;
120 return ();
121  
122 }
123  
124 =head2 sub get_binding_index_aref
125  
126 =cut
127  
128 sub get_binding_index_aref {
129  
130 my $self = @_;
131 my @index;
132  
133 if ( $pscubecontour_spec->{_binding_index_aref} ) {
134  
135 my $index_aref = $pscubecontour_spec->{_binding_index_aref};
136 return ($index_aref);
137  
138 }
139 else {
140 print(
141 "pscubecontour_spec, get_binding_index_aref, missing binding_index_aref\n"
142 );
143 return ();
144 }
145  
146 my $index_aref = $pscubecontour_spec->{_binding_index_aref};
147 }
148  
149 =head2 sub get_binding_length
150  
151 =cut
152  
153 sub get_binding_length {
154  
155 my $self = @_;
156  
157 if ( $pscubecontour_spec->{_binding_index_aref} ) {
158  
159 my $binding_length = scalar @{ $pscubecontour_spec->{_binding_index_aref} };
160 return ($binding_length);
161  
162 }
163 else {
164 print("pscubecontour_spec, get_binding_length, missing binding_length\n");
165 return ();
166 }
167  
168 return ();
169 }
170  
171 =head2 sub get_file_dialog_type_aref
172  
173 =cut
174  
175 sub get_file_dialog_type_aref {
176  
177 my $self = @_;
178 if ( $pscubecontour_spec->{_file_dialog_type_aref} ) {
179  
180 my $index_aref = $pscubecontour_spec->{_file_dialog_type_aref};
181 return ($index_aref);
182  
183 }
184 else {
185 print(
186 "pscubecontour_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n"
187 );
188 return ();
189 }
190  
191 return ();
192 }
193  
194 =head2 sub get_flow_type_aref
195  
196 =cut
197  
198 sub get_flow_type_aref {
199  
200 my $self = @_;
201  
202 if ( $pscubecontour_spec->{_flow_type_aref} ) {
203  
204 my $index_aref = $pscubecontour_spec->{_flow_type_aref};
205 return ($index_aref);
206  
207 }
208 else {
209 print("pscubecontour_spec, get_flow_type_aref, missing flow_type_aref\n");
210 return ();
211 }
212  
213 }
214  
215 =head2 sub get_incompatibles
216  
217 =cut
218  
219 sub get_incompatibles {
220  
221 my $self = @_;
222 my @needed;
223  
224 my @_need_both;
225  
226 my @_need_only_1;
227  
228 my @_none_needed;
229  
230 my @_all_needed;
231  
232 my $params = {
233  
234 _need_both => \@_need_both,
235 _need_only_1 => \@_need_only_1,
236 _none_needed => \@_none_needed,
237 _all_needed => \@_all_needed,
238  
239 };
240  
241 my @of_two = ( 'xx', 'yy' );
242 push @{ $params->{_need_only_1} }, \@of_two;
243  
244 my $len_1_needed = scalar @{ $params->{_need_only_1} };
245  
246 if ( $len_1_needed >= 1 ) {
247  
248 for ( my $i = 0 ; $i < $len_1_needed ; $i++ ) {
249  
250 print(
251 "pscubecontour, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n"
252 );
253  
254 }
255  
256 }
257 else {
258 print("get_incompatibles, no incompatibles\n");
259 }
260  
261 return ($params);
262  
263 }
264  
265 =head2 sub get_prefix_aref
266  
267 =cut
268  
269 sub get_prefix_aref {
270  
271 my $self = @_;
272  
273 if ( $pscubecontour_spec->{_prefix_aref} ) {
274  
275 my $prefix_aref = $pscubecontour_spec->{_prefix_aref};
276 return ($prefix_aref);
277  
278 }
279 else {
280 print("pscubecontour_spec, get_prefix_aref, missing prefix_aref\n");
281 return ();
282 }
283  
284 return ();
285 }
286  
287 =head2 sub get_suffix_aref
288  
289 =cut
290  
291 sub get_suffix_aref {
292  
293 my $self = @_;
294  
295 if ( $pscubecontour_spec->{_suffix_aref} ) {
296  
297 my $suffix_aref = $pscubecontour_spec->{_suffix_aref};
298 return ($suffix_aref);
299  
300 }
301 else {
302 print("$pscubecontour_spec, get_suffix_aref, missing suffix_aref\n");
303 return ();
304 }
305  
306 return ();
307 }
308  
309 =head2 sub prefix_aref
310  
311 Include in the Set up
312 sections of an output Poop flow.
313  
314 prefixes and suffixes to parameter labels
315 are filtered by sunix_pl
316  
317 =cut
318  
319 sub prefix_aref {
320  
321 my $self = @_;
322  
323 my @prefix;
324  
325 for ( my $i = 0 ; $i < $max_index ; $i++ ) {
326  
327 $prefix[$i] = $empty_string;
328  
329 }
330  
331 my $index_aref = get_binding_index_aref();
332 my @index = @$index_aref;
333  
334 # label 26 in GUI is input xx_file and needs a home directory
335 $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
336  
337 # label 50 in GUI is input yy_file and needs a home directory
338 $prefix[ $index[1] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
339  
340 # label 58 in GUI is input zz_file and needs a home directory
341 $prefix[ $index[2] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
342  
343 $pscubecontour_spec->{_prefix_aref} = \@prefix;
344 return ();
345  
346 }
347  
348 =head2 sub suffix_aref
349  
350 Initialize suffixes as empty
351 values
352  
353 =cut
354  
355 sub suffix_aref {
356  
357 my $self = @_;
358  
359 my @suffix;
360  
361 for ( my $i = 0 ; $i < $max_index ; $i++ ) {
362  
363 $suffix[$i] = $empty_string;
364  
365 }
366  
367 my $index_aref = get_binding_index_aref();
368 my @index = @$index_aref;
369  
370 # label 26 in GUI is input xx_file and needs a home directory
371 $suffix[ $index[0] ] = '' . '' . '$suffix_bin';
372  
373 # label 50 in GUI is input yy_file and needs a home directory
374 $suffix[ $index[1] ] = '' . '' . '$suffix_bin';
375  
376 # label 58 in GUI is input zz_file and needs a home directory
377 $suffix[ $index[2] ] = '' . '' . '$suffix_bin';
378  
379 $pscubecontour_spec->{_suffix_aref} = \@suffix;
380 return ();
381  
382 }
383  
384 =head2 sub variables
385  
386  
387 return a hash array
388 with definitions
389
390 =cut
391  
392 sub variables {
393  
394 my ($self) = @_;
395 my $hash_ref = $pscubecontour_spec;
396 return ($hash_ref);
397 }
398  
399 1;