MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / gmtplot_draw_eps_symbol

Function gmtplot_draw_eps_symbol

src/gmt_plot.c:7497–7521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7495}
7496
7497GMT_LOCAL void gmtplot_draw_eps_symbol (struct GMT_CTRL *GMT, double x0, double y0, double size[], struct GMT_CUSTOM_SYMBOL_ITEM *symbol) {
7498 /* Special Encapsulated PostScript-only symbol */
7499 struct GMT_CUSTOM_SYMBOL_EPS *E = symbol->eps; /* SHorthand */
7500 double off = 0.5*size[0], fy = (E->BB[3] - E->BB[2]) / (E->BB[1] - E->BB[0]);
7501 struct PSL_CTRL *PSL= GMT->PSL;
7502 if (!E->placed) { /* First time we must dump the PS code definition */
7503 double scl = 72.0 / (E->BB[1] - E->BB[0]);
7504 PSL_comment (PSL, "Start of symbol %s\n", E->name);
7505 PSL_command (PSL, "/Sk_%s {\nPSL_eps_begin\n", E->name);
7506 /* We use the symbol's bounding box and scale its width to 1 inch since PSL uses inches */
7507 PSL_command (PSL, "%.8f dup scale\n", scl);
7508 if (!E->GMT_made) /* Non-GMT-produced EPS macro - must scale points to GMT's unit */
7509 PSL_command (PSL, "1200 72 div dup scale\n");
7510 PSL_command (PSL, "%%%%BeginDocument: %s.eps\n", E->name);
7511 PSL_copy (PSL, E->macro); /* Since it may be quite large */
7512 PSL_command (PSL, "%%%%EndDocument\n");
7513 PSL_command (PSL, "PSL_eps_end } def\n");
7514 PSL_comment (PSL, "End of symbol %s\n", E->name);
7515 E->placed = true; /* Flag now says we have dumped the EPS code */
7516 }
7517 PSL_command (PSL, "V ");
7518 PSL_setorigin (PSL, x0-off, y0-fy*off, 0.0, PSL_FWD);
7519 PSL_command (PSL, "%.12g dup scale ", size[0]);
7520 PSL_command (PSL, "Sk_%s U\n", E->name);
7521}
7522
7523GMT_LOCAL bool gmtplot_is_azimuth (struct GMT_CUSTOM_SYMBOL *symbol, struct GMT_CUSTOM_SYMBOL_ITEM *s, unsigned int var_no) {
7524 /* We either know a particular column has variable azimuths or we were given a constant angle flagged by a trailing 'a' */

Callers 1

gmt_draw_custom_symbolFunction · 0.85

Calls 4

PSL_commentFunction · 0.85
PSL_commandFunction · 0.85
PSL_copyFunction · 0.85
PSL_setoriginFunction · 0.85

Tested by

no test coverage detected