#include #include #include #include #include #include #include #include "list.h" #include "types.h" #include "intcgm.h" #include "intcgm2.h" #include "intcgm6.h" static tpoint trace_start_pos, base_direction, amp_direction, trace_direction; static double bline_sc_f, amp_sc_f, trc_st_f, VA_bline_offset, pos_clp_lmt, neg_clp_lmt, pos_bckfil_bnd, neg_bckfil_bnd; static int trace_dsp_md, samp_type, n_samp, wig_trc_mod, nul_clr_i, n_trace; static double *sample; static long *coind; static int trace=0; void cgm_sism4 ( tpoint *pt, char *data_rec ) { sscanf ( data_rec, "%lg %lg %lg %lg %lg %lg %d %d %d %lg %lg %*d %d %d %d", &bline_sc_f, &_sc_f, &trc_st_f, &VA_bline_offset, &pos_clp_lmt, &neg_clp_lmt, &trace_dsp_md, &samp_type, &n_samp, &pos_bckfil_bnd, &neg_bckfil_bnd, &wig_trc_mod, &nul_clr_i, &n_trace ); trace_start_pos = pt[0]; base_direction = pt[1]; amp_direction = pt[2]; trace_direction = pt[3]; trace = 0; } /* adjust the samples to the amplitude direction vector */ static void dirvet ( double dx ) { int i; for ( i=0; imn && samp2mx) { x[n] = min + dx; y[n++] = interpl(i,y1,y2,min); x[n] = max + dx; y[n++] = interpl(i,y1,y2,max); x[n] = max + dx; y[n++] = y2; x[n] = min + dx; y[n++] = y2; } else if ( (samp1>mn && samp1mn && samp2mn && samp1mx ) { x[n] = min + dx; y[n++] = y1; x[n] = sample[i] + dx; y[n++] = y1; x[n] = max + dx; y[n++] = interpl(i,y1,y2,max); x[n] = max + dx; y[n++] = y2; x[n] = min + dx; y[n++] = y2; } else if ( samp1>mx && samp2>mx ) { x[n] = min + dx; y[n++] = y1; x[n] = max + dx; y[n++] = y1; x[n] = max + dx; y[n++] = y2; x[n] = min + dx; y[n++] = y2; } else if ( samp1>mx && samp2mn ) { x[n] = min + dx; y[n++] = y1; x[n] = max + dx; y[n++] = y1; x[n] = max + dx; y[n++] = interpl(i,y1,y2,max); x[n] = sample[i+1] + dx; y[n++] = y2; x[n] = min + dx; y[n++] = y2; } else if ( samp1>mn && samp10 ) { if ( cordep ) { cor = cdEncodeColor ( (unsigned char)((intcgm_color_table[coind[i]].red*255)/intcgm_cgm.color_ext.white.red), (unsigned char)((intcgm_color_table[coind[i]].green*255)/intcgm_cgm.color_ext.white.green), (unsigned char)((intcgm_color_table[coind[i]].blue*255)/intcgm_cgm.color_ext.white.blue) ); cdCanvasSetForeground (intcgm_canvas, cor ); } cdCanvasBegin(intcgm_canvas, CD_FILL ); for ( j=0; jnegclp && sample[i]negclp && sample[i+1]negclp && sample[i+1]posclp ) { cdCanvasVertex (intcgm_canvas, cgm_vdcx2canvas(negclp + dx), cgm_vdcy2canvas(interpl(i,y1,y2,negclp)) ); cdCanvasVertex (intcgm_canvas, cgm_vdcx2canvas(posclp + dx), cgm_vdcy2canvas(interpl(i,y1,y2,posclp)) ); } else if ( sample[i]>negclp && sample[i]posclp ) { cdCanvasVertex (intcgm_canvas, cgm_vdcx2canvas(sample[i] + dx), cgm_vdcy2canvas(y1) ); cdCanvasVertex (intcgm_canvas, cgm_vdcx2canvas(posclp + dx), cgm_vdcy2canvas(interpl(i,y1,y2,posclp)) ); } else if ( sample[i]>posclp && sample[i+1]negclp ) cdCanvasVertex (intcgm_canvas, cgm_vdcx2canvas(posclp + dx), cgm_vdcy2canvas(interpl(i,y1,y2,posclp)) ); else if ( sample[i]>posclp && sample[i+1]negclp && sample[i] 7 ) coind = (long *) malloc ( n_samp*sizeof(long) ); for ( i=0; i= 64 ) mode = 64; else if ( trace_mode >= 32 ) mode = 32; else if ( trace_mode >= 16 ) mode = 16; else if ( trace_mode >= 8 ) mode = 8; else if ( trace_mode >= 4 ) mode = 4; else if ( trace_mode >= 2 ) mode = 2; else if ( trace_mode == 1 ) mode = 1; switch ( mode ) { case 64: neg_clp = neg_clp_lmt; pos_clp = ( pos_clp_lmt < 0 ) ? pos_clp_lmt : 0; vasamp ( mode, pos_clp, neg_clp, 1 ); trace_mode -= 64; break; case 32: neg_clp = ( neg_clp_lmt > 0 ) ? neg_clp_lmt : 0; pos_clp = pos_clp_lmt; vasamp ( mode, pos_clp, neg_clp, 1 ); trace_mode -= 32; break; case 16: bgclfl( mode ); trace_mode -= 16; break; case 8: bgclfl( mode ); trace_mode -= 8; break; case 4: neg_clp = ( neg_clp_lmt > 0 ) ? neg_clp_lmt : 0; pos_clp = pos_clp_lmt; vasamp ( mode, pos_clp, neg_clp, 0 ); trace_mode -= 4; break; case 2: neg_clp = ( neg_clp_lmt > 0 ) ? neg_clp_lmt : 0; pos_clp = pos_clp_lmt; vasamp ( mode, pos_clp, neg_clp, 0 ); trace_mode -= 2; break; case 1: wiggle ( pos_clp_lmt, neg_clp_lmt ); trace_mode -= 1; break; } } while ( trace_mode != 0 ); free(sample); if ( trace_dsp_md > 7 ) free(coind); }