| 471 | /* GMT_LINEAR PROJECTION MAP BOUNDARY */ |
| 472 | |
| 473 | GMT_LOCAL void gmtplot_linear_map_boundary (struct GMT_CTRL *GMT, struct PSL_CTRL *PSL, double w, double e, double s, double n) { |
| 474 | unsigned int cap = PSL->internal.line_cap; |
| 475 | double x_length, y_length; |
| 476 | |
| 477 | x_length = GMT->current.proj.rect[XHI] - GMT->current.proj.rect[XLO]; |
| 478 | y_length = GMT->current.proj.rect[YHI] - GMT->current.proj.rect[YLO]; |
| 479 | |
| 480 | if (GMT->current.setting.map_frame_type == GMT_IS_GRAPH && GMT->current.setting.map_graph_origin_txt[0]) { |
| 481 | if (strchr (GMT->current.setting.map_graph_origin_txt, '/')) { /* Gave a coordinate pair */ |
| 482 | /* Convert the graph origin string coordinates to internal values */ |
| 483 | char txt_a[GMT_LEN128] = {""}, txt_b[GMT_LEN128] = {""}; |
| 484 | unsigned int n_errors = 0; |
| 485 | |
| 486 | sscanf (&GMT->current.setting.map_graph_origin_txt[2], "%[^/]/%s", txt_a, txt_b); |
| 487 | n_errors += gmt_verify_expectations (GMT, gmt_M_type (GMT, GMT_IN, GMT_X), |
| 488 | gmt_scanf_arg (GMT, txt_a, gmt_M_type (GMT, GMT_IN, GMT_X), false, |
| 489 | &GMT->current.setting.map_graph_origin[GMT_X]), txt_a); |
| 490 | n_errors += gmt_verify_expectations (GMT, gmt_M_type (GMT, GMT_IN, GMT_Y), |
| 491 | gmt_scanf_arg (GMT, txt_b, gmt_M_type (GMT, GMT_IN, GMT_Y), false, |
| 492 | &GMT->current.setting.map_graph_origin[GMT_Y]), txt_b); |
| 493 | if (n_errors) { |
| 494 | GMT_Report (GMT->parent, GMT_MSG_WARNING, "Graph origin modifier set with MAP_FRAME_TYPE could not be parsed (%s) - origin remains at (0,0)\n", |
| 495 | GMT->current.setting.map_graph_origin_txt); |
| 496 | gmt_M_memset (GMT->current.setting.map_graph_origin, 2, double); |
| 497 | } |
| 498 | } |
| 499 | else { /* Gave +oc for centered on current user domain */ |
| 500 | GMT->current.setting.map_graph_origin[GMT_X] = 0.5 * (GMT->common.R.wesn[XLO] + GMT->common.R.wesn[XHI]); |
| 501 | GMT->current.setting.map_graph_origin[GMT_Y] = 0.5 * (GMT->common.R.wesn[YLO] + GMT->common.R.wesn[YHI]); |
| 502 | } |
| 503 | GMT->current.setting.map_graph_shift = 0.0; |
| 504 | } |
| 505 | |
| 506 | PSL_command (PSL, "/PSL_slant_y 0 def /PSL_slant_x 0 def\n"); /* Unless x-annotations are slanted there is no adjustment. PSL_slant_y may be revised in gmt_xy_axis */ |
| 507 | |
| 508 | if (GMT->current.map.frame.draw) { |
| 509 | /* Temporarily change to square cap so rectangular frames have neat corners */ |
| 510 | PSL_setlinecap (PSL, PSL_SQUARE_CAP); |
| 511 | |
| 512 | if (GMT->current.map.frame.side[W_SIDE]) gmt_xy_axis (GMT, GMT->current.proj.rect[XLO], GMT->current.proj.rect[YLO], y_length, s, n, |
| 513 | &GMT->current.map.frame.axis[GMT_Y], true, GMT->current.map.frame.side[W_SIDE]); /* West or left y-axis */ |
| 514 | if (GMT->current.map.frame.side[E_SIDE]) gmt_xy_axis (GMT, GMT->current.proj.rect[XHI], GMT->current.proj.rect[YLO], y_length, s, n, |
| 515 | &GMT->current.map.frame.axis[GMT_Y], false, GMT->current.map.frame.side[E_SIDE]); /* East or right y-axis */ |
| 516 | if (GMT->current.map.frame.side[S_SIDE]) gmt_xy_axis (GMT, GMT->current.proj.rect[XLO], GMT->current.proj.rect[YLO], x_length, w, e, |
| 517 | &GMT->current.map.frame.axis[GMT_X], true, GMT->current.map.frame.side[S_SIDE]); /* South or lower x-axis */ |
| 518 | if (GMT->current.map.frame.side[N_SIDE]) gmt_xy_axis (GMT, GMT->current.proj.rect[XLO], GMT->current.proj.rect[YHI], x_length, w, e, |
| 519 | &GMT->current.map.frame.axis[GMT_X], false, GMT->current.map.frame.side[N_SIDE]); /* North or upper x-axis */ |
| 520 | |
| 521 | PSL_setlinecap (PSL, cap); /* Reset back to default */ |
| 522 | } |
| 523 | if (!GMT->current.map.frame.header[0] || GMT->current.map.frame.plotted_header) return; /* No title (and optional subtitle) today */ |
| 524 | |
| 525 | PSL_comment (PSL, "Placing plot title\n"); |
| 526 | |
| 527 | y_length += GMT->current.setting.map_graph_shift; /* Extra shift (set in gmt_xy_axis) for map title when we have a centered y-axis with vector */ |
| 528 | |
| 529 | if (!GMT->current.map.frame.draw || GMT->current.map.frame.side[N_SIDE] <= GMT_AXIS_DRAW || GMT->current.setting.map_frame_type == GMT_IS_INSIDE) |
| 530 | PSL_defunits (PSL, "PSL_H_y", GMT->current.setting.map_title_offset); /* No ticks or annotations, offset by map_title_offset only */ |
no test coverage detected