static void ps_letter(struct termp *p, int arg) { char cc, c; /* LINTED */ c = arg >= 128 || arg <= 0 ? '?' : arg; /* * State machine dictates whether to buffer the last character * or not. Basically, encoded words are detected by checking if * we're an "8" and switching on the buffer. Then we put "8" in * our buffer, and on the next charater, flush both character * and buffer. Thus, "regular" words are detected by having a * regular character and a regular buffer character. */ if ('\0' == p->ps->last) { assert(8 != c); p->ps->last = c; return; } else if (8 == p->ps->last) { assert(8 != c); p->ps->last = '\0'; } else if (8 == c) { assert(8 != p->ps->last); if ('_' == p->ps->last) { if (p->ps->lastf != TERMFONT_UNDER) { ps_pclose(p); ps_setfont(p, TERMFONT_UNDER); } } else if (p->ps->lastf != TERMFONT_BOLD) { ps_pclose(p); ps_setfont(p, TERMFONT_BOLD); } p->ps->last = c; return; } else { if (p->ps->lastf != TERMFONT_NONE) { ps_pclose(p); ps_setfont(p, TERMFONT_NONE); } cc = p->ps->last; p->ps->last = c; c = cc; } ps_pletter(p, c); }
static void ps_fclose(struct termp *p) { /* * Strong closure: if we have a last-char, spit it out after * checking that we're in the right font mode. This will of * course open a new scope, if applicable. * * Following this, close out any scope that's open. */ if ('\0' != p->ps->last) { if (p->ps->lastf != TERMFONT_NONE) { ps_pclose(p); ps_setfont(p, TERMFONT_NONE); } ps_pletter(p, p->ps->last); p->ps->last = '\0'; } if ( ! (PS_INLINE & p->ps->flags)) return; ps_pclose(p); }
void ps_label( char * s ) { int is ; char c ; if (inpath) ps_stroke() ; if (!ttcur) fprintf( psfile , "%d %d M\n",cx,cy); if (!font) font=ps_setfont(); fprintf( psfile , "("); for( is=0,c=s[is] ; (c!='\0')&&(c!='\n') ; ++is,c=s[is] ) { if (c=='(' || c==')' || c=='\\')putchar('\\'); putchar(c); } fprintf( psfile , ") T\n"); ttcur=plot=1; atcur=inpath=0; }
static void ps_begin(struct termp *p) { time_t t; int i; /* * Print margins into margin buffer. Nothing gets output to the * screen yet, so we don't need to initialise the primary state. */ if (p->ps->psmarg) { assert(p->ps->psmargsz); p->ps->psmarg[0] = '\0'; } /*p->ps->pdfbytes = 0;*/ p->ps->psmargcur = 0; p->ps->flags = PS_MARGINS; p->ps->pscol = p->ps->left; p->ps->psrow = p->ps->header; ps_setfont(p, TERMFONT_NONE); (*p->headf)(p, p->argf); (*p->endline)(p); p->ps->pscol = p->ps->left; p->ps->psrow = p->ps->footer; (*p->footf)(p, p->argf); (*p->endline)(p); p->ps->flags &= ~PS_MARGINS; assert(0 == p->ps->flags); assert(p->ps->psmarg); assert('\0' != p->ps->psmarg[0]); /* * Print header and initialise page state. Following this, * stuff gets printed to the screen, so make sure we're sane. */ t = time(NULL); if (TERMTYPE_PS == p->type) { ps_printf(p, "%%!PS-Adobe-3.0\n"); ps_printf(p, "%%%%CreationDate: %s", ctime(&t)); ps_printf(p, "%%%%DocumentData: Clean7Bit\n"); ps_printf(p, "%%%%Orientation: Portrait\n"); ps_printf(p, "%%%%Pages: (atend)\n"); ps_printf(p, "%%%%PageOrder: Ascend\n"); ps_printf(p, "%%%%DocumentMedia: " "Default %zu %zu 0 () ()\n", (size_t)AFM2PNT(p, p->ps->width), (size_t)AFM2PNT(p, p->ps->height)); ps_printf(p, "%%%%DocumentNeededResources: font"); for (i = 0; i < (int)TERMFONT__MAX; i++) ps_printf(p, " %s", fonts[i].name); ps_printf(p, "\n%%%%EndComments\n"); } else { ps_printf(p, "%%PDF-1.1\n"); pdf_obj(p, 1); ps_printf(p, "<<\n"); ps_printf(p, ">>\n"); ps_printf(p, "endobj\n"); for (i = 0; i < (int)TERMFONT__MAX; i++) { pdf_obj(p, (size_t)i + 3); ps_printf(p, "<<\n"); ps_printf(p, "/Type /Font\n"); ps_printf(p, "/Subtype /Type1\n"); ps_printf(p, "/Name /F%zu\n", i); ps_printf(p, "/BaseFont /%s\n", fonts[i].name); ps_printf(p, ">>\n"); } } p->ps->pdfbody = (size_t)TERMFONT__MAX + 3; p->ps->pscol = p->ps->left; p->ps->psrow = p->ps->top; p->ps->flags |= PS_NEWPAGE; ps_setfont(p, TERMFONT_NONE); }
static void ps_letter(struct termp *p, int arg) { size_t savecol, wx; char c; c = arg >= 128 || arg <= 0 ? '?' : arg; /* * When receiving a backspace, merely flag it. * We don't know yet whether it is * a font instruction or an overstrike. */ if (c == '\b') { assert(p->ps->last != '\0'); assert( ! (p->ps->flags & PS_BACKSP)); p->ps->flags |= PS_BACKSP; return; } /* * Decode font instructions. */ if (p->ps->flags & PS_BACKSP) { if (p->ps->last == '_') { switch (p->ps->nextf) { case TERMFONT_BI: break; case TERMFONT_BOLD: p->ps->nextf = TERMFONT_BI; break; default: p->ps->nextf = TERMFONT_UNDER; } p->ps->last = c; p->ps->flags &= ~PS_BACKSP; return; } if (p->ps->last == c) { switch (p->ps->nextf) { case TERMFONT_BI: break; case TERMFONT_UNDER: p->ps->nextf = TERMFONT_BI; break; default: p->ps->nextf = TERMFONT_BOLD; } p->ps->flags &= ~PS_BACKSP; return; } /* * This is not a font instruction, but rather * the next character. Prepare for overstrike. */ savecol = p->ps->pscol; } else savecol = SIZE_MAX; /* * We found the next character, so the font instructions * for the previous one are complete. * Use them and print it. */ if (p->ps->last != '\0') { if (p->ps->nextf != p->ps->lastf) { ps_pclose(p); ps_setfont(p, p->ps->nextf); } p->ps->nextf = TERMFONT_NONE; /* * For an overstrike, if a previous character * was wider, advance to center the new one. */ if (p->ps->pscolnext) { wx = fonts[p->ps->lastf].gly[(int)p->ps->last-32].wx; if (p->ps->pscol + wx < p->ps->pscolnext) p->ps->pscol = (p->ps->pscol + p->ps->pscolnext - wx) / 2; } ps_pletter(p, p->ps->last); /* * For an overstrike, if a previous character * was wider, advance to the end of the old one. */ if (p->ps->pscol < p->ps->pscolnext) { ps_pclose(p); p->ps->pscol = p->ps->pscolnext; } } /* * Do not print the current character yet because font * instructions might follow; only remember it. * For the first character, nothing else is done. * The final character will get printed from ps_fclose(). */ p->ps->last = c; /* * For an overstrike, back up to the previous position. * If the previous character is wider than any it overstrikes, * remember the current position, because it might also be * wider than all that will overstrike it. */ if (savecol != SIZE_MAX) { if (p->ps->pscolnext < p->ps->pscol) p->ps->pscolnext = p->ps->pscol; ps_pclose(p); p->ps->pscol = savecol; p->ps->flags &= ~PS_BACKSP; } else p->ps->pscolnext = 0; }
int main (int argc, char **argv) { GMT_LONG i, symbol = 0, n, n_files = 0, fno; GMT_LONG n_args; GMT_LONG form_s = 0, justify_s = 5; GMT_LONG error = FALSE, nofile = TRUE; GMT_LONG done, greenwich, label_s = FALSE; GMT_LONG change_position = FALSE; GMT_LONG get_position = FALSE, get_size = FALSE, get_symbol = FALSE; GMT_LONG outline_E = FALSE, outline_G = FALSE, outline_F = FALSE; GMT_LONG old_GMT_world_map, skip_if_outside = TRUE; GMT_LONG plot_polS = FALSE, vecS = FALSE, scolor = FALSE, outline_s = FALSE; GMT_LONG def_cpen = FALSE, def_fpen = FALSE, def_tpen = FALSE; GMT_LONG def_gpen = FALSE, def_epen = FALSE, def_spen = FALSE; GMT_LONG hypo = FALSE; double west = 0.0, east = 0.0, south = 0.0, north = 0.0; double plot_x, plot_y, symbol_size = 0.0, symbol_size2; double lon, lat, plot_x0, plot_y0; double new_lon, new_lat, new_plot_x0, new_plot_y0; double radius, ech = 0., azimut, ih, plongement; double c_pointsize = 0.015, fontsize_s = 12.0; double angle_s = 0.0; double azS, sizeS = GMT_d_NaN; double v_width = GMT_d_NaN, h_length = GMT_d_NaN, h_width = GMT_d_NaN, shape; double si, co; char line[BUFSIZ], symbol_type, col[4][GMT_TEXT_LEN]; char pol, *not_used = NULL; char txt_a[GMT_TEXT_LEN],txt_b[GMT_TEXT_LEN],txt_c[GMT_TEXT_LEN], txt_d[GMT_TEXT_LEN]; char stacode[GMT_TEXT_LEN]; FILE *fp = NULL; struct GMT_PEN pen, cpen, fpen, gpen, epen, spen, tpen; struct GMT_FILL fill, ffill, gfill, efill, sfill; struct GMT_FILL black, nofill; argc = (int)GMT_begin (argc, argv); GMT_init_pen (&pen, GMT_PENWIDTH); GMT_init_fill (&nofill, -1, -1, -1); GMT_init_fill (&black, 0, 0, 0); GMT_init_fill (&efill, 250, 250, 250); fill = nofill; ffill = nofill; sfill = nofill; gfill = black; /* Check and interpret the command line arguments */ for (i = 1; !error && i < argc; i++) { if (argv[i][0] == '-') { switch(argv[i][1]) { /* Common parameters */ case 'B': case 'H': case 'J': case 'K': case 'O': case 'P': case 'R': case 'U': case 'V': case 'X': case 'x': case 'Y': case 'y': case 'c': case '\0': error += GMT_parse_common_options (argv[i], &west, &east, &south, &north); break; /* Supplemental parameters */ case 'C': /* New coordinates */ change_position = TRUE; sscanf(&argv[i][2], "%lf/%lf", &new_lon, &new_lat); if(strchr(argv[i], 'W')) { GMT_getpen (strchr(argv[i]+1, 'W')+1, &cpen); def_cpen = TRUE; } if(strchr(argv[i], 'P')) { sscanf(strchr(argv[i]+1, 'P')+1, "%lf", &c_pointsize); } break; case 'D': /* Coordinates */ get_position = TRUE; sscanf(&argv[i][2], "%lf/%lf", &lon, &lat); break; case 'E': /* Set color for station in extensive part */ GMT_getfill (&argv[i][2], &efill); break; case 'e': /* Outline station symbol in extensive part */ outline_E = TRUE; if(strlen(argv[i]) > 2) { GMT_getpen (&argv[i][2], &epen); def_epen = TRUE; } break; case 'F': /* Set background color of beach ball */ GMT_getfill (&argv[i][2], &ffill); break; case 'f': /* Outline beach ball */ outline_F = TRUE; if(strlen(argv[i]) > 2) { GMT_getpen (&argv[i][2], &fpen); def_fpen = TRUE; } break; case 'G': /* Set color for station in compressive part */ GMT_getfill (&argv[i][2], &gfill); break; case 'g': /* Outline station symbol in compressive part */ outline_G = TRUE; if(strlen(argv[i]) > 2) { GMT_getpen (&argv[i][2], &gpen); def_gpen = TRUE; } break; case 'h': /* Use HYPO71 format */ hypo = TRUE; break; case 'M': /* Focal sphere size */ get_size = TRUE; sscanf(&argv[i][2], "%s", txt_a); ech = GMT_convert_units (txt_a, GMT_INCH); break; case 'N': /* Do not skip points outside border */ skip_if_outside = FALSE; break; case 'S': /* Get symbol [and size] */ symbol_type = argv[i][2]; symbol_size = GMT_convert_units (&argv[i][3], GMT_INCH); get_symbol = TRUE; switch (symbol_type) { case 'a': symbol = STAR; break; case 'c': symbol = CIRCLE; break; case 'd': symbol = DIAMOND; break; case 'h': symbol = HEXAGON; break; case 'i': symbol = ITRIANGLE; break; case 'p': symbol = POINT; break; case 's': symbol = SQUARE; break; case 't': symbol = TRIANGLE; break; case 'x': symbol = CROSS; break; default: error = TRUE; fprintf (stderr, "%s: GMT SYNTAX ERROR -S option: Unrecognized symbol type %c\n", argv[0], symbol_type); break; } break; case 's': /* Get S polarity */ plot_polS = TRUE; strcpy(txt_a, &argv[i][3]); n=0; while (txt_a[n] && txt_a[n] != '/' && txt_a[n] != 'V' && txt_a[n] != 'G' && txt_a[n] != 'L') n++; txt_a[n]=0; sizeS = GMT_convert_units (txt_a, GMT_INCH); if(strchr(argv[i], 'V')) { vecS = TRUE; strcpy(txt_a,strchr(argv[i], 'V')); if(strncmp(txt_a,"VG",(size_t)2) == 0 || strncmp(txt_a,"VL",(size_t)2) == 0 || strlen(txt_a) == 1) { v_width = 0.03; h_length = 0.12; h_width = 0.1; shape = gmtdefs.vector_shape; if (!gmtdefs.measure_unit) { v_width = 0.075; h_length = 0.3; h_width = 0.25; shape = gmtdefs.vector_shape; } } else { strcpy(txt_a, strchr(argv[i], 'V')+1); strcpy(txt_b, strchr(txt_a+1, '/')+1); strcpy(txt_c, strchr(txt_b+1, '/')+1); strcpy(txt_d, strchr(txt_c+1, '/')+1); n=0; while (txt_a[n] && txt_a[n] != '/') n++; txt_a[n]=0; n=0; while (txt_b[n] && txt_b[n] != '/') n++; txt_b[n]=0; n=0; while (txt_c[n] && txt_c[n] != '/') n++; txt_c[n]=0; n=0; while (txt_d[n] && txt_d[n] != '/' && txt_d[n] != 'L' && txt_d[n] != 'G') n++; txt_d[n]=0; v_width = GMT_convert_units (txt_a, GMT_INCH); h_length = GMT_convert_units (txt_b, GMT_INCH); h_width = GMT_convert_units (txt_c, GMT_INCH); shape = atof(txt_d); } } if(strchr(argv[i], 'G')) { sscanf (strchr(argv[i]+1,'G')+1,"%d/%d/%d",&sfill.rgb[0],&sfill.rgb[1],&sfill.rgb[2]); sprintf(txt_a, "%d/%d/%d",sfill.rgb[0],sfill.rgb[1],sfill.rgb[2]); GMT_getfill (txt_a, &sfill); scolor = TRUE; } if(strchr(argv[i], 'L')) outline_s = TRUE; break; case 'T': /* Information about label printing */ label_s = TRUE; if (strlen(argv[i]) > 2) { sscanf (&argv[i][2], "%lf/%" GMT_LL "d/%" GMT_LL "d/%lf/", &angle_s, &form_s, &justify_s, &fontsize_s); } break; case 't': /* Set color for station label */ GMT_getpen (&argv[i][2], &tpen); def_tpen = TRUE; break; case 'W': /* Set line attributes */ GMT_getpen (&argv[i][2], &pen); break; /* Illegal options */ default: /* Options not recognized */ error = TRUE; GMT_default_error (argv[i][1]); break; } } else n_files++; } /* Check that the options selected are consistent */ if (!project_info.region_supplied) { error++; } if(ech <= 0.) { error++; } if(get_position + get_size + get_symbol < 3) { error++; } if (argc == 1 || GMT_give_synopsis_and_exit || error) { /* Display usage */ fprintf (stderr,"%s %s - Plot polarities on the inferior focal half-sphere on maps\n\n",argv[0], GMT_VERSION); fprintf (stderr,"usage: argv[0] <infiles> %s %s\n", GMT_J_OPT, GMT_Rgeo_OPT); fprintf (stderr, " -Dlongitude/latitude -Msize[i/c] -S<symbol><size>[i/c]\n"); fprintf (stderr, " [-A] [%s] [-Clongitude/latitude[W<pen>][Ppointsize]] [-E<fill>]\n", GMT_B_OPT); fprintf (stderr, " [-e[<pen>]] [-F<fill>] [-f[<pen>]] [-G<fill>] [-g[<pen>]] [%s] [-K] [-N] [-O] [-P]\n", GMT_Ho_OPT); fprintf (stderr, " [-s<half-size>/[V[<v_width/h_length/h_width/shape]][G<r/g/b>][L]\n"); fprintf (stderr, " [-T[<labelinfo>]] [-t<pen>] [%s] [-V] [-W<pen>]\n", GMT_U_OPT); fprintf (stderr, " [%s] [%s] [%s]\n", GMT_X_OPT, GMT_Y_OPT, GMT_c_OPT); if (GMT_give_synopsis_and_exit) exit (EXIT_FAILURE); fprintf (stderr, " <infiles> is one or more files. If no, read standard input\n"); GMT_explain_option ('j'); GMT_explain_option ('R'); fprintf (stderr, " -D Set longitude/latitude\n"); fprintf (stderr, " -M Set size of beach ball in %s\n", GMT_unit_names[gmtdefs.measure_unit]); fprintf (stderr, " -S to select symbol type and symbol size (in %s). Choose between\n", GMT_unit_names[gmtdefs.measure_unit]); fprintf (stderr, " st(a)r, (c)ircle, (d)iamond, (h)exagon, (i)nvtriangle\n"); fprintf (stderr, " (p)oint, (s)quare, (t)riangle, (x)cross\n"); fprintf (stderr, "\n\tOPTIONS:\n"); GMT_explain_option ('B'); GMT_explain_option ('b'); fprintf (stderr, " -C Set new_longitude/new_latitude[W<pen>][Ppointsize]\n"); fprintf (stderr, " A line will be plotted between both positions\n"); fprintf (stderr, " Default is width = 3, color = current pen and pointsize = 0.015\n"); fprintf (stderr, " -E Specify color symbol for station in extensive part.\n"); fprintf (stderr, " Fill can be either <r/g/b> (each 0-255) for color \n"); fprintf (stderr, " or <gray> (0-255) for gray-shade [0].\n"); fprintf (stderr, " Default is light gray.\n"); fprintf (stderr, " -e Outline of station symbol in extensive part.\n"); fprintf (stderr, " Default is current pen.\n"); fprintf (stderr, " -F Specify background color of beach ball. It can be\n"); fprintf (stderr, " <r/g/b> (each 0-255) for color or <gray> (0-255) for gray-shade [0].\n"); fprintf (stderr, " Default is no fill\n"); fprintf (stderr, " -f Outline beach ball\n"); fprintf (stderr, " Add <pen attributes> if not current pen.\n"); fprintf (stderr, " -G Specify color symbol for station in compressive part. Fill can be either\n"); fprintf (stderr, " Fill can be either <r/g/b> (each 0-255) for color\n"); fprintf (stderr, " or <gray> (0-255) for gray-shade [0].\n"); fprintf (stderr, " Add L[<pen>] to outline\n"); fprintf (stderr, " Default is black.\n"); fprintf (stderr, " -g Outline of station symbol in compressive part.\n"); fprintf (stderr, " Add <pen attributes> if not current pen.\n"); fprintf (stderr, " -h Use special format derived from HYPO71 output.\n"); GMT_explain_option ('H'); GMT_explain_option ('K'); fprintf (stderr, " -N Do Not skip/clip symbols that fall outside map border\n"); fprintf (stderr, " [Default will ignore those outside]\n"); GMT_explain_option ('O'); GMT_explain_option ('P'); fprintf (stderr, " -s to plot S polarity azimuth.\n"); fprintf (stderr, " Azimuth of S polarity is in last column.\n"); fprintf (stderr, " It may be a vector (V option) or a segment. Give half-size in cm.\n"); fprintf (stderr, " L option is for outline\n"); fprintf (stderr, " -s<half-size>/[V[<v_width/h_length/h_width/shape>]][G<r/g/b>][L]\n"); fprintf (stderr, " Default definition of v is 0.075/0.3/0.25/1\n"); fprintf (stderr, " Outline is current pen\n"); fprintf (stderr, " -T[<info about labal printing>] to write station code.\n"); fprintf (stderr, " <angle/form/justify/fontsize in points>\n"); fprintf (stderr, " Default is 0.0/0/5/12\n"); fprintf (stderr, " -t sets pen attributes to write station codes [default is current pen]\n"); GMT_explain_option ('U'); GMT_explain_option ('V'); fprintf (stderr, " -W sets current pen attributes [width = %gp, color = (%d/%d/%d), texture = solid line].\n", pen.width, pen.rgb[0], pen.rgb[1], pen.rgb[2]); GMT_explain_option ('X'); GMT_explain_option ('c'); GMT_explain_option ('.'); exit (EXIT_FAILURE); } if(!def_cpen) { cpen = pen; cpen.width = 3; } /* pen for change position */ if(!def_fpen) fpen = pen; /* outline beach ball */ if(!def_gpen) gpen = pen; /* outline compressive stations */ if(!def_epen) epen = pen; /* outline extensive stations */ if(!def_spen) spen = pen; /* outline S_pol segment */ if(!def_tpen) tpen = pen; /* pen to print station name */ if (n_files > 0) nofile = FALSE; else n_files = 1; n_args = (argc > 1) ? argc : 2; greenwich = (west < 0.0 || east <= 0.0); GMT_err_fail (GMT_map_setup (west, east, south, north), ""); GMT_plotinit (argc, argv); if (label_s) ps_setfont (gmtdefs.annot_font[0]); if (symbol > 0 && skip_if_outside) GMT_map_clip_on (GMT_no_rgb, 3); old_GMT_world_map = GMT_world_map; done = FALSE; for (fno = 1; !done && fno < n_args; fno++) { /* Loop over all input files */ if (!nofile && argv[fno][0] == '-') continue; if (nofile) { fp = GMT_stdin; done = TRUE; } else if ((fp = GMT_fopen (argv[fno], "r")) == NULL) { fprintf (stderr, "%s: Cannot open file %s\n", argv[0], argv[fno]); continue; } if (!nofile && gmtdefs.verbose) { fprintf (stderr, "%s: Working on file %s\n", argv[0], argv[fno]); sprintf (line, "File: %s", argv[fno]); ps_comment (line); } if (GMT_io.io_header[GMT_IN]) for (i = 0; i < GMT_io.n_header_recs; i++) not_used = GMT_fgets (line, 512, fp); GMT_world_map = TRUE; GMT_geo_to_xy(lon, lat, &plot_x0, &plot_y0); if(change_position) { GMT_setpen (&cpen); GMT_geo_to_xy(new_lon, new_lat, &new_plot_x0, &new_plot_y0); ps_circle(plot_x0, plot_y0, c_pointsize, cpen.rgb, 1); ps_plot(plot_x0, plot_y0, PSL_PEN_MOVE); ps_plot(new_plot_x0, new_plot_y0, PSL_PEN_DRAW_AND_STROKE); plot_x0 = new_plot_x0; plot_y0 = new_plot_y0; } if (skip_if_outside) { GMT_map_outside (lon, lat); if (GMT_abs (GMT_x_status_new) > 1 || GMT_abs (GMT_y_status_new) > 1) continue; } GMT_setpen (&fpen); ps_circle (plot_x0, plot_y0, ech, ffill.rgb, outline_F); while (GMT_fgets (line, BUFSIZ, fp)) { switch (hypo) { case 0 : if(!plot_polS) { sscanf (line, "%s %lf %lf %c", stacode, &azimut, &ih, &pol); } else { n = sscanf (line, "%s %lf %lf %c %lf", stacode, &azimut, &ih, &pol, &azS); if(n == 4) azS = -1.; } break; case 1 : memset ((void *)col, 0, 4 * GMT_TEXT_LEN * sizeof (char)); if(!plot_polS) { sscanf (line, "%s %s %s %s %lf %lf %c", col[0], col[1], col[2], stacode, &azimut, &ih, col[3]); pol = col[3][2]; } else { n = sscanf (line, "%s %s %s %s %lf %lf %c %lf", col[0], col[1], col[2], stacode, &azimut, &ih, col[3], &azS); pol = col[3][2]; if(n == 7) azS = -1.; } break; } if(strcmp(col[0],"000000")!=0) { plongement = (ih - 90.) * M_PI / 180.; if(plongement < 0.) { plongement = -plongement; azimut += 180 ; symbol_size2 = symbol_size * 0.8; } else symbol_size2 = symbol_size; radius = sqrt(1. - sin(plongement)); if(radius >= 0.97) radius = 0.97; azimut += 180; azimut *= M_PI / 180.; sincos (azimut, &si, &co); plot_x = radius * si * ech / 2. + plot_x0; plot_y = radius * co * ech / 2. + plot_y0; if (symbol == CROSS || symbol == POINT) ps_setpaint (fill.rgb); if(label_s) { GMT_setpen (&tpen); switch (justify_s) { case 11 : ps_text(plot_x-symbol_size2-0.1, plot_y-symbol_size2-0.1, fontsize_s, stacode, angle_s, 11, form_s); break; case 10 : ps_text(plot_x, plot_y-symbol_size2-0.1, fontsize_s, stacode, angle_s, 10, form_s); break; case 9 : ps_text(plot_x+symbol_size2+0.1, plot_y-symbol_size2-0.1, fontsize_s, stacode, angle_s, 9, form_s); break; case 7: ps_text(plot_x-symbol_size2-0.1, plot_y, fontsize_s, stacode, angle_s, 7, form_s); break; case 6: ps_text(plot_x, plot_y, fontsize_s, stacode, angle_s, 6, form_s); break; case 5: ps_text(plot_x+symbol_size2+0.1, plot_y, fontsize_s, stacode, angle_s, 5, form_s); break; case 3: ps_text(plot_x-symbol_size2-0.1, plot_y+symbol_size2+0.1, fontsize_s, stacode, angle_s, 3, form_s); break; case 2: ps_text(plot_x, plot_y+symbol_size2+0.1, fontsize_s, col[3], angle_s, 2, form_s); break; case 1: ps_text(plot_x+symbol_size2+0.1, plot_y+symbol_size2+0.1, fontsize_s, stacode, angle_s, 1, form_s); break; } } switch (symbol) { case STAR: if(pol == 'u' || pol == 'U' || pol == 'c' || pol == 'C' || pol == '+') { GMT_setpen (&gpen); ps_star (plot_x, plot_y, symbol_size2, gfill.rgb, outline_G); } else if(pol == 'r' || pol == 'R' || pol == 'd' || pol == 'D' || pol == '-') { GMT_setpen (&epen); ps_star (plot_x, plot_y, symbol_size2, efill.rgb, outline_E); } else { GMT_setpen (&pen); ps_cross (plot_x, plot_y, symbol_size2); } break; case CROSS: GMT_setpen (&pen); ps_cross (plot_x, plot_y, symbol_size2); break; case POINT: GMT_setpen (&pen); ps_cross (plot_x, plot_y, POINTSIZE); break; case CIRCLE: if(pol == 'u' || pol == 'U' || pol == 'c' || pol == 'C' || pol == '+') { GMT_setpen (&gpen); ps_circle (plot_x, plot_y, symbol_size2, gfill.rgb, outline_G); } else if(pol == 'r' || pol == 'R' || pol == 'd' || pol == 'D' || pol == '-') { GMT_setpen (&epen); ps_circle (plot_x, plot_y, symbol_size2, efill.rgb, outline_E); } else { GMT_setpen (&pen); ps_cross (plot_x, plot_y, symbol_size2); } break; case SQUARE: if(pol == 'u' || pol == 'U' || pol == 'c' || pol == 'C' || pol == '+') { GMT_setpen (&gpen); ps_square (plot_x, plot_y, symbol_size2, gfill.rgb, outline_G); } else if(pol == 'r' || pol == 'R' || pol == 'd' || pol == 'D' || pol == '-') { GMT_setpen (&epen); ps_square (plot_x, plot_y, symbol_size2, efill.rgb, outline_E); } else { GMT_setpen (&pen); ps_cross (plot_x, plot_y, symbol_size2); } break; case HEXAGON: if(pol == 'u' || pol == 'U' || pol == 'c' || pol == 'C' || pol == '+') { GMT_setpen (&gpen); ps_hexagon (plot_x, plot_y, symbol_size2, gfill.rgb, outline_G); } else if(pol == 'r' || pol == 'R' || pol == 'd' || pol == 'D' || pol == '-') { GMT_setpen (&epen); ps_hexagon (plot_x, plot_y, symbol_size2, efill.rgb, outline_E); } else { GMT_setpen (&pen); ps_cross (plot_x, plot_y, symbol_size2); } break; case TRIANGLE: if(pol == 'u' || pol == 'U' || pol == 'c' || pol == 'C' || pol == '+') { GMT_setpen (&gpen); ps_triangle (plot_x, plot_y, symbol_size2, gfill.rgb, outline_G); } else if(pol == 'r' || pol == 'R' || pol == 'd' || pol == 'D' || pol == '-') { GMT_setpen (&epen); ps_triangle (plot_x, plot_y, symbol_size2, efill.rgb, outline_E); } else { GMT_setpen (&pen); ps_cross (plot_x, plot_y, symbol_size2); } break; case ITRIANGLE: if(pol == 'u' || pol == 'U' || pol == 'c' || pol == 'C' || pol == '+') { GMT_setpen (&gpen); ps_itriangle (plot_x, plot_y, symbol_size2, gfill.rgb, outline_G); } else if(pol == 'r' || pol == 'R' || pol == 'd' || pol == 'D' || pol == '-') { GMT_setpen (&epen); ps_itriangle (plot_x, plot_y, symbol_size2, efill.rgb, outline_E); } else { GMT_setpen (&pen); ps_cross (plot_x, plot_y, symbol_size2); } break; case DIAMOND: if(pol == 'u' || pol == 'U' || pol == 'c' || pol == 'C' || pol == '+') { GMT_setpen (&gpen); ps_diamond (plot_x, plot_y, symbol_size2, gfill.rgb, outline_G); } else if(pol == 'r' || pol == 'R' || pol == 'd' || pol == 'D' || pol == '-') { GMT_setpen (&epen); ps_diamond (plot_x, plot_y, symbol_size2, efill.rgb, outline_E); } else { GMT_setpen (&pen); ps_cross (plot_x, plot_y, symbol_size2); } break; } if(plot_polS && azS >= 0.) { GMT_setpen (&spen); sincos (azS*M_PI/180., &si, &co); if(vecS) { ps_vector(plot_x - sizeS*si, plot_y - sizeS*co, plot_x + sizeS*si, plot_y + sizeS*co, v_width, h_length, h_width, gmtdefs.vector_shape, sfill.rgb, outline_s); } else { if(scolor) ps_setpaint (sfill.rgb); else ps_setpaint (pen.rgb); ps_plot(plot_x - sizeS*si, plot_y - sizeS*co, PSL_PEN_MOVE); ps_plot(plot_x + sizeS*si, plot_y + sizeS*co, PSL_PEN_DRAW_AND_STROKE); } } } } if (fp != stdin) GMT_fclose (fp); } if (skip_if_outside) GMT_map_clip_off (); GMT_world_map = old_GMT_world_map; if (pen.texture[0]) ps_setdash (CNULL, 0); GMT_map_basemap (); GMT_plotend (); GMT_end (argc, argv); exit (EXIT_SUCCESS); }