| 1161 | } |
| 1162 | |
| 1163 | GMT_LOCAL void gmtplot_fancy_frame_curved_outline (struct GMT_CTRL *GMT, struct PSL_CTRL *PSL, double lonA, double latA, double lonB, double latB, unsigned int side, bool secondary_too) { |
| 1164 | double scale[2] = {1.0, 1.0}, escl, x1, x2, y1, y2, radius, r_inc, az1, az2, da0, da, width, s, fw, fe; |
| 1165 | |
| 1166 | if (!GMT->current.map.frame.side[side]) return; /* This side is inactive */ |
| 1167 | fw = (GMT->current.map.frame.side[W_SIDE]) ? 1.0 : 0.0; /* Only extend if W side is plotted */ |
| 1168 | fe = (GMT->current.map.frame.side[E_SIDE]) ? 1.0 : 0.0; /* Only extend if E side is plotted */ |
| 1169 | if (secondary_too) scale[0] = scale[1] = 0.5; |
| 1170 | width = GMT->current.setting.map_frame_width; |
| 1171 | escl = (GMT->current.setting.map_frame_type == GMT_IS_ROUNDED) ? 0.0 : 1.0; /* Want rounded corners */ |
| 1172 | gmt_geo_to_xy (GMT, lonA, latA, &x1, &y1); |
| 1173 | gmt_geo_to_xy (GMT, lonB, latB, &x2, &y2); |
| 1174 | radius = hypot (x1 - GMT->current.proj.c_x0, y1 - GMT->current.proj.c_y0); |
| 1175 | s = ((GMT->current.proj.north_pole && side == 2) || (!GMT->current.proj.north_pole && side == 0)) ? -1.0 : +1.0; /* North: needs shorter radius. South: Needs longer radius (opposite in S hemi) */ |
| 1176 | r_inc = s*scale[0] * width; |
| 1177 | if (gmt_M_is_azimuthal(GMT) && gmt_M_360_range (lonA, lonB)) { /* Full 360-degree circle */ |
| 1178 | PSL_plotarc (PSL, GMT->current.proj.c_x0, GMT->current.proj.c_y0, radius, 0.0, 360.0, PSL_MOVE|PSL_STROKE); |
| 1179 | PSL_plotarc (PSL, GMT->current.proj.c_x0, GMT->current.proj.c_y0, radius + r_inc, 0.0, 360.0, PSL_MOVE|PSL_STROKE); |
| 1180 | if (secondary_too) PSL_plotarc (PSL, GMT->current.proj.c_x0, GMT->current.proj.c_y0, radius + 2.0 * r_inc, 0.0, 360.0, PSL_MOVE|PSL_STROKE); |
| 1181 | } |
| 1182 | else { |
| 1183 | az1 = d_atan2d (y1 - GMT->current.proj.c_y0, x1 - GMT->current.proj.c_x0); |
| 1184 | az2 = d_atan2d (y2 - GMT->current.proj.c_y0, x2 - GMT->current.proj.c_x0); |
| 1185 | if (!GMT->current.proj.north_pole) gmt_M_double_swap (az1, az2); /* In S hemisphere, must draw in opposite direction */ |
| 1186 | while (az1 < 0.0) az1 += 360.0; /* Wind az1 to be in the 0-360 range */ |
| 1187 | while (az2 < az1) az2 += 360.0; /* Likewise ensure az1 > az1 and is now in the 0-720 range */ |
| 1188 | da0 = R2D * escl * width /radius; |
| 1189 | da = R2D * escl * width / (radius + r_inc); |
| 1190 | PSL_plotarc (PSL, GMT->current.proj.c_x0, GMT->current.proj.c_y0, radius, az1-fw*da0, az2+fe*da0, PSL_MOVE|PSL_STROKE); |
| 1191 | PSL_plotarc (PSL, GMT->current.proj.c_x0, GMT->current.proj.c_y0, radius + r_inc, az1-fw*da, az2+fe*da, PSL_MOVE|PSL_STROKE); |
| 1192 | if (secondary_too) { |
| 1193 | r_inc *= 2.0; |
| 1194 | da = R2D * escl * width / (radius + r_inc); |
| 1195 | PSL_plotarc (PSL, GMT->current.proj.c_x0, GMT->current.proj.c_y0, radius + r_inc, az1-fw*da, az2+fe*da, PSL_MOVE|PSL_STROKE); |
| 1196 | } |
| 1197 | } |
| 1198 | } |
| 1199 | |
| 1200 | GMT_LOCAL void gmtplot_rounded_framecorners (struct GMT_CTRL *GMT, struct PSL_CTRL *PSL, double w, double e, double s, double n, bool secondary_too) { |
| 1201 | unsigned int k, kn, item[2] = {GMT_TICK_UPPER, GMT_TICK_LOWER}; |
no test coverage detected