FrontISTR  5.8.0
Large-scale structural analysis program with finit element method
CHECDB_Visual.cpp
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2019 FrontISTR Commons
3  * This software is released under the MIT License, see LICENSE.txt
4  *****************************************************************************/
5 /*
6  CHECDB_Visual Ver.1.0
7 */
8 
9 #include <stdarg.h>
10 #include <vector>
11 #include "CHECDB.h"
12 #include "CHECDB_Visual.h"
13 #include "CHECData.h"
14 #include "hecd_util.h"
15 
16 using namespace std;
17 using namespace hecd_util;
18 
19 //*****************************************************************************
20 // CVis_ViewParams
21 //*****************************************************************************
22 
24  : position_of_lights(0), interval_mapping(0) {
25  Init();
26 }
27 
29  delete position_of_lights;
30  delete interval_mapping;
31 }
32 
34  x_resolution = 512;
35  y_resolution = 512;
36  num_of_lights = 1;
37  delete position_of_lights;
39  viewpoint[0] = viewpoint[1] = viewpoint[2] = 0;
40  fg_viewpoint = false;
41  look_at_point[0] = look_at_point[1] = look_at_point[2] = 0;
42  fg_look_at_point = false;
43  up_direction[0] = 0;
44  up_direction[1] = 0;
45  up_direction[2] = 1;
46  ambient_coef = 0.3;
47  diffuse_coef = 0.7;
48  specular_coef = 0.6;
51  delete[] interval_mapping;
52  interval_mapping = 0;
53  interval_mapping = 0;
55  num_of_frame = 8;
57  scale_marking_on = 0;
58  num_of_scales = 3;
59  font_size = 1;
60  font_color[0] = font_color[1] = font_color[2] = 1;
63  fixed_range_on = 0;
64  range_value[0] = range_value[1] = 0;
65  fg_range_value = false;
66 }
67 
68 void CVis_ViewParams::WriteVisParam(class CHECData *hecd, const char *name,
69  const char *fmt, ...) {
70  va_list va;
71  va_start(va, fmt);
72  char buff[256];
73  char ss[256];
74  sprintf(buff, "!%s", name);
75  int n = strlen(fmt);
76 
77  if (n > 1) {
78  strcat(buff, " =");
79  }
80 
81  for (int i = 0; i < n; i++) {
82  strcat(buff, " ");
83  char c = fmt[i];
84 
85  switch (c) {
86  case 'S':
87  strcat(buff, va_arg(va, char *));
88  break;
89 
90  case 'I':
91  sprintf(ss, "%d", va_arg(va, int));
92  strcat(buff, ss);
93  break;
94 
95  case 'F':
96  sprintf(ss, "%lg", va_arg(va, double));
97  strcat(buff, ss);
98  break;
99 
100  default:
101  assert(0);
102  }
103  }
104 
105  hecd->WriteLine(buff);
106  va_end(va);
107 }
108 
109 void CVis_ViewParams::WriteVisPArry(class CHECData *hecd, const char *name,
110  char type, int n, void *p) {
111  char buff[256];
112  char ss[256];
113  int *ip;
114  double *dp;
115  sprintf(buff, "!%s", name);
116 
117  if (n > 1) {
118  strcat(buff, " =");
119  }
120 
121  ip = (int *)p;
122  dp = (double *)p;
123 
124  for (int i = 0; i < n; i++) {
125  strcat(buff, ", ");
126 
127  switch (type) {
128  case 'I':
129  sprintf(ss, "%d", *ip);
130  strcat(buff, ss);
131  ip++;
132  break;
133 
134  case 'F':
135  sprintf(ss, "%lg", *dp);
136  strcat(buff, ss);
137  dp++;
138  break;
139 
140  default:
141  assert(0);
142  }
143  }
144 
145  hecd->WriteLine(buff);
146 }
147 
148 void CVis_ViewParams::Write(class CHECData *hecd) {
149  WriteVisParam(hecd, "x_resolution", "I", x_resolution);
150  WriteVisParam(hecd, "y_resolution", "I", y_resolution);
151  WriteVisParam(hecd, "num_of_lights", "I", num_of_lights);
152 
153  if (num_of_lights > 0 && position_of_lights) {
154  WriteVisPArry(hecd, "position_of_lights", 'F', num_of_lights,
156  }
157 
158  if (fg_viewpoint) WriteVisPArry(hecd, "viewpoint", 'F', 3, viewpoint);
159 
160  if (fg_look_at_point)
161  WriteVisPArry(hecd, "look_at_point", 'F', 3, look_at_point);
162 
163  WriteVisParam(hecd, "up_direction", "F", 3, up_direction);
164  WriteVisParam(hecd, "ambient_coef", "F", ambient_coef);
165  WriteVisParam(hecd, "diffuse_coef", "F", diffuse_coef);
166  WriteVisParam(hecd, "specular_coef", "F", specular_coef);
167  WriteVisParam(hecd, "color_mapping_style", "I", color_mapping_style);
168  WriteVisParam(hecd, "interval_mapping_num", "I", interval_mapping_num);
169 
170  if (interval_mapping_num > 0) {
171  if (!interval_mapping) assert(0);
172 
173  WriteVisPArry(hecd, "nterval_mapping", 'F', interval_mapping_num * 2,
175  }
176 
178  WriteVisParam(hecd, "rotate_style", "I", rotate_style);
179 
180  WriteVisParam(hecd, "num_of_frame", "I", num_of_frame);
181  WriteVisParam(hecd, "color_mapping_bar_on", "I", color_mapping_bar_on);
182  WriteVisParam(hecd, "scale_marking_on", "I", scale_marking_on);
183  WriteVisParam(hecd, "num_of_scales", "I", num_of_scales);
184  WriteVisParam(hecd, "font_size", "F", font_size);
185  WriteVisPArry(hecd, "font_color", 'F', 3, font_color);
186  WriteVisPArry(hecd, "font_color", 'F', 3, font_color);
187  WriteVisPArry(hecd, "background_color", 'F', 3, background_color);
188  WriteVisParam(hecd, "color_system_type", "I", color_system_type);
189  WriteVisParam(hecd, "fixed_range_on", "I", fixed_range_on);
190 
191  if (fg_range_value) WriteVisPArry(hecd, "range_value", 'F', 3, range_value);
192 }
193 
194 //-----------------------------------------------------------------------------
195 
196 template <class T>
197 int CVis_ViewParams::ReadVisValueT(char *s, int n, T *value, const char *fmt) {
198  const char *delim = ", \t\r\n";
199  int i = 0;
200  char *token = strtok(s, delim);
201 
202  while (token && i < n) {
203  if (sscanf(token, fmt, &value[i]) != 1) return -(i + 1);
204 
205  token = strtok(0, delim);
206  i++;
207  }
208 
209  return i;
210 }
211 
212 int CVis_ViewParams::ReadVisValue(char *s, int n, int *value) {
213  return ReadVisValueT<int>(s, n, value, "%d");
214 }
215 
216 int CVis_ViewParams::ReadVisValue(char *s, int n, double *value) {
217  return ReadVisValueT<double>(s, n, value, "%lf");
218 }
219 
220 int CVis_ViewParams::ReadVisValue(char *s, int n, char *value) {
221  // Handle NULL pointer case (when called from strtok continuation)
222  if (s == NULL) {
223  return 0;
224  }
225 
226  cleanup_token(s);
227  int len = strlen(s);
228 
229  if (len > n) return 0;
230 
231  strcpy(value, s);
232  return len;
233 }
234 
235 template <class T>
236 T *CVis_ViewParams::ReadVisPArry(char *s, int &n, const char *fmt) {
237  const int max_data_n = 200;
238  T buff[max_data_n];
239  const char *delim = ", \t\r\n";
240  n = 0;
241  int i = 0;
242  char *token = strtok(s, delim);
243 
244  while (token) {
245  if (max_data_n >= i) assert(0);
246 
247  T x;
248 
249  if (sscanf(token, fmt, &x) != 1) {
250  return 0;
251  }
252 
253  buff[i] = x;
254  token = strtok(0, delim);
255  i++;
256  }
257 
258  n = i;
259  T *data = new T[n];
260 
261  for (i = 0; i < n; i++) {
262  data[i] = buff[i];
263  }
264 
265  return data;
266 }
267 
268 bool CVis_ViewParams::ReadData(const char *line) {
269  char buff[256];
270  strcpy(buff, line);
271  char *header = strtok(buff, " =,\r\n\t");
272 
273  if (header[0] == 0 || header[0] != '!') return false;
274 
275  tolower(header);
276 #define GENERATE_CODE(x, n, fg) \
277  else if (strcmp(#x, header) == 0) { \
278  int r = ReadVisValue(0, n, &x); \
279  fg = (r > 0); \
280  return fg; \
281  }
282 #define GENERATE_CODEA(x, n, fg) \
283  else if (strcmp(#x, header) == 0) { \
284  int r = ReadVisValue(0, n, x); \
285  fg = (r > 0); \
286  return fg; \
287  }
288  bool dummy;
289 
290  if (false)
291  ; // dummy
292 
293  GENERATE_CODE(x_resolution, 1, dummy)
294  GENERATE_CODE(y_resolution, 1, dummy)
297  GENERATE_CODEA(up_direction, 3, dummy)
298  GENERATE_CODE(ambient_coef, 1, dummy)
299  GENERATE_CODE(diffuse_coef, 1, dummy)
300  GENERATE_CODE(specular_coef, 1, dummy)
302  GENERATE_CODE(rotate_style, 1, dummy)
303  GENERATE_CODE(num_of_frame, 1, dummy)
306  GENERATE_CODE(num_of_scales, 1, dummy)
307  GENERATE_CODE(font_size, 1, dummy)
308  GENERATE_CODEA(font_color, 3, dummy)
311  GENERATE_CODE(fixed_range_on, 1, dummy)
313 #undef GENERATE_CODE
314 #undef GENERATE_CODEA
315 #define GENERATE_CODE(x, n, type, fmt) \
316  else if (strcmp(#x, header) == 0) { \
317  delete[] x; \
318  x = 0; \
319  x = ReadVisPArry<type>(0, n, fmt); \
320  return x != 0; \
321  }
322 
323  if (false)
324  ;
325 
328 #undef GENERATE_CODE
329  return false;
330 }
331 
333  char line[256];
334 
335  while (1) {
336  if (!hecd->ReadLine(line)) break;
337 
338  if (!ReadData(line)) {
339  hecd->PushReadLine(line);
340  break;
341  }
342  }
343 
344  return true;
345 }
346 
347 //*****************************************************************************
348 // CVis_PSR
349 //*****************************************************************************
350 
352 
354 
356  // common ------------------------------------------------
359  color_comp_name[0] = 0;
360  strcpy(color_subcomp_name, "x");
361  color_comp = 0;
362  color_subcomp = 1;
363  iso_number = 5;
364  specified_color = 0;
365  deform_display_on = 0;
366  deform_comp_name[0] = 0;
367  deform_comp = 0;
368  deform_scale = 0;
369  fg_deform_scale = false;
372  initial_line_color[0] = 0;
373  initial_line_color[1] = 0;
374  initial_line_color[2] = 1;
375  deform_line_color[0] = 0;
376  deform_line_color[1] = 0;
377  deform_line_color[2] = 1;
378  strcpy(output_type, "AVS");
379  // for surface_style == surface_style_equivalent ---------
380  data_comp_name[0] = 0;
381  strcpy(data_subcomp_name, "x");
382  data_comp = 0;
383  data_subcomp = 1;
384  iso_value = 0;
385  // for surface_style == surface_style_user ---------------
387  point[0] = point[1] = point[2] = 0;
388  radius = 1;
389  length = 1;
390 
391  for (int i = 0; i < 10; i++) coef[i] = 0;
392 
393  // rendering parameters(output_type == "BMP") ------------
395  isoline_color[0] = isoline_color[1] = isoline_color[2] = 0;
396  fg_isoline_color = false;
397  boundary_line_on = 0;
398 }
399 
400 void CVis_PSR::Write(class CHECData *hecd) {
401  // common ------------------------------------------------
402  hecd->WriteLine("!!common of PSR ----------------------------------");
403  WriteVisParam(hecd, "surface_style", "I", surface_style);
404  WriteVisParam(hecd, "display_method", "I", display_method);
405 
406  if (color_comp_name[0] != 0)
407  WriteVisParam(hecd, "display_method", "S", color_comp_name);
408 
409  if (color_subcomp_name[0] != 0)
410  WriteVisParam(hecd, "color_subcomp_name", "S", color_subcomp_name);
411 
412  WriteVisParam(hecd, "color_comp", "I", color_comp);
413  WriteVisParam(hecd, "color_subcomp", "I", color_subcomp);
414  WriteVisParam(hecd, "iso_number", "I", iso_number);
415  WriteVisParam(hecd, "specified_color", "F", specified_color);
416  WriteVisParam(hecd, "deform_display_on", "I", deform_display_on);
417 
418  if (deform_comp_name[0] != 0)
419  WriteVisParam(hecd, "deform_comp_name", "S", deform_comp_name);
420 
421  WriteVisParam(hecd, "deform_comp", "I", deform_comp);
422 
423  if (fg_deform_scale) WriteVisParam(hecd, "deform_scale", "F", deform_scale);
424 
426  WriteVisParam(hecd, "initial_style", "I", initial_style);
427 
429  WriteVisParam(hecd, "deform_style", "I", deform_style);
430 
431  WriteVisPArry(hecd, "initial_line_color", 'F', 3, initial_line_color);
432  WriteVisPArry(hecd, "deform_line_color", 'F', 3, deform_line_color);
433  WriteVisParam(hecd, "output_type", "S", output_type);
434  // for surface_style == surface_style_equivalent ---------
435  hecd->WriteLine("!!for equivalent value surface -------------------");
436 
437  if (data_comp_name[0] != 0)
438  WriteVisParam(hecd, "data_comp_name", "S", data_comp_name);
439 
440  WriteVisParam(hecd, "data_subcomp_name", "S", data_subcomp_name);
441  WriteVisParam(hecd, "data_comp", "I", data_comp);
442  WriteVisParam(hecd, "data_subcomp", "I", data_subcomp);
443  WriteVisParam(hecd, "iso_value", "F", iso_value);
444  // for surface_style == surface_style_user ---------------
445  hecd->WriteLine("!!for surface of user defined equation -----------");
446  WriteVisParam(hecd, "method", "I", method);
447  WriteVisPArry(hecd, "point", 'F', 3, point);
448  WriteVisParam(hecd, "radius", "F", radius);
449  WriteVisParam(hecd, "length", "F", length);
450  WriteVisPArry(hecd, "coef", 'F', 10, coef);
451  // rendering parameters(output_type == "BMP") ------------
452  // parameters defined in CVis_ScreenParams and followings
453  hecd->WriteLine("!!for BMP output ---------------------------------");
455 
456  if (fg_isoline_color)
457  WriteVisPArry(hecd, "isoline_color", 'F', 3, isoline_color);
458 
459  WriteVisParam(hecd, "boundary_line_on", "I", boundary_line_on);
460 }
461 
462 bool CVis_PSR::ReadData(const char *line) {
463  if (CVis_ViewParams::ReadData(line)) return true;
464 
465  char buff[256];
466  strcpy(buff, line);
467  char *header = strtok(buff, " =,\r\n\t");
468 
469  if (header[0] == 0 || header[0] != '!') return false;
470 
471  tolower(header);
472 #define GENERATE_CODE(x, n, fg) \
473  else if (strcmp(#x, header) == 0) { \
474  int r = ReadVisValue(0, n, &x); \
475  fg = (r > 0); \
476  return fg; \
477  }
478 #define GENERATE_CODEA(x, n, fg) \
479  else if (strcmp(#x, header) == 0) { \
480  int r = ReadVisValue(0, n, x); \
481  fg = (r > 0); \
482  return fg; \
483  }
484  bool dummy;
485 
486  if (false)
487  ; // dummy
488 
489  GENERATE_CODE(surface_style, 1, dummy)
490  GENERATE_CODE(display_method, 1, dummy)
491  GENERATE_CODEA(color_comp_name, 100, dummy)
493  GENERATE_CODE(color_comp, 1, dummy)
494  GENERATE_CODE(color_subcomp, 1, dummy)
495  GENERATE_CODE(iso_number, 1, dummy)
496  GENERATE_CODE(specified_color, 1, dummy)
498  GENERATE_CODEA(deform_comp_name, 100, dummy)
499  GENERATE_CODE(deform_comp, 1, dummy)
501  GENERATE_CODE(initial_style, 1, dummy)
502  GENERATE_CODE(deform_style, 1, dummy)
505  GENERATE_CODEA(output_type, 3, dummy)
506  // for surface_style == surface_style_equivalent ---------
507  GENERATE_CODEA(data_comp_name, 100, dummy)
509  GENERATE_CODE(data_comp, 1, dummy)
510  GENERATE_CODE(data_subcomp, 1, dummy)
511  GENERATE_CODE(iso_value, 1, dummy)
512  // for surface_style == surface_style_user ---------------
513  GENERATE_CODE(method, 1, dummy)
514  GENERATE_CODEA(point, 3, dummy)
515  GENERATE_CODE(radius, 1, dummy)
516  GENERATE_CODE(length, 1, dummy)
517  GENERATE_CODEA(coef, 10, dummy)
518  // rendering parameters(output_type == "BMP") ------------
519  // parameters defined in CVis_ScreenParams and followings
522 #undef GENERATE_CODE
523 #undef GENERATE_CODEA
524  return false;
525 }
526 
527 //*****************************************************************************
528 // CVis_PVR
529 //*****************************************************************************
530 
531 CVis_PVR::CVis_PVR() : CVis_ViewParams(), fea_point(0) { Init(); }
532 
534 
536  // for dividing ------------------------------------------
537  maximum_refinement = 100;
538  n_voxel_x = 0;
539  fg_n_voxel_x = false;
540  n_voxel_y = 0;
541  fg_n_voxel_y = false;
542  n_voxel_z = 0;
543  fg_n_voxel_z = false;
544  voxel_filename[0] = 0;
545  x_specified_level = 100;
546  y_specified_level = 100;
547  z_specified_level = 100;
548  // for opacity
550  opa_value = 0.02;
551  num_of_features = 0;
552  delete fea_point;
553  fea_point = 0;
554  name_lookup[0] = 0;
555  // parameters defined in CVis_ViewParams and followings
557  histogram_on = 0;
558 
559  for (int i = 0; i < 6; i++) display_range[i] = 0;
560 
561  fg_display_range = false;
562 }
563 
564 void CVis_PVR::Write(class CHECData *hecd) {
565  // for dividing ------------------------------------------
566  hecd->WriteLine("!!for dividing -----------------------------------");
567  WriteVisParam(hecd, "maximum_refinement", "I", maximum_refinement);
568 
569  if (fg_n_voxel_x) WriteVisParam(hecd, "n_voxel_x", "I", n_voxel_x);
570 
571  if (fg_n_voxel_y) WriteVisParam(hecd, "n_voxel_y", "I", n_voxel_y);
572 
573  if (fg_n_voxel_z) WriteVisParam(hecd, "n_voxel_z", "I", n_voxel_z);
574 
575  if (voxel_filename[0] != 0)
576  WriteVisParam(hecd, "voxel_filename", "S", voxel_filename);
577 
578  WriteVisParam(hecd, "x_specified_level", "I", x_specified_level);
579  WriteVisParam(hecd, "y_specified_level", "I", y_specified_level);
580  WriteVisParam(hecd, "z_specified_level", "I", z_specified_level);
581  // for opacity -------------------------------------------
582  hecd->WriteLine("!!for opacity ------------------------------------");
583  WriteVisParam(hecd, "transfer_function_type", "I", transfer_function_type);
584  WriteVisParam(hecd, "opa_value", "F", opa_value);
585  WriteVisParam(hecd, "num_of_features", "I", num_of_features);
586 
587  if (num_of_features > 0 && fea_point)
588  WriteVisPArry(hecd, "fea_point", 'F', 3 * num_of_features, fea_point);
589 
590  if (name_lookup[0] != 0) WriteVisParam(hecd, "name_lookup", "S", name_lookup);
591 
592  // parameters defined in CVis_ViewParams and followings
593  hecd->WriteLine("!!view params ------------------------------------");
595  WriteVisParam(hecd, "histogram_on", "I", histogram_on);
596 
597  if (fg_display_range)
598  WriteVisPArry(hecd, "display_range", 'F', 6, display_range);
599 }
600 
601 bool CVis_PVR::ReadData(const char *line) {
602  if (CVis_ViewParams::ReadData(line)) return true;
603 
604  char buff[256];
605  strcpy(buff, line);
606  char *header = strtok(buff, " =,\r\n\t");
607 
608  if (header[0] == 0 || header[0] != '!') return false;
609 
610  tolower(header);
611 #define GENERATE_CODE(x, n, fg) \
612  else if (strcmp(#x, header) == 0) { \
613  int r = ReadVisValue(0, n, &x); \
614  fg = (r > 0); \
615  return fg; \
616  }
617 #define GENERATE_CODEA(x, n, fg) \
618  else if (strcmp(#x, header) == 0) { \
619  int r = ReadVisValue(0, n, x); \
620  fg = (r > 0); \
621  return fg; \
622  }
623  bool dummy;
624 
625  if (false)
626  ; // dummy
627 
628  // for dividing ------------------------------------------
633  GENERATE_CODEA(voxel_filename, 100, dummy)
637  // for opacity
639  GENERATE_CODE(opa_value, 1, dummy)
640  GENERATE_CODE(num_of_features, 1, dummy)
641  GENERATE_CODEA(name_lookup, 100, dummy)
642  // parameters defined in CVis_ViewParams and followings
643  GENERATE_CODE(histogram_on, 1, dummy)
645 #undef GENERATE_CODE
646 #undef GENERATE_CODEA
647 #define GENERATE_CODE(x, n, type, fmt) \
648  else if (strcmp(#x, header) == 0) { \
649  delete[] x; \
650  x = 0; \
651  x = ReadVisPArry<type>(0, n, fmt); \
652  return x != 0; \
653  }
654 
655  if (num_of_features <= 0) return false;
656 
657  int f_data_size = 3 * num_of_features;
658 
659  if (false)
660  ;
661 
662  GENERATE_CODE(fea_point, f_data_size, double, "%lf");
663 #undef GENERATE_CODE
664  return false;
665 }
666 
667 //-----------------------------------------------------------------------------
668 // CHECDB_Visual
669 //-----------------------------------------------------------------------------
670 
672  visual_start_step = -1;
674  visual_end_step = -1;
675  surface_num = 0;
676 }
677 
679 
681  visual_start_step = -1;
683  visual_end_step = -1;
684  surface_num = 0;
685  vector<CVis_PSR *>::iterator is;
686 
687  for (is = psr.begin(); is != psr.end(); is++) {
688  delete *is;
689  }
690 
691  psr.clear();
692  delete pvr;
693  pvr = 0;
694 }
695 
696 void CHECDB_Visual::Write(class CHECData *hecd) {
697  surface_num = psr.size();
698 
699  if (surface_num > 0) {
700  hecd->WriteHeader("!VISUAL", "SIII", "method", "PSR", "visual_start_step",
701  visual_start_step, "visual_interval_step",
702  visual_interval_step, "visual_end_step", visual_end_step);
703  CVis_ViewParams::WriteVisParam(hecd, "surface_num", "I", surface_num);
704  vector<CVis_PSR *>::iterator is;
705 
706  for (is = psr.begin(); is != psr.end(); is++) {
707  hecd->WriteLine("!SURFACE");
708  (*is)->Write(hecd);
709  }
710  }
711 
712  if (pvr) {
713  hecd->WriteHeader("!VISUAL", "SIII", "method", "PVR", "visual_start_step",
714  visual_start_step, "visual_interval_step",
715  visual_interval_step, "visual_end_step", visual_end_step);
716  pvr->Write(hecd);
717  }
718 }
719 
720 bool CHECDB_Visual::Read(CHECData *hecd, char *header_line) {
721  char s[256];
722  char method_s[256];
723  int rcode[10];
724 
725  if (!hecd->ParseHeader(header_line, rcode, "SIII", "method", s,
726  "visual_start_step", &visual_start_step,
727  "visual_interval_step", &visual_interval_step,
728  "visual_end_step", &visual_end_step))
729  return false;
730 
731  cleanup_token(s, method_s);
732  toupper(method_s);
733  bool fg_psr = (strcmp("PSR", method_s) == 0);
734 
735  if (fg_psr) {
736  if (!hecd->ReadParameter(rcode, "I", "surface_num", &surface_num))
737  return false;
738 
739  for (int i = 0; i < surface_num; i++) {
740  if (!hecd->ReadLine(s)) return false;
741 
742  cleanup_token(s);
743  toupper(s);
744 
745  if (strcmp("!SURFACE", s) != 0) return false;
746 
747  CVis_PSR *vis_psr = new CVis_PSR();
748 
749  if (!vis_psr->Read(hecd)) {
750  delete vis_psr;
751  return false;
752  }
753 
754  psr.push_back(vis_psr);
755  }
756 
757  } else {
758  delete pvr;
759  pvr = new CVis_PVR();
760 
761  if (!pvr->Read(hecd)) {
762  delete pvr;
763  pvr = 0;
764  return false;
765  }
766  }
767 
768  return true;
769 }
@ HECDB_VISUAL
Definition: CHECDB.h:28
#define GENERATE_CODEA(x, n, fg)
#define GENERATE_CODE(x, n, fg)
int visual_interval_step
virtual ~CHECDB_Visual()
virtual void Write(class CHECData *hecd)
CVis_PVR * pvr
virtual void Clear()
virtual bool Read(class CHECData *hecd, char *header_line)
std::vector< CVis_PSR * > psr
virtual bool ParseHeader(char *header_line, int *rcode, const char *fmt,...)
Definition: CHECData.cpp:506
virtual bool ReadLine(char *s, int size=256)
Definition: CHECData.cpp:307
virtual bool ReadParameter(int *rcode, const char *fmt,...)
Definition: CHECData.cpp:525
virtual void WriteHeader(const char *name, const char *fmt="",...)
Definition: CHECData.cpp:68
virtual void WriteLine(const char *s)
Definition: CHECData.cpp:58
virtual void PushReadLine(const char *s)
Definition: CHECData.cpp:328
char deform_comp_name[100]
double radius
int data_subcomp
char output_type[4]
double length
int deform_display_on
virtual ~CVis_PSR()
int display_method
char data_subcomp_name[4]
@ deform_style_none
int color_comp
virtual bool ReadData(const char *line)
int surface_style
Definition: CHECDB_Visual.h:97
double iso_value
char color_comp_name[100]
char color_subcomp_name[4]
double deform_line_color[3]
double deform_scale
bool fg_isoline_color
int iso_number
int initial_style
double initial_line_color[3]
double specified_color
int deform_comp
int color_subcomp
double isoline_color[3]
bool fg_deform_scale
int boundary_line_on
virtual void Init()
@ surface_style_boundary
Definition: CHECDB_Visual.h:99
@ display_method_color
double coef[10]
@ initial_style_none
virtual void Write(class CHECData *hecd)
int deform_style
double point[3]
char data_comp_name[100]
int transfer_function_type
bool fg_n_voxel_z
double opa_value
double * fea_point
bool fg_n_voxel_x
int maximum_refinement
int z_specified_level
int histogram_on
virtual void Init()
virtual ~CVis_PVR()
double display_range[6]
virtual void Write(class CHECData *hecd)
bool fg_display_range
char voxel_filename[100]
int num_of_features
bool fg_n_voxel_y
virtual bool ReadData(const char *line)
int x_specified_level
int y_specified_level
char name_lookup[100]
virtual bool Read(class CHECData *hecd)
double up_direction[3]
Definition: CHECDB_Visual.h:27
virtual bool ReadData(const char *line)
double range_value[2]
Definition: CHECDB_Visual.h:64
double specular_coef
Definition: CHECDB_Visual.h:30
static void WriteVisParam(class CHECData *hecd, const char *name, const char *fmt,...)
double * position_of_lights
Definition: CHECDB_Visual.h:22
static T * ReadVisPArry(char *s, int &n, const char *fmt)
virtual void Write(class CHECData *hecd)
static void WriteVisPArry(class CHECData *hecd, const char *name, char type, int n, void *p)
virtual void Init()
double font_color[3]
Definition: CHECDB_Visual.h:54
static int ReadVisValueT(char *s, int n, T *value, const char *fmt)
double look_at_point[3]
Definition: CHECDB_Visual.h:25
double * interval_mapping
Definition: CHECDB_Visual.h:39
virtual ~CVis_ViewParams()
double background_color[3]
Definition: CHECDB_Visual.h:55
static int ReadVisValue(char *s, int n, int *value)
double viewpoint[3]
Definition: CHECDB_Visual.h:23
#define NULL
PVR_link * pvr
void tolower(char *s)
Definition: hecd_util.cpp:56
void toupper(char *s)
Definition: hecd_util.cpp:37
void cleanup_token(char *s)
Definition: hecd_util.cpp:13
CNFData data