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

Function psscale_plot_cycle

src/psscale.c:685–717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683}
684
685GMT_LOCAL void psscale_plot_cycle (struct GMT_CTRL *GMT, double x, double y, double width) {
686 /* Use the color of MAP_FRAME_PEN to draw the symbol stem and head fill.
687 * Use the symbol width to estimate pen width as 0.5p times (width/0.05) [in inches] */
688 double vdim[PSL_MAX_DIMS], s = width / 0.05, p_width, circum;
689 struct GMT_SYMBOL S;
690 struct GMT_FILL head;
691 struct GMT_PEN pen;
692 gmt_init_pen (GMT, &pen, 0.5); /* Sets pen to 0.5p */
693 gmt_M_memcpy (pen.rgb, GMT->current.setting.map_frame_pen.rgb, 4U, double);
694 gmt_init_fill (GMT, &head, pen.rgb[0], pen.rgb[1], pen.rgb[2]); /* Default fill for points, if needed */
695 gmt_init_vector_param (GMT, &S, false, false, NULL, false, NULL); /* Update vector head parameters */
696 gmt_M_memset (vdim, PSL_MAX_DIMS, double);
697 circum = 2.0 * M_PI * width; /* Circumference of symbol in inches */
698 p_width = (float)(s * pen.width * GMT->session.u2u[GMT_PT][GMT_INCH]);
699 pen.width = p_width * GMT->session.u2u[GMT_INCH][GMT_PT];
700 vdim[PSL_MATHARC_RADIUS] = width; /* Circular symbol radius is 0.45 of bar width */
701 vdim[PSL_MATHARC_ANGLE_BEGIN] = 50.0; /* Angular start and stop for one arrow */
702 vdim[PSL_MATHARC_ANGLE_END] = 210.0;
703 vdim[PSL_MATHARC_HEAD_LENGTH] = circum / 6.0; /* Head-length is 1/6 of circumference */
704 vdim[PSL_MATHARC_HEAD_WIDTH] = vdim[PSL_MATHARC_HEAD_LENGTH] * tand (25.0); /* Head width assumes 25 degree apex */
705 vdim[PSL_MATHARC_ARC_PENWIDTH] = p_width; /* Passing in pen width */
706 vdim[PSL_MATHARC_HEAD_SHAPE] = 0.75; /* Vector shape */
707 vdim[PSL_MATHARC_STATUS] = (double)(PSL_VEC_END|PSL_VEC_FILL);
708 vdim[PSL_MATHARC_HEAD_TYPE_END] = (double)PSL_VEC_ARROW;
709 gmt_setfill (GMT, &head, 0);
710 gmt_setpen (GMT, &pen);
711 PSL_defpen (GMT->PSL, "PSL_vecheadpen", 0.0, "", 0, head.rgb);
712 x += 0.15 * vdim[3]; /* Shift center to account for the width of the circular arrow */
713 PSL_plotsymbol (GMT->PSL, x, y, vdim, PSL_MARC);
714 vdim[PSL_MATHARC_ANGLE_BEGIN] = 230.0; /* Angular start and stop for the other circular arrow */
715 vdim[PSL_MATHARC_ANGLE_END] = 390.0;
716 PSL_plotsymbol (GMT->PSL, x, y, vdim, PSL_MARC);
717}
718
719GMT_LOCAL unsigned int psscale_cpt_transparency (struct GMT_CTRL *GMT, struct GMT_PALETTE *P) {
720 /* Determine the status of transparency in the CPT:

Callers 1

psscale_draw_colorbarFunction · 0.85

Calls 7

gmt_init_penFunction · 0.85
gmt_init_fillFunction · 0.85
gmt_init_vector_paramFunction · 0.85
gmt_setfillFunction · 0.85
gmt_setpenFunction · 0.85
PSL_defpenFunction · 0.85
PSL_plotsymbolFunction · 0.85

Tested by

no test coverage detected