24 : position_of_lights(0), interval_mapping(0) {
69 const char *fmt, ...) {
74 sprintf(buff,
"!%s", name);
81 for (
int i = 0; i < n; i++) {
87 strcat(buff, va_arg(va,
char *));
91 sprintf(ss,
"%d", va_arg(va,
int));
96 sprintf(ss,
"%lg", va_arg(va,
double));
110 char type,
int n,
void *p) {
115 sprintf(buff,
"!%s", name);
124 for (
int i = 0; i < n; i++) {
129 sprintf(ss,
"%d", *ip);
135 sprintf(ss,
"%lg", *dp);
198 const char *delim =
", \t\r\n";
200 char *token = strtok(s, delim);
202 while (token && i < n) {
203 if (sscanf(token, fmt, &value[i]) != 1)
return -(i + 1);
205 token = strtok(0, delim);
213 return ReadVisValueT<int>(s, n, value,
"%d");
217 return ReadVisValueT<double>(s, n, value,
"%lf");
229 if (len > n)
return 0;
237 const int max_data_n = 200;
239 const char *delim =
", \t\r\n";
242 char *token = strtok(s, delim);
245 if (max_data_n >= i) assert(0);
249 if (sscanf(token, fmt, &x) != 1) {
254 token = strtok(0, delim);
261 for (i = 0; i < n; i++) {
271 char *header = strtok(buff,
" =,\r\n\t");
273 if (header[0] == 0 || header[0] !=
'!')
return false;
276 #define GENERATE_CODE(x, n, fg) \
277 else if (strcmp(#x, header) == 0) { \
278 int r = ReadVisValue(0, n, &x); \
282 #define GENERATE_CODEA(x, n, fg) \
283 else if (strcmp(#x, header) == 0) { \
284 int r = ReadVisValue(0, n, x); \
314 #undef GENERATE_CODEA
315 #define GENERATE_CODE(x, n, type, fmt) \
316 else if (strcmp(#x, header) == 0) { \
319 x = ReadVisPArry<type>(0, n, fmt); \
391 for (
int i = 0; i < 10; i++)
coef[i] = 0;
402 hecd->
WriteLine(
"!!common of PSR ----------------------------------");
435 hecd->
WriteLine(
"!!for equivalent value surface -------------------");
445 hecd->
WriteLine(
"!!for surface of user defined equation -----------");
453 hecd->
WriteLine(
"!!for BMP output ---------------------------------");
467 char *header = strtok(buff,
" =,\r\n\t");
469 if (header[0] == 0 || header[0] !=
'!')
return false;
472 #define GENERATE_CODE(x, n, fg) \
473 else if (strcmp(#x, header) == 0) { \
474 int r = ReadVisValue(0, n, &x); \
478 #define GENERATE_CODEA(x, n, fg) \
479 else if (strcmp(#x, header) == 0) { \
480 int r = ReadVisValue(0, n, x); \
523 #undef GENERATE_CODEA
566 hecd->
WriteLine(
"!!for dividing -----------------------------------");
582 hecd->
WriteLine(
"!!for opacity ------------------------------------");
593 hecd->
WriteLine(
"!!view params ------------------------------------");
606 char *header = strtok(buff,
" =,\r\n\t");
608 if (header[0] == 0 || header[0] !=
'!')
return false;
611 #define GENERATE_CODE(x, n, fg) \
612 else if (strcmp(#x, header) == 0) { \
613 int r = ReadVisValue(0, n, &x); \
617 #define GENERATE_CODEA(x, n, fg) \
618 else if (strcmp(#x, header) == 0) { \
619 int r = ReadVisValue(0, n, x); \
646 #undef GENERATE_CODEA
647 #define GENERATE_CODE(x, n, type, fmt) \
648 else if (strcmp(#x, header) == 0) { \
651 x = ReadVisPArry<type>(0, n, fmt); \
685 vector<CVis_PSR *>::iterator is;
687 for (is =
psr.begin(); is !=
psr.end(); is++) {
700 hecd->
WriteHeader(
"!VISUAL",
"SIII",
"method",
"PSR",
"visual_start_step",
704 vector<CVis_PSR *>::iterator is;
706 for (is =
psr.begin(); is !=
psr.end(); is++) {
713 hecd->
WriteHeader(
"!VISUAL",
"SIII",
"method",
"PVR",
"visual_start_step",
725 if (!hecd->
ParseHeader(header_line, rcode,
"SIII",
"method", s,
733 bool fg_psr = (strcmp(
"PSR", method_s) == 0);
740 if (!hecd->
ReadLine(s))
return false;
745 if (strcmp(
"!SURFACE", s) != 0)
return false;
749 if (!vis_psr->
Read(hecd)) {
754 psr.push_back(vis_psr);
#define GENERATE_CODEA(x, n, fg)
#define GENERATE_CODE(x, n, fg)
virtual void Write(class CHECData *hecd)
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,...)
virtual bool ReadLine(char *s, int size=256)
virtual bool ReadParameter(int *rcode, const char *fmt,...)
virtual void WriteHeader(const char *name, const char *fmt="",...)
virtual void WriteLine(const char *s)
virtual void PushReadLine(const char *s)
char deform_comp_name[100]
char data_subcomp_name[4]
virtual bool ReadData(const char *line)
char color_comp_name[100]
char color_subcomp_name[4]
double deform_line_color[3]
double initial_line_color[3]
virtual void Write(class CHECData *hecd)
int transfer_function_type
virtual void Write(class CHECData *hecd)
virtual bool ReadData(const char *line)
@ color_mapping_style_linear
virtual bool Read(class CHECData *hecd)
virtual bool ReadData(const char *line)
static void WriteVisParam(class CHECData *hecd, const char *name, const char *fmt,...)
@ color_system_type_blue_red
double * position_of_lights
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)
static int ReadVisValueT(char *s, int n, T *value, const char *fmt)
double * interval_mapping
virtual ~CVis_ViewParams()
double background_color[3]
static int ReadVisValue(char *s, int n, int *value)
void cleanup_token(char *s)