| 1692 | } |
| 1693 | |
| 1694 | GMT_LOCAL void gmtplot_map_tick (struct GMT_CTRL *GMT, struct PSL_CTRL *PSL, double *xx, double *yy, unsigned int *sides, double *angles, unsigned int nx, unsigned int type, double len) { |
| 1695 | double angle, xl, yl, c, s, tick_length; |
| 1696 | unsigned int i; |
| 1697 | bool set_angle; |
| 1698 | |
| 1699 | /* The set_angle bit trieds to handle the fact that the given angles from crossing may need an adjustment depending on |
| 1700 | * which side of a rectangular box it occurs. There are exception for round maps, etc. It is a bit nebulous and could |
| 1701 | * need a better explanation. For instance, I commented out the Gnomonic case which is needed for annotations but not here, apparently */ |
| 1702 | set_angle = ((!GMT->common.R.oblique && !(gmt_M_is_azimuthal(GMT) || gmt_M_is_conical(GMT))) || GMT->common.R.oblique); |
| 1703 | if (!GMT->common.R.oblique && (GMT->current.proj.projection_GMT == GMT_GENPER || GMT->current.proj.projection_GMT == GMT_POLYCONIC)) set_angle = true; |
| 1704 | |
| 1705 | for (i = 0; i < nx; i++) { |
| 1706 | if (!GMT->current.proj.edge[sides[i]]) continue; |
| 1707 | if ((GMT->current.map.frame.side[sides[i]] & GMT_AXIS_TICK) == 0) continue; |
| 1708 | if (!(GMT->current.setting.map_annot_oblique & GMT_OBL_ANNOT_ANYWHERE) && ((type == 0 && (sides[i] % 2)) || (type == 1 && !(sides[i] % 2)))) continue; |
| 1709 | angle = ((GMT->current.setting.map_annot_oblique & GMT_OBL_ANNOT_NORMAL_TICKS) ? (sides[i] - 1) * 90.0 : angles[i]); |
| 1710 | if (set_angle) { /* Adjust angle to fit the range of angles relative to each side */ |
| 1711 | if (sides[i] == 0 && angle < 180.0) angle -= 180.0; |
| 1712 | if (sides[i] == 1 && (angle > 90.0 && angle < 270.0)) angle -= 180.0; |
| 1713 | if (sides[i] == 2 && angle > 180.0) angle -= 180.0; |
| 1714 | if (sides[i] == 3 && (angle < 90.0 || angle > 270.0)) angle -= 180.0; |
| 1715 | } |
| 1716 | sincosd (angle, &s, &c); |
| 1717 | tick_length = len; |
| 1718 | if (GMT->current.setting.map_annot_oblique & GMT_OBL_ANNOT_EXTEND_TICKS) { |
| 1719 | if (sides[i] % 2) { |
| 1720 | /* if (fabs (c) > cosd (GMT->current.setting.map_annot_min_angle)) continue; */ |
| 1721 | if (fabs (c) < sind (GMT->current.setting.map_annot_min_angle)) continue; |
| 1722 | tick_length /= fabs(c); |
| 1723 | } |
| 1724 | else { |
| 1725 | if (fabs (s) < sind (GMT->current.setting.map_annot_min_angle)) continue; |
| 1726 | tick_length /= fabs(s); |
| 1727 | } |
| 1728 | } |
| 1729 | xl = tick_length * c; |
| 1730 | yl = tick_length * s; |
| 1731 | PSL_plotsegment (PSL, xx[i], yy[i], xx[i]+xl, yy[i]+yl); |
| 1732 | } |
| 1733 | } |
| 1734 | |
| 1735 | GMT_LOCAL void gmtplot_map_lontick (struct GMT_CTRL *GMT, struct PSL_CTRL *PSL, double lon, double south, double north, double len) { |
| 1736 | unsigned int i, nc; |
no test coverage detected