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

Function gmtplot_prog_indicator_C

src/gmt_plot.c:8732–8769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8730}
8731
8732GMT_LOCAL void gmtplot_prog_indicator_C (struct GMT_CTRL *GMT, double x, double y, double t, double w, int justify, char *P1, char *P2, char *label, char kind, double fsize) {
8733 /* Place growing math arrow */
8734 double fx, fy, dim[PSL_MAX_DIMS];
8735 struct GMT_PEN pen;
8736
8737 gmt_M_memset (dim, PSL_MAX_DIMS, double);
8738 gmtplot_just_f_xy (justify, &fx, &fy);
8739 gmt_M_memset (&pen, 1, struct GMT_PEN);
8740 gmt_getpen (GMT, P2, &pen); /* Want to draw full circle */
8741 x += fx * 1.15 * w; y += fy * 1.15 * w; /* Move to center of circle, add 15% to get more space so arrow head won't clip at canvas edge */
8742 PSL_command (GMT->PSL, "FQ %% Force turn off any prior fill\n");
8743 if (kind == 'C') { /* Place center label */
8744 if (fsize == 0.0) fsize = 0.3 * w * PSL_POINTS_PER_INCH;
8745 PSL_plottext (GMT->PSL, x, y, fsize, label, 0.0, PSL_MC, 0);
8746 }
8747 if (t < 1.0) { /* Need to plot the background full circle */
8748 gmt_setpen (GMT, &pen); /* Full circle pen */
8749 PSL_setfill (GMT->PSL, GMT->session.no_rgb, 1);
8750 PSL_plotsymbol (GMT->PSL, x, y, &w, PSL_CIRCLE); /* Plot full circle */
8751 }
8752 gmt_M_memset (&pen, 1, struct GMT_PEN);
8753 gmt_getpen (GMT, P1, &pen); /* Always draw foreground circle */
8754 gmt_setpen (GMT, &pen); /* Front circle pen */
8755 PSL_setfill (GMT->PSL, pen.rgb, 1);
8756 dim[PSL_MATHARC_RADIUS] = 0.5 * w; /* Apparently we take radius for wedge */
8757 dim[PSL_MATHARC_ANGLE_BEGIN] = 90.0 - 360 * t; /* Go clockwise. Convert t to 0-360 degrees */
8758 dim[PSL_MATHARC_ANGLE_END] = 90.0; /* Start is 12 'oclock */
8759 dim[PSL_MATHARC_HEAD_LENGTH] = 0.2 * w;
8760 dim[PSL_MATHARC_HEAD_WIDTH] = 0.2 * w;
8761 dim[PSL_MATHARC_ARC_PENWIDTH] = pen.width / PSL_POINTS_PER_INCH;
8762 dim[PSL_MATHARC_HEAD_SHAPE] = 0.75; /* Fixed shape setting */
8763 dim[PSL_MATHARC_STATUS] = (double)(PSL_VEC_BEGIN | PSL_VEC_FILL);
8764 dim[PSL_MATHARC_HEAD_TYPE_BEGIN] = (double)PSL_VEC_ARROW;
8765 dim[PSL_MATHARC_HEAD_TYPE_END] = (double)PSL_VEC_ARROW;
8766 dim[PSL_MATHARC_HEAD_PENWIDTH] = 0.5 * pen.width;
8767 PSL_command (GMT->PSL, "/PSL_vecheadpen {} def\n"); /* So wedge won't fuss about not being set (like in psxy) */
8768 PSL_plotsymbol (GMT->PSL, x, y, dim, PSL_MARC);
8769}
8770
8771GMT_LOCAL void gmtplot_prog_indicator_D (struct GMT_CTRL *GMT, double x, double y, double t, double w, int justify, char *P1, char *P2, char *label, char kind, double fsize) {
8772 /* Place rounded line indicator with a single crossmark line and optional label.

Callers 1

gmt_plotinitFunction · 0.85

Calls 7

gmtplot_just_f_xyFunction · 0.85
gmt_getpenFunction · 0.85
PSL_commandFunction · 0.85
PSL_plottextFunction · 0.85
gmt_setpenFunction · 0.85
PSL_setfillFunction · 0.85
PSL_plotsymbolFunction · 0.85

Tested by

no test coverage detected