| 1832 | } |
| 1833 | |
| 1834 | GMT_LOCAL void gmtplot_map_symbol (struct GMT_CTRL *GMT, struct PSL_CTRL *PSL, struct GMT_XINGS *xings, char *label, unsigned int type, bool annot, unsigned int level, unsigned int form) { |
| 1835 | /* type = 0 for lon and 1 for lat */ |
| 1836 | |
| 1837 | double line_angle, text_angle, div, tick_length, o_len, len, ca, sa, boost; |
| 1838 | double *xx = xings->xx, *yy = xings->yy, *line_angles = xings->angle; |
| 1839 | unsigned int i, annot_type, justify, *sides = xings->sides, nx = xings->nx; |
| 1840 | bool flip; |
| 1841 | len = gmtplot_get_annot_offset (GMT, &flip, level); /* Get annotation offset, and flip justification if "inside" */ |
| 1842 | annot_type = 2 << type; /* 2 = NS, 4 = EW */ |
| 1843 | |
| 1844 | for (i = 0; i < nx; i++) { |
| 1845 | if (!(GMT->current.setting.map_annot_oblique & GMT_OBL_ANNOT_ANYWHERE) && ((type == 0 && (sides[i] % 2)) || (type == 1 && !(sides[i] % 2)))) continue; |
| 1846 | |
| 1847 | if (gmtlib_prepare_label (GMT, line_angles[i], sides[i], xx[i], yy[i], type, &line_angle, &text_angle, &justify)) continue; |
| 1848 | |
| 1849 | boost = gmtplot_curved_boundary_offset (GMT, xings->lon[i], xings->lat[i], type, level); |
| 1850 | sincosd (line_angle, &sa, &ca); |
| 1851 | tick_length = GMT->current.setting.map_tick_length[GMT_PRIMARY]; |
| 1852 | o_len = len; |
| 1853 | if (!flip && GMT->current.setting.map_annot_oblique & annot_type) o_len = tick_length; |
| 1854 | if (GMT->current.setting.map_annot_oblique & GMT_OBL_ANNOT_EXTEND_TICKS) { |
| 1855 | div = ((sides[i] % 2) ? fabs (ca) : fabs (sa)); |
| 1856 | o_len /= div; |
| 1857 | } |
| 1858 | else |
| 1859 | o_len += copysign (boost, o_len); |
| 1860 | xx[i] += o_len * ca; |
| 1861 | yy[i] += o_len * sa; |
| 1862 | if (!flip && (GMT->current.setting.map_annot_oblique & annot_type) && GMT->current.setting.map_annot_offset[level] > 0.0) { |
| 1863 | if (sides[i] % 2) |
| 1864 | xx[i] += (sides[i] == 1) ? GMT->current.setting.map_annot_offset[level] : -GMT->current.setting.map_annot_offset[level]; |
| 1865 | else |
| 1866 | yy[i] += (sides[i] == 2) ? GMT->current.setting.map_annot_offset[level] : -GMT->current.setting.map_annot_offset[level]; |
| 1867 | } |
| 1868 | |
| 1869 | if (annot) { |
| 1870 | double length = (type == GMT_X) ? GMT->current.map.width : GMT->current.map.height; |
| 1871 | double pos = (type == GMT_X) ? xx[i] : yy[i]; |
| 1872 | if (gmtplot_annot_too_crowded (GMT, xx[i], yy[i], sides[i])) continue; |
| 1873 | if (gmtplot_skip_end_annotation (GMT, type, pos, length)) continue; /* Don't want annotations exactly at one or both ends of the axis */ |
| 1874 | if (GMT->current.proj.three_D && GMT->current.proj.z_project.cos_az > 0) { /* Rotate annotation when seen "from North" */ |
| 1875 | if (!flip) justify = gmt_flip_justify (GMT, justify); |
| 1876 | text_angle += 180.0; |
| 1877 | } |
| 1878 | else |
| 1879 | if (flip) justify = gmt_flip_justify (GMT, justify); |
| 1880 | PSL_plottext (PSL, xx[i], yy[i], GMT->current.setting.font_annot[level].size, label, text_angle, justify, form); |
| 1881 | } |
| 1882 | } |
| 1883 | } |
| 1884 | |
| 1885 | GMT_LOCAL void gmtplot_map_symbol_ew (struct GMT_CTRL *GMT, struct PSL_CTRL *PSL, double lat, char *label, double west, double east, bool annot, unsigned int level, unsigned int form) { |
| 1886 | unsigned int i, nc; |
no test coverage detected