! Update vector head length and width parameters based on size_z and v_angle, and deal with pen/fill settings */
| 16717 | |
| 16718 | /*! Update vector head length and width parameters based on size_z and v_angle, and deal with pen/fill settings */ |
| 16719 | int gmt_init_vector_param (struct GMT_CTRL *GMT, struct GMT_SYMBOL *S, bool set, bool outline, struct GMT_PEN *pen, bool do_fill, struct GMT_FILL *fill) { |
| 16720 | bool no_outline = false, no_fill = false; |
| 16721 | if (S == NULL) return 0; /* Nothing to do */ |
| 16722 | if (set) { /* Determine proper settings for head fill or outline */ |
| 16723 | if (outline && (S->v.status & PSL_VEC_OUTLINE2) == 0 && pen) S->v.pen = *pen; /* If no +p<pen> but -W<pen> was used, use same pen for vector heads */ |
| 16724 | else if (!outline && S->v.status & PSL_VEC_OUTLINE2 && pen) *pen = S->v.pen; /* If no -W<pen> was set but +p<pen> given, use same pen for vector tails */ |
| 16725 | else if (!outline && (S->v.status & PSL_VEC_OUTLINE2) == 0) no_outline = true; |
| 16726 | if (do_fill && (S->v.status & PSL_VEC_FILL2) == 0 && fill) S->v.fill = *fill; /* If no +g<fill> but -G<fill> was used, use same fill for vector heads */ |
| 16727 | else if (!do_fill && S->v.status & PSL_VEC_FILL2) no_fill = false; /* If no -G<fill> was set but +g<fill> given, we do nothing here */ |
| 16728 | else if (!do_fill && (S->v.status & PSL_VEC_FILL2) == 0) no_fill = true; /* Neither -G<fill> nor +g<fill> were set */ |
| 16729 | if (no_outline && no_fill && (S->v.status & PSL_VEC_HEADS)) { |
| 16730 | GMT_Report (GMT->parent, GMT_MSG_ERROR, "Cannot draw vector heads without specifying at least one of head outline or head fill.\n"); |
| 16731 | return 1; |
| 16732 | } |
| 16733 | } |
| 16734 | if (gmt_M_is_zero (S->v.comp_scale)) S->v.comp_scale = 1.0; /* Safety valve for GMT4 vectors */ |
| 16735 | if (gmt_M_is_zero (S->size_x)) return 0; /* Not set yet */ |
| 16736 | if (!(S->symbol == GMT_SYMBOL_VECTOR_V4 || S->v.parsed_v4)) { |
| 16737 | S->v.h_length = (float)S->size_x; |
| 16738 | S->v.h_width = (float)(2.0 * S->v.h_length * tand (0.5 * S->v.v_angle)); |
| 16739 | } |
| 16740 | return 0; |
| 16741 | } |
| 16742 | |
| 16743 | GMT_LOCAL unsigned int gmtinit_get_length (struct GMT_CTRL *GMT, char symbol, char *string, bool norm, bool is_grdvector, float *value, bool *user_unit) { |
| 16744 | /* Used by gmt_parse_vector to set length scales or limits related to vectors. |
no test coverage detected