void wgem_gtext( char *sys, float *x, float *y, char *cchar, float *rotat, int *ixoff, int *iyoff, int *iret ) /************************************************************************ * wgem_gtext * * * * This function is a wrapper for gtext. * * * * void wgem_gtext( sys, x, y, cchar, rotat, ixoff, iyoff, iret ) * * * * Input parameters: * * *sys char coordinate system * * *x float X coordinates / lats * * *y float Y coordinates / lons * * *cchar char text string to plot * * *rotat float rotation angle in degrees * * *ixoff int X offest in half characters * * *iyoff int Y offest in half characters * * * * Output parameters: * * *iret int return code * ** * * Log: * * E. Safford/SAIC 12/07 initial coding * ***********************************************************************/ { gtext( sys, x, y, cchar, rotat, ixoff, iyoff, iret, strlen( sys ), strlen( cchar ) ); }
int main() { char linebuf[MAXTEXT], name[NAMESIZE]; FILE *infile[MERGEORDER]; FILE *outfile; char *lineptr[MAXPTR]; int nlines, t, outlow, outhigh, mergelow, mergehigh; outlow = 1; mergelow = outlow + N; mergehigh = mergelow-1; for (;;) { /* * Read chunks from stdin and write to files outlow...outhigh. */ for (outhigh = outlow; outhigh < outlow+N; outhigh++) { t = gtext(lineptr, MAXPTR, linebuf, MAXTEXT, &nlines, stdin); qsort(lineptr, nlines, sizeof(lineptr[0]), qcmpstr); outfile = makefile(outhigh); ptext(lineptr, nlines, outfile); fclose(outfile); if (t == EOF) break; } if (outhigh >= outlow+N) outhigh--; /* * Merge files outlow...outhigh to mergehigh. */ gopen(infile, outlow, outhigh); ++mergehigh; outfile = makefile(mergehigh); merge(infile, outhigh-outlow+1, outfile); fclose(outfile); /* * If the merge group is full, merge them to outlow and exchange * merge group and sorting group. */ if (mergehigh-mergelow+1 >= N) { gopen(infile, mergelow, mergehigh); outfile = makefile(outlow); merge(infile, mergehigh-mergelow+1, outfile); fclose(outfile); swap(&outlow, &mergelow); mergehigh = mergelow; } if (t == EOF) break; } gopen(infile, mergelow, mergehigh); merge(infile, mergehigh-mergelow+1, stdout); gopen(infile, 1, 2*N); gremove(infile, 1, 2*N); return 0; }
static void draw_1_browse(int x, int y, struct name_list *el) { char rname[16]; cblock(vf.p,x-2-4,y,71+8,49,sblack); bro_frame(x,y,swhite); if (el != NULL) { strcpy(rname, el->name); if (rname[0] != '\\' && rname[0] != 0) { postage_stamp(x+1,y+1,el->name); cut_suffix(rname, ".FLI"); } gtext(rname, x + (65 - CH_WIDTH*strlen(rname))/2, y+42, swhite); } }
void display_non_protect_row() { int temp; #ifdef kdkddkkdkkdkk temp = gtext_buffer_index; if(gtext_buffer_index > 0) { gtext_buffer[gtext_buffer_index] = '\0'; gtext_buffer_index = 0; set_message_viewport(); wrmask(0xff); move2((new_text_col + col_offset)*CHAR_WIDTH + W_LEFT - 9, W_TOP - (new_text_row + row_offset)*CHAR_HEIGHT - 10); color(BACK_COLOR); if(gtext_buffer[1] != '\0') /* clear the row out fully */ { boxr(CHAR_WIDTH*30,CHAR_HEIGHT); } else /* clear this character */ boxr(CHAR_WIDTH,CHAR_HEIGHT); color(FORE_COLOR); move2((new_text_col + col_offset)*CHAR_WIDTH + W_LEFT, W_TOP - (new_text_row + row_offset)*CHAR_HEIGHT); gtext(gtext_buffer); wrmask(io_masks[which_page]); restore_graphics_viewport(); } #endif }
/* * compound statement * * allow any number of statements to fall between "{" and "}" * * 'func' is true if we are in a "function_statement", which * must contain "statement_list" */ void compound (INTPTR_T func) { int decls; decls = YES; ncmp++; while (!match ("}")) { if (feof (input)) return; if (decls) { if (!stdecl ()) { decls = NO; gtext (); } } else stst (); } ncmp--; }
void codgen(Node *n, Node *nn) { Prog *sp; Node *n1, nod, nod1; cursafe = 0; curarg = 0; maxargsafe = 0; /* * isolate name */ for(n1 = nn;; n1 = n1->left) { if(n1 == Z) { diag(nn, "cant find function name"); return; } if(n1->op == ONAME) break; } nearln = nn->lineno; p = gtext(n1->sym, stkoff); sp = p; /* * isolate first argument */ if(REGARG >= 0) { if(typesuv[thisfn->link->etype]) { nod1 = *nodret->left; nodreg(&nod, &nod1, REGARG); gmove(&nod, &nod1); } else if(firstarg && typechlp[firstargtype->etype]) { nod1 = *nodret->left; nod1.sym = firstarg; nod1.type = firstargtype; nod1.xoffset = align(0, firstargtype, Aarg1, nil); nod1.etype = firstargtype->etype; nodreg(&nod, &nod1, REGARG); gmove(&nod, &nod1); } } retok = 0; canreach = 1; warnreach = 1; gen(n); if(canreach && thisfn->link->etype != TVOID) diag(Z, "no return at end of function: %s", n1->sym->name); noretval(3); gbranch(ORETURN); if(!debug['N'] || debug['R'] || debug['P']) regopt(sp); if(thechar=='6' || thechar=='7') /* [sic] */ maxargsafe = xround(maxargsafe, 8); sp->to.offset += maxargsafe; }
void Meta::replay (void *ps, int clip) /* Redraw the graphics as noted in notespace */ { Active=0; char *p=Start; double c,r,c1,r1,cc[16],hue; int col,st,width,n,i,co[16]; while (p<End) { int command=nextcommand(p); switch(command) { case 1 : gclear(p); break; case 2 : c=nextlong(p); r=nextlong(p); c1=nextlong(p); r1=nextlong(p); if (clip) gclip(ps,c,r,c1,r1); break; case 10 : c=nextlong(p); r=nextlong(p); c1=nextlong(p); r1=nextlong(p); col=nextint(p); st=nextint(p); width=nextint(p); gline(ps,c,r,c1,r1,col,st,width); break; case 20 : c=nextlong(p); r=nextlong(p); col=nextint(p); st=nextint(p); gmarker(ps,c,r,col,st); break; case 30 : n=nextint(p); for (i=0; i<n; i++) { cc[2*i]=nextlong(p); cc[2*i+1]=nextlong(p); co[i]=nextint(p); } st=nextint(p); gfill(ps,cc,st,n,co); break; case 31 : for (i=0; i<8; i++) cc[i]=nextlong(p); hue=nextlong(p); col=nextint(p); st=nextint(p); gfillh(ps,cc,hue,col,st); break; case 32 : c=nextlong(p); r=nextlong(p); c1=nextlong(p); r1=nextlong(p); hue=nextlong(p); col=nextint(p); st=nextint(p); gbar(ps,c,r,c1,r1,hue,col,st); break; case 33 : c=nextlong(p); r=nextlong(p); c1=nextlong(p); r1=nextlong(p); col=nextint(p); st=nextint(p); gbar1(ps,c,r,c1,r1,col,st); break; case 40 : c=nextlong(p); r=nextlong(p); col=nextint(p); st=nextint(p); gtext(ps,c,r,p,col,st); p+=strlen(p)+1; break; case 41 : c=nextlong(p); r=nextlong(p); col=nextint(p); st=nextint(p); gvtext(ps,c,r,p,col,st); p+=strlen(p)+1; break; case 42 : c=nextlong(p); r=nextlong(p); col=nextint(p); st=nextint(p); gvutext(ps,c,r,p,col,st); p+=strlen(p)+1; break; case 50 : nextlong(p); break; default : Active=1; return; } } Active=1; }
void gg_rtrk ( char *filtyp, char *filnam, char *stime, char *etime, int *itmclr, int *iskip, int *iret ) /************************************************************************ * gg_rtrk * * * * This routine reads the data from a Altimeter Ground Track Prediction * * file and plots it. * * * * gg_rtrk ( filtyp, filnam, stime, etime, itmclr, iskip, iret ) * * * * * * Input parameters: * * *filtyp char Data type * * *filnam char Data file name * * *stime char Start time of data * * *etime char End time of data * * *itmclr int Time stamp color * * *iskip int Skip value * * * * Output parameters: * * *iret int Return code * ** * * Log: * * G. McFadden/SAIC 12/08 Modeled after gg_qsrd * * S. Jacobs/NCEP 6/10 Removed underscore on function name * ***********************************************************************/ { int ier, incr, itarr[5], iyoff = 0, ixoff = -10, ntime, np2, pcount, gyear, ymd, hm; FILE *fptr; char buffer[256], textstr[8], final_ts[9], ymd_string[7], hm_string[5]; char gempak_dt[12]; char *cp, underscore[2]; float lat, lon, rotat = 0.0F; double dlat, dlon, dalt; size_t two = 2; /*---------------------------------------------------------------------*/ /* * Open the data file. */ fptr = cfl_ropn ( filnam, NULL, &ier ); if ( fptr == NULL || ier != 0 ) { *iret = -1; return; } *iret = 0; underscore[0] = '_'; underscore[1] = '\0'; /* * Set the skip factor. */ if ( *iskip <= 0 ) { incr = 1; } else { incr = *iskip + 1; } pcount = incr; while ( ier == 0 ) { /* * Read this prediction's data. */ cfl_trln( fptr, 256, buffer, &ier ); if ( ier != 0 ) { /* * Bad read...close the file and exit. */ cfl_clos ( fptr, &ier ); return; } /* * Extract this prediction's data. */ sscanf( buffer, "%d %d %d %d %d %lf %lf %lf", &itarr[0], &itarr[1], &itarr[2], &itarr[3], &itarr[4], &dlat, &dlon, &dalt ); lat = (float)dlat; lon = (float)dlon; /* * Get the gempak date/time of this prediction */ gyear = itarr[0] - 2000; ymd = gyear * 10000 + itarr[1] * 100 + itarr[2]; sprintf(ymd_string, "%6.6d", ymd ); hm = itarr[3] * 100 + itarr[4]; sprintf(hm_string, "%4.4d", hm ); gempak_dt[0] = '\0'; strcat(gempak_dt,ymd_string); strcat(gempak_dt,"/"); strcat(gempak_dt,hm_string); /* * The longitude is stored as 0 -> 360. PRNLON will correct the longitude to * the range -180 -> 180. */ np2 = 1; prnlon( &np2, &lon, &ier ); /* * Plot the prediction if it is not skipped and if it is within the valid * time range...plot "DD_HHMM" on the screen. */ ntime = itarr[2] * 10000 + itarr[3] * 100 + itarr[4]; sprintf(textstr, "%6.6d", ntime); final_ts[0] = '\0'; strncpy(final_ts,textstr,two); final_ts[2] = '\0'; strcat(final_ts,underscore); cp = textstr + 2; strcat(final_ts,cp); gscolr ( itmclr, &ier); if ( pcount % incr == 0 && PathTimeCheck( gempak_dt, stime, etime) ) { gtext ( sys_M, &lat, &lon, final_ts, &rotat, &ixoff, &iyoff, &ier, strlen(sys_M), strlen(final_ts) ); } pcount++; } /* * Close the file. */ cfl_clos ( fptr, &ier ); }
void utf_ptext ( int offflg, int shift_x, int shift_y, unsigned char *endof, int zm, unsigned char *ptr, int *add, int *iret ) /************************************************************************ * utf_ptext * * * * This function plots both regular and offset text records C5 and C8 * * from a UTF file. * * * * utf_ptext ( offflg, shift_x, shift_y, endof, zm, ptr, add, iret ) * * * * Input parameters: * * offflg int Offset vs regular text flag * * shift_x int X shift factor * * shift_y int Y shift factor * * *endof unsigned char End of buffer * * zm int Zoom threshold (from user) * * *ptr unsigned char Position in buffer * * * * Output parameters: * * *add int Total number of bytes in record * * *iret int Return code * * * ** * * Log: * * D. Keiser/GSC 12/96 Copied from utf_text * * D. Keiser/GSC 4/97 Corrected turbulence plot * * S. Jacobs/NCEP 4/97 Removed value from turb sym * * D. Keiser/GSC 6/97 Initialized txtwid * * S. Jacobs/NCEP 7/97 Changed font size calculation * * D. Keiser/GSC 7/97 Increased string sizes * * S. Jacobs/NCEP 8/97 Corrected PTND symbol numbers * * M. Linda/GSC 10/97 Corrected the prologue format * * S. Jacobs/NCEP 10/97 Changed the calling seq for gstext * * I. Durham/GSC 5/98 Changed underscore decl. to an include * * S. Jacobs/NCEP 7/98 Changed the font type and size * * A. Hardy/GSC 11/00 renamed coordinate system declarations * ***********************************************************************/ { int len, offset, sign, i, j, delx, dely, ixoff, g, b; int iyoff, spcflg, np, ier, rb, ipnt, pltfil, bytadd; int jpnt, zt, zf, chrsiz, txtwid, fntnum, txtflg, nc; int ipwwid, isktyp, iskwid, iptwid, iwtwid, ictwid; int ispwid, icewid, nchr, textfg, ituwid, numpnt; int idum; float sf, txtsiz, temp, rotat, rx, ry, szsky, szpwth; float rcode, xl, yb, xr, yt, xl2, yb2, xr2; float yt2, xrat, yrat, rdelx, rdely, szptnd, szwthr; float szctyp, szspcl, szicng, szturb, xin[2], yin[2]; float xout[2], yout[2]; unsigned char string[200], *tmpbuf=NULL, outstr[200]; char newstr[200]; int gfunc[] = { 0000, GSKY, GSKY, GSKY, GSKY, GSKY, GSPC, GSPC, 0000, 0000, 0000, 0000, 0000, 0000, GSKY, GSKY, GSKY, 0000, 0000, GSKY, GSKY, GSKY, GPTN, GPTN, GPTN, GPTN, GPTN, GPTN, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GPWX, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GSPC, GSPC, GSPC, GSPC, GSPC, GWTH, GPWX, GWTH, GSPC, GSPC, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GWTH, GSPC, GSPC, GSPC, GWTH, GSPC, GSPC, GSPC, GSPC, GWTH, GWTH, GSPC, GSPC, GSPC, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GCTP, GSPC, GSPC, GTRB, GTRB, GTRB, GICE, GICE, GICE }; int gsym[] = { 0, 6, 7, 8, 9, 10, 0, 8, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 3, 4, 5, 999, 1999, 5999, 6999, 3999, 8999, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 9, 18, 19, 50, 60, 70, 68, 30, 14, 16, 15, 4, 45, 8, 31, 18, 17, 34, 36, 37, 38, 39, 41, 44, 48, 49, 52, 56, 57, 66, 67, 47, 58, 76, 77, 78, 79, 81, 62, 4, 19, 20, 43, 21, 23, 22, 24, 97, 72, 12, 13, 29, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 22, 23, 24, 25, 26, 27, 28, 29, 25, 26, 2, 4, 6, 3, 5, 8 }; /*---------------------------------------------------------------------*/ *iret = 0; sf = 0.25F; temp = 0.8F; fntnum = 21; txtflg = 2; ixoff = 0; iyoff = 0; rotat = 0.0F; delx = 0; dely = 0; txtwid = 1; /* ** Decode the header of the C5 or C8 record. */ utf_dtext( offflg, shift_x, shift_y, zm, endof, ptr, &g, &b, &rb, &zt, &pltfil, &zf, &chrsiz, &ipnt, &jpnt, &len, &bytadd, &ier ); *add = bytadd; ptr += 6; /* ** If offset text record C8, decode delta X and delta Y. */ if ( offflg ) { for ( i = 0; i < 2; i++, ptr++ ) { sign = *ptr & 0x80; offset = *ptr & 0x7f; if ( sign != 0 ) offset -= 0x80; if ( i == 0 ) delx = offset << shift_x; else dely = offset << shift_y; } } /* ** Query MAP and DEVICE bounds and compute X and Y ratios that ** will adjust delta X and delta Y for zooming. Add delta X and ** delta Y to I, J. */ gqbnd( sys_M, &xl, &yb, &xr, &yt, &ier, strlen(sys_M) ); xin[0] = xl; xin[1] = xr; yin[0] = yb; yin[1] = yt; numpnt = 2; gtrans( sys_M, sys_G, &numpnt, xin, yin, xout, yout, &ier, strlen(sys_M), strlen(sys_G) ); gqbnd( sys_D, &xl2, &yb2, &xr2, &yt2, &ier, strlen(sys_D) ); xrat = (xout[1] - xout[0]) / (xr2 - xl2) / 2.0F; yrat = (yout[1] - yout[0]) / (yb2 - yt2) / 2.0F; rx = (float) ipnt; ry = (float) jpnt; rdelx = (float) delx; rdely = (float) dely; rx = rx + (rdelx + 3.0F) * xrat; ry = ry + (rdely + 15.0F) * yrat; spcflg = G_FALSE; textfg = G_FALSE; nchr = 0; /* ** Traverse string of characters, plotting only if plot filter is true. */ while ( (*ptr < 128) && (ptr < endof) ) { if ( pltfil ) { /* ** If a cursor moving character is encountered and textfg is ** TRUE, build string from buffer and pass into GTEXT to be ** plotted. */ if ( ( *ptr == 18 ) || (( *ptr >= 8 ) && ( *ptr <= 13 ) ) ) { if ( textfg ) { j = 0; for ( i = 0; i < nchr; i++, tmpbuf++) { if ( ( *tmpbuf >= 32 ) && ( *tmpbuf < 127 ) ) { string[j] = *tmpbuf; j++; } } string[j] = CHNULL; if ( chrsiz < 3 ) { txtsiz = 1.000F; } else { txtsiz = 1.714F; } idum = 0; gstext( &fntnum, &txtflg, &txtsiz, &txtwid, &idum, &idum, &idum, &ier ); cst_unpr( (char *)string, (char *)outstr, &ier ); strcpy(newstr, (char *) outstr); cst_lstr( newstr, &nc, &ier ); if ( nc > 0 ) { gtext( sys_G, &rx, &ry, newstr, &rotat, &ixoff, &iyoff, &ier, strlen(sys_G), strlen(newstr) ); ixoff = nc * 3; } textfg = G_FALSE; nchr = 0; } /* ** Check for special characters and set appropriate GEMPAK ** offsets. */ switch(*ptr) { /* ** Back space. */ case 8: ixoff -= 2; break; /* ** Forward space. */ case 9: ixoff += 2; break; /* ** Down space. */ case 10: iyoff -= 2; break; /* ** Up space. */ case 11: iyoff += 2; break; /* ** New Line (1.5). */ case 12: ixoff = 0; iyoff -= 3; break; /* ** New Line (1.0). */ case 13: ixoff = 0; iyoff -= 2; break; /* ** Set special character flag. */ case 18: spcflg = G_TRUE; break; } } /* ** If a reset to regular character mode character is ** encountered, set the special character flag back to FALSE. */ else if ( *ptr == 17 ) { spcflg = G_FALSE; } /* ** If a special character is encountered, check it against the ** symbol array, and plot it according to which symbol code it ** represents. */ else { if ( spcflg ) { np = 1; switch (gfunc[*ptr]) { /* ** Sky cover. */ case GSKY: isktyp = 0; iskwid = 0; szsky = temp + ((float) chrsiz*sf) - 0.05F; rcode = (float) gsym[*ptr]; gssky( &szsky, &isktyp, &iskwid, &ier ); gsky( sys_G, &np, &rcode, &rx, &ry, &ixoff, &iyoff, &ier, strlen(sys_G) ); break; /* ** Past weather. */ case GPWX: ipwwid = 0; szpwth = temp + ((float) chrsiz*sf); rcode = (float) gsym[*ptr]; gspwth( &szpwth, &ipwwid, &ier ); gpwth( sys_G, &np, &rcode, &rx, &ry, &ixoff, &iyoff, &ier, strlen(sys_G) ); break; /* ** Pressure tendency. */ case GPTN: iptwid = 0; szptnd = temp + ((float) chrsiz*sf); rcode = (float) gsym[*ptr]; gsptnd( &szptnd, &iptwid, &ier ); gptnd( sys_G, &np, &rcode, &rx, &ry, &ixoff, &iyoff, &ier, strlen(sys_G) ); break; /* ** WMO weather symbols. */ case GWTH: iwtwid = 0; if ( gsym[*ptr] == 70 || gsym[*ptr] == 72 ) szwthr = temp + ((float) chrsiz*sf) + 0.5F; else szwthr = temp + ((float) chrsiz*sf); rcode = (float) gsym[*ptr]; gswthr( &szwthr, &iwtwid, &ier ); gwthr( sys_G, &np, &rcode, &rx, &ry, &ixoff, &iyoff, &ier, strlen(sys_G) ); break; /* ** Cloud type. */ case GCTP: ictwid = 0; szctyp = temp + ((float) chrsiz*sf); rcode = (float) gsym[*ptr]; gsctyp( &szctyp, &ictwid, &ier ); gctyp( sys_G, &np, &rcode, &rx, &ry, &ixoff, &iyoff, &ier, strlen(sys_G) ); break; /* ** Special symbols. */ case GSPC: ispwid = 0; if ( gsym[*ptr] == 12 || gsym[*ptr] == 13 ) szspcl = temp + ((float) chrsiz*sf) - 0.3F; else if ( gsym[*ptr] == 0 ) szspcl = temp + ((float) chrsiz*sf) - 0.4F; else szspcl = temp + ((float) chrsiz*sf); rcode = (float) gsym[*ptr]; gsspcl( &szspcl, &ispwid, &ier ); gspcl( sys_G, &np, &rcode, &rx, &ry, &ixoff, &iyoff, &ier, strlen(sys_G) ); break; /* ** Turbulence. */ case GTRB: ituwid = 0; szturb = temp + ((float) chrsiz*sf) - 0.5F; rcode = (float) gsym[*ptr]; gsturb( &szturb, &ituwid, &ier ); gturb( sys_G, &np, &rcode, &rx, &ry, &ixoff, &iyoff, &ier, strlen(sys_G) ); break; /* ** Icing. */ case GICE: icewid = 0; szicng = temp + ((float) chrsiz*sf) - 0.5F; rcode = (float) gsym[*ptr]; gsicng( &szicng, &icewid, &ier ); gicng( sys_G, &np, &rcode, &rx, &ry, &ixoff, &iyoff, &ier, strlen(sys_G) ); break; } ixoff += 2; } /* ** If textfg is FALSE, place character in buffer to be used ** in later building the string to plot. */ else { if ( !textfg ) { tmpbuf = ptr; textfg = G_TRUE; } nchr++; } } } ptr++; } /* ** Build string from buffer and pass into GTEXT to be plotted. */ if ( textfg ) { if ( pltfil ) { j = 0; for ( i = 0; i < nchr; i++, tmpbuf++) { if ( ( *tmpbuf >= 32 ) && ( *tmpbuf < 127 ) ) { string[j] = *tmpbuf; j++; } } string[j] = CHNULL; if ( chrsiz < 3 ) { txtsiz = 1.000F; } else { txtsiz = 1.714F; } idum = 0; gstext( &fntnum, &txtflg, &txtsiz, &txtwid, &idum, &idum, &idum, &ier ); cst_unpr( (char *)string, (char *)outstr, &ier ); strcpy(newstr, (char *) outstr); cst_lstr( newstr, &nc, &ier ); if ( nc > 0 ) { gtext( sys_G, &rx, &ry, newstr, &rotat, &ixoff, &iyoff, &ier, strlen(sys_G), strlen(newstr) ); ixoff = nc * 3; } textfg = G_FALSE; nchr = 0; } } }
void radar_info(rad_struct RADARS[], int NEXSTNS) { int i,j,np=1,iret; float x,y,sped,drct; float rotat=0; float rwmrk, rhmrk, rwtxt, rhtxt, rwbrb, rhbrb; int ixoff=0,iyoff=0; char plotstr[8]; float nx[1], ny[1], gx[1], gy[1]; char gcord[]="G", ncord[]="N"; char NEstr[] = "NE"; char OMstr[] = "OM"; char NAstr[] = "NA"; cntr_struct *next_cntr; int *dataptr; gqsysz ( &rwmrk, &rhmrk, &rwtxt, &rhtxt, &rwbrb, &rhbrb, &iret); if(radinfo_col > 0) { gscolr(&radinfo_col,&iret); for(i=0;i<NEXSTNS;i++) { get_xy(RADARS[i].stnlat,RADARS[i].stnlon,&x,&y); if(RADARS[i].mode == MDNE) gtext(gcord,&x,&y,NEstr,&rotat,&ixoff,&iyoff,&iret, strlen(gcord),strlen(NEstr)); else if(RADARS[i].mode == MDOM) gtext(gcord,&x,&y,OMstr,&rotat,&ixoff,&iyoff,&iret, strlen(gcord),strlen(OMstr)); else if(RADARS[i].mode == MDNA) gtext(gcord,&x,&y,NAstr,&rotat,&ixoff,&iyoff,&iret, strlen(gcord),strlen(NAstr)); } } if(cntr_col > 0) { gscolr(&cntr_col,&iret); gsbarb(&cntr_sz,&cntr_wid,&cntr_type,&iret); filter_init(); for(i=0;i<NEXSTNS;i++) { for(j=0;j<RADARS[i].ncntr;j++) { get_xy4(RADARS[i].stnlat,RADARS[i].stnlon,RADARS[i].cntr[j].ggg,&x,&y); gx[0] = x + .125; gy[0] = y - .125; gtrans ( gcord, ncord, &np, gx, gy, nx, ny, &iret, strlen(gcord),strlen(ncord)); if((nx[0] >= 0)&&(nx[0] <= 1)&&(ny[0] >= 0)&&(ny[0] <= 1)) n_filter (np, nx, ny, rhbrb, rwbrb, cntr_filter, &(RADARS[i].cntr[j])); } } filter_set_head(); while(filter_retrieve((void *)(&next_cntr), &x, &y)) { sped = next_cntr->spd; drct = next_cntr->dir; gbarb(ncord,&np,&x,&y,&sped,&drct,&iret,strlen(ncord)); } } if(maxtop_col > 0) { gscolr(&maxtop_col,&iret); filter_init(); for(i=0;i<NEXSTNS;i++) { if(RADARS[i].maxtop > 0) { get_xy4(RADARS[i].stnlat,RADARS[i].stnlon,RADARS[i].maxtop_ggg,&x,&y); gx[0] = x + .125; gy[0] = y - .125; gtrans ( gcord, ncord, &np, gx, gy, nx, ny, &iret, strlen(gcord),strlen(ncord)); /* char string is 3 characters */ if((nx[0] >= 0)&&(nx[0] <= 1)&&(ny[0] >= 0)&&(ny[0] <= 1)) n_filter (np, nx, ny, rhtxt, rwtxt*2.7, maxtop_filter, &(RADARS[i].maxtop) ); } } ixoff = 0; iyoff = 0; rotat = 0; filter_set_head(); while(filter_retrieve((void *)(&dataptr), &x, &y)) { sprintf(plotstr,"%03d\0",*dataptr); gtextc(ncord,&x,&y,plotstr,&rotat,&ixoff,&iyoff,&iret, strlen(ncord),strlen(plotstr)); } } if(meso_col > 0) { gscolr(&meso_col,&iret); gsmrkr(&meso_mark,&meso_hw,&meso_sz,&meso_wid,&iret); filter_init(); for(i=0;i<NEXSTNS;i++) { for(j=0;j<RADARS[i].nmeso;j++) { get_xy4(RADARS[i].stnlat,RADARS[i].stnlon,RADARS[i].meso[j].ggg,&x,&y); gx[0] = x + .125; gy[0] = y - .125; gtrans ( gcord, ncord, &np, gx, gy, nx, ny, &iret, strlen(gcord),strlen(ncord)); if((nx[0] >= 0)&&(nx[0] <= 1)&&(ny[0] >= 0)&&(ny[0] <= 1)) n_filter (np, nx, ny, rhmrk, rwmrk, meso_filter, NULL); RADARS[i].meso[j].nx = nx[0]; RADARS[i].meso[j].ny = ny[0]; } } filter_set_head(); while(filter_retrieve((void *)(&dataptr), &x, &y)) { gmark(ncord,&np,&x,&y,&iret,strlen(ncord)); } } if(tvs_col > 0) { gscolr(&tvs_col,&iret); gsmrkr(&tvs_mark,&tvs_hw,&tvs_sz,&tvs_wid,&iret); filter_init(); for(i=0;i<NEXSTNS;i++) { for(j=0;j<RADARS[i].ntvs;j++) { get_xy4(RADARS[i].stnlat,RADARS[i].stnlon,RADARS[i].tvs[j].ggg,&x,&y); gx[0] = x + .125; gy[0] = y - .125; gtrans ( gcord, ncord, &np, gx, gy, nx, ny, &iret, strlen(gcord),strlen(ncord)); if((nx[0] >= 0)&&(nx[0] <= 1)&&(ny[0] >= 0)&&(ny[0] <= 1)) n_filter (np, nx, ny, rhmrk, rwmrk, tvs_filter, NULL); RADARS[i].tvs[j].nx = nx[0]; RADARS[i].tvs[j].ny = ny[0]; } } filter_set_head(); while(filter_retrieve((void *)(&dataptr), &x, &y)) { gmark(ncord,&np,&x,&y,&iret,strlen(ncord)); } } }
void cds_sig ( VG_DBStruct *el, int indx, int *iret ) /************************************************************************ * cds_sig * * * * This function displays SIGMETs to the output device. * * * * cds_sig (el, indx, iret) * * * * Input parameters: * * *el VG_DBStruct Pointer to VG record structure * * indx int Index into user attribute table * * * * Output parameters: * * *iret int Return code * * * ** * * Log: * * D.W.Plummer/NCEP 7/99 Copied from cds_line * * D.W.Plummer/NCEP 9/99 Compute circle from element distance; * * Compute line extension area * * H. Zeng/EAI 9/99 Preserve plot attributes * * F. J. Yen/NCEP 10/99 Handled user attribute table * * M. Li/GSC 10/99 Modified clo_direct and clo_dltln codes * * D.W.Plummer/NCEP 12/99 Added plotting of sequence number * * M. Li/GSC 1/00 Used string variables in gtrans * * S. Law/GSC 05/00 changed to use MAX_SIGMET for lat/lon * * H. Zeng/EAI 06/00 increased the sizes of lat&lon arrays * * A. Hardy/GSC 11/00 renamed coordinate system declarations * * M. Li/SAIC 01/03 delete vgstruct.h * * T. Piper/SAIC 12/05 redone with new Setting_t structure * ***********************************************************************/ { int ii, kk, npts, np, intrsct, ier; int mtype, color, width, lintyp, lthw, lwhw, mkhw, two; int iltypx, ilthwx, iwidthx, iwhwx, icolrx, imarkx, imkhwx, imkwidx; char str[4]; float lat[MAX_SIGMET*2+3], lon[MAX_SIGMET*2+3]; float size, dist, dir, ang1, ang2; float dirs[]={ 0.0F, 180.0F, 90.0F, 270.0F }; float s1lat[2], s1lon[2], s2lat[2], s2lon[2]; float x1[2], y1[2], x2[2], y2[2]; float xint, yint; float szmarkx; float lbllat, lbllon, rotat=0.0F; int ixoff=0, iyoff=2; int itxfn_s, itxhw_s, itxwid_s, ibrdr_s, irrotn_s, ijust_s; float sztext_s; int itxfn, itxhw, itxwid, ibrdr, irrotn, ijust; float sztext; SigmetType *psig; /*---------------------------------------------------------------------*/ *iret = 0; /* * Save plot attributes. */ gqcolr ( &icolrx, &ier ); gqline ( &iltypx, &ilthwx, &iwidthx, &iwhwx, &ier ); gqmrkr ( &imarkx, &imkhwx, &szmarkx, &imkwidx, &ier ); /* * setup basic information */ psig = &(el->elem.sig); width = (int) (( ( cdsUattr[indx].info.sig->linwid == 0 ) ? (float)psig->info.linwid : (float)cdsUattr[indx].info.sig->linwid) * cdsLineWdth); lintyp = ( cdsUattr[indx].info.sig->lintyp == 0 ) ? psig->info.lintyp : cdsUattr[indx].info.sig->lintyp; lthw = 0; lwhw = 0; mtype = 1; mkhw = 0; size = 1.0F; np = psig->info.npts; gsline (&lintyp, <hw, &width, &lwhw, &ier); color = (cdsColor == 0) ? ( ( cdsUattr[indx].maj_col == 0 ) ? el->hdr.maj_col : cdsUattr[indx].maj_col ) : cdsColor; gscolr (&color, &ier); switch ( psig->info.subtype ) { case SIGTYP_ISOL: /* isolated */ /* * Plot marker w/ surrounding circle */ lat[0] = psig->latlon[0]; lon[0] = psig->latlon[np]; gsmrkr ( &mtype, &mkhw, &size, &width, &ier ); gmark ( sys_M, &np, lat, lon, &ier, strlen(sys_M) ); if ( !G_DIFF(psig->info.distance, 0.0F ) ) { dir = ( lat[0] >= 0.F ) ? 180.F : 0.F; dist = psig->info.distance * NM2M; clo_dltln ( &lat[0], &lon[0], &dist, &dir, &(lat[1]), &(lon[1]), &ier ); np = 18; gcircl ( sys_M, lat, lon, &(lat[1]), &(lon[1]), &np, &ier, strlen(sys_M) ); } break; case SIGTYP_LINE: /* line */ for ( ii = 0; ii < np; ii++ ) { lat[ii] = psig->latlon[ii]; lon[ii] = psig->latlon[ii+np]; } gline ( sys_M, &np, lat, lon, &ier, strlen(sys_M) ); if ( !G_DIFF(psig->info.distance, 0.0F) ) { lintyp = 2; gsline (&lintyp, <hw, &width, &lwhw, &ier); dist = psig->info.distance * NM2M; switch ( psig->info.sol ) { case SIGLINE_NOF: case SIGLINE_SOF: case SIGLINE_EOF: case SIGLINE_WOF: npts = 1; for ( ii = 0; ii < np; ii++ ) { clo_dltln ( &(psig->latlon[ii]), &(psig->latlon[ii+np]), &dist, &(dirs[psig->info.sol-1]), &(lat[npts]), &(lon[npts]), &ier ); npts++; } lat[npts] = psig->latlon[np-1]; lon[npts] = psig->latlon[2*np-1]; npts++; gline ( sys_M, &npts, lat, lon, &ier, strlen(sys_M) ); break; case SIGLINE_ESOL: lat[0] = psig->latlon[0]; lon[0] = psig->latlon[np]; clo_direct ( &(psig->latlon[1]), &(psig->latlon[np+1]), &(psig->latlon[0]), &(psig->latlon[np ]), &ang1, &ier ); ang1 -= 90.0F; clo_dltln ( &(psig->latlon[0]), &(psig->latlon[np]), &dist, &ang1, &(lat[2*np+1]), &(lon[2*np+1]), &ier ); ang1 = ang1 - 180.0F; clo_dltln ( &(psig->latlon[0]), &(psig->latlon[np]), &dist, &ang1, &(lat[1]), &(lon[1]), &ier ); ang2 = ang1; two = 2; for ( ii = 1; ii < np-1; ii++ ) { clo_direct ( &(psig->latlon[ii-1]), &(psig->latlon[np+ii-1]), &(psig->latlon[ii]), &(psig->latlon[np+ii]), &ang1, &ier ); ang1 = (float)fmod ( ((double)ang1+270.0), 360.0); clo_dltln ( &(psig->latlon[ii]), &(psig->latlon[np+ii]), &dist, &ang1, &(s1lat[1]), &(s1lon[1]), &ier ); clo_direct ( &(psig->latlon[ii+1]), &(psig->latlon[np+ii+1]), &(psig->latlon[ii]), &(psig->latlon[np+ii]), &ang2, &ier ); ang2 = (float)fmod ( ((double)ang2+90.0), 360.0); clo_dltln ( &(psig->latlon[ii]), &(psig->latlon[np+ii]), &dist, &ang2, &(s2lat[0]), &(s2lon[0]), &ier ); if ( G_ABS(ang1-ang2) > 1.F ) { clo_dltln ( &(psig->latlon[ii-1]), &(psig->latlon[np+ii-1]), &dist, &ang1, &(s1lat[0]), &(s1lon[0]), &ier ); clo_dltln ( &(psig->latlon[ii+1]), &(psig->latlon[np+ii+1]), &dist, &ang2, &(s2lat[1]), &(s2lon[1]), &ier ); gtrans ( sys_M, sys_N, &two, s1lat, s1lon, x1, y1, &ier, strlen(sys_M), strlen(sys_N) ); gtrans ( sys_M, sys_N, &two, s2lat, s2lon, x2, y2, &ier, strlen(sys_M), strlen(sys_N) ); cgr_segint( sys_N, x1, y1, sys_N, x2, y2, sys_M, &xint, &yint, &intrsct, &ier ); } else { xint = (s1lat[1] + s2lat[0]) / 2.0F; yint = (s1lon[1] + s2lon[0]) / 2.0F; } kk = ii + 1; lat[kk] = xint; lon[kk] = yint; ang1 = (float)fmod ( ((double)ang1+180.0), 360.0 ); ang2 = (float)fmod ( ((double)ang2+180.0), 360.0 ); clo_dltln ( &(psig->latlon[ii]), &(psig->latlon[np+ii]), &dist, &ang1, &(s1lat[1]), &(s1lon[1]), &ier ); clo_dltln ( &(psig->latlon[ii]), &(psig->latlon[np+ii]), &dist, &ang2, &(s2lat[0]), &(s2lon[0]), &ier ); if ( G_ABS(ang1-ang2) > 1.F ) { clo_dltln ( &(psig->latlon[ii-1]), &(psig->latlon[np+ii-1]), &dist, &ang1, &(s1lat[0]), &(s1lon[0]), &ier ); clo_dltln ( &(psig->latlon[ii+1]), &(psig->latlon[np+ii+1]), &dist, &ang2, &(s2lat[1]), &(s2lon[1]), &ier ); gtrans ( sys_M, sys_N, &two, s1lat, s1lon, x1, y1, &ier, strlen(sys_M), strlen(sys_N) ); gtrans ( sys_M, sys_N, &two, s2lat, s2lon, x2, y2, &ier, strlen(sys_M), strlen(sys_N) ); cgr_segint( sys_N, x1, y1, sys_N, x2, y2, sys_M, &xint, &yint, &intrsct, &ier ); } else { xint = (s1lat[1] + s2lat[0]) / 2.0F; yint = (s1lon[1] + s2lon[0]) / 2.0F; } kk = 2*np - ii + 1; lat[kk] = xint; lon[kk] = yint; ang1 = (float)fmod ( ((double)ang1+180.0), 360.0 ); ang2 = (float)fmod ( ((double)ang2+180.0), 360.0 ); ang1 = ang2; } clo_direct ( &(psig->latlon[np-2]), &(psig->latlon[2*np-2]), &(psig->latlon[np-1]), &(psig->latlon[2*np-1]), &ang2, &ier ); ang2 -= 90.0F; clo_dltln ( &(psig->latlon[np-1]), &(psig->latlon[2*np-1]), &dist, &ang2, &(lat[np]), &(lon[np]), &ier ); ang2 = (float)fmod ( ((double)ang2+180.0), 360.0); clo_dltln ( &(psig->latlon[np-1]), &(psig->latlon[2*np-1]), &dist, &ang2, &(lat[np+2]), &(lon[np+2]), &ier ); lat[np+1] = psig->latlon[np-1]; lon[np+1] = psig->latlon[2*np-1]; lat[2*np+2] = lat[0]; lon[2*np+2] = lon[0]; npts = 2*np + 3; gline ( sys_M, &npts, lat, lon, &ier, strlen(sys_M) ); break; } } break; case SIGTYP_AREA: /* area */ for ( ii = 0; ii < np; ii++ ) { lat[ii] = psig->latlon[ii]; lon[ii] = psig->latlon[ii+np]; } lat[np] = psig->latlon[0]; lon[np] = psig->latlon[np]; np++; gline ( sys_M, &np, lat, lon, &ier, strlen(sys_M) ); break; } if ( el->hdr.vg_type == SIGCONV_ELM || el->hdr.vg_type == SIGOUTL_ELM ) { if ( el->hdr.vg_type == SIGCONV_ELM ) sprintf( str, "%d%c", psig->info.seqnum, psig->info.msgid[0] ); else if ( el->hdr.vg_type == SIGOUTL_ELM ) sprintf( str, "%d", psig->info.seqnum ); np = psig->info.npts; lbllat = psig->latlon[0]; lbllon = psig->latlon[np]; for ( ii = 1; ii < np; ii++ ) { if ( psig->latlon[ii] > lbllat ) { lbllat = psig->latlon[ii]; lbllon = psig->latlon[ii+np]; } } gqtext( &itxfn_s, &itxhw_s, &sztext_s, &itxwid_s, &ibrdr_s, &irrotn_s, &ijust_s, &ier ); itxfn = 0; itxhw = 0; sztext = 1.5F; itxwid = 0; ibrdr = 0; irrotn = 0; ijust = 2; gstext( &itxfn, &itxhw, &sztext, &itxwid, &ibrdr, &irrotn, &ijust, &ier ); gtext( sys_M, &lbllat, &lbllon, str, &rotat, &ixoff, &iyoff, &ier, strlen(sys_M), strlen(str) ); gstext( &itxfn_s, &itxhw_s, &sztext_s, &itxwid_s, &ibrdr_s, &irrotn_s, &ijust_s, &ier ); } /* * Restore the saved plot attribute values */ gsmrkr ( &imarkx, &imkhwx, &szmarkx, &imkwidx, &ier ); gsline ( &iltypx, &ilthwx, &iwidthx, &iwhwx, &ier ); gscolr ( &icolrx, &ier ); }