| 1304 | #endif |
| 1305 | |
| 1306 | GMT_LOCAL void gmtplot_wesn_map_boundary (struct GMT_CTRL *GMT, struct PSL_CTRL *PSL, double w, double e, double s, double n) { |
| 1307 | /* Draw 0-4 boundary sides. If more than 1 then ensure we draw a continuous line to |
| 1308 | * avoid notches at sharp corners. */ |
| 1309 | uint64_t i, n_sides = 0, np = 0, n_set = 0; |
| 1310 | int this, next = GMT_NOTSET, flag; |
| 1311 | double lonstart[4] = {w, e, e, w}, lonstop[4] = {e, e, w, w}; |
| 1312 | double latstart[4] = {s, s, n, n}, latstop[4] = {s, n, n, s}; |
| 1313 | double *xx = NULL, *yy = NULL; |
| 1314 | |
| 1315 | gmt_setpen (GMT, &GMT->current.setting.map_frame_pen); |
| 1316 | |
| 1317 | /* Determine how many sides are requested and find first side to be skipped (if any) */ |
| 1318 | |
| 1319 | for (this = S_SIDE; this <= W_SIDE; this++) { |
| 1320 | if (GMT->current.map.frame.side[this]) n_sides++; |
| 1321 | else if (next == GMT_NOTSET) next = this; |
| 1322 | } |
| 1323 | if (n_sides == 0) return; /* Nuthin' to do */ |
| 1324 | |
| 1325 | GMT_Report (GMT->parent, GMT_MSG_DEBUG, "gmtplot_wesn_map_boundary n_sides = %" PRIu64 "\n", n_sides); |
| 1326 | this = next; /* First side to be skipped (== GMT_NOTSET if none to be skipped) */ |
| 1327 | flag = PSL_MOVE; /* Need to move to the start of the line the first time */ |
| 1328 | while (n_set < n_sides) { /* While more sides need to be plotted we loop counter-clockwise */ |
| 1329 | this++; /* Go to next side (this will be S_SIDE if all 4 sides should be plotted) */ |
| 1330 | if (this > W_SIDE) this = S_SIDE; /* Wrap around */ |
| 1331 | if (!GMT->current.map.frame.side[this]) { /* Side to be skipped */ |
| 1332 | flag = PSL_MOVE; /* Need to move to the start of the new line after the gap */ |
| 1333 | continue; |
| 1334 | } |
| 1335 | /* Get coordinates for this border */ |
| 1336 | np = gmtlib_map_path (GMT, lonstart[this], latstart[this], lonstop[this], latstop[this], &xx, &yy); |
| 1337 | for (i = 0; i < np; i++) /* Project to inches */ |
| 1338 | gmt_geo_to_xy (GMT, xx[i], yy[i], &xx[i], &yy[i]); |
| 1339 | next = this + 1; /* Find ID of next side */ |
| 1340 | if (next > W_SIDE) next = S_SIDE; /* Wrap around */ |
| 1341 | if (!GMT->current.map.frame.side[next]) flag |= PSL_STROKE; /* Must stroke line since a gap follows */ |
| 1342 | else if (n_sides == 4 && this == W_SIDE) flag |= (PSL_STROKE+PSL_CLOSE); /* Must close and stroke line since no gaps */ |
| 1343 | GMT_Report (GMT->parent, GMT_MSG_DEBUG, "gmtplot_wesn_map_boundary doing side %d with flag = %d\n", this, flag); |
| 1344 | |
| 1345 | PSL_plotline (PSL, xx, yy, (int)np, flag); |
| 1346 | gmt_M_free (GMT, xx); |
| 1347 | gmt_M_free (GMT, yy); |
| 1348 | n_set++; |
| 1349 | flag = 0; |
| 1350 | } |
| 1351 | } |
| 1352 | |
| 1353 | GMT_LOCAL double gmtplot_fancy_fat_pen_width (struct GMT_CTRL *GMT) { |
| 1354 | /* Return the pen width of the black/white checker fancy frame in points */ |
no test coverage detected