MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / gmtplot_polar_map_boundary

Function gmtplot_polar_map_boundary

src/gmt_plot.c:1422–1501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1420/* GMT_POLAR (S or N) PROJECTION MAP BOUNDARY */
1421
1422GMT_LOCAL void gmtplot_polar_map_boundary (struct GMT_CTRL *GMT, struct PSL_CTRL *PSL, double w, double e, double s, double n) {
1423 bool dual = false;
1424 unsigned int cap = PSL->internal.line_cap;
1425 double thin_pen, fat_pen, lon_range = e - w;
1426 double x0, x1, x2, y0, y1, y2, start, stop;
1427
1428 if (GMT->common.R.oblique) { /* Draw rectangular boundary and return */
1429 gmtplot_rect_map_boundary (GMT, PSL, 0.0, 0.0, GMT->current.proj.rect[XHI], GMT->current.proj.rect[YHI]);
1430 return;
1431 }
1432
1433 if (!GMT->current.proj.north_pole && gmt_M_is_Spole (s)) /* Cannot have southern boundary */
1434 GMT->current.map.frame.side[S_SIDE] = GMT_AXIS_NONE;
1435 if (GMT->current.proj.north_pole && gmt_M_is_Npole (n)) /* Cannot have northern boundary */
1436 GMT->current.map.frame.side[N_SIDE] = GMT_AXIS_NONE;
1437 if (gmt_M_360_range (w, e) || doubleAlmostEqualZero (e, w))
1438 GMT->current.map.frame.side[E_SIDE] = GMT->current.map.frame.side[W_SIDE] = GMT_AXIS_NONE;
1439
1440 if (!(GMT->current.setting.map_frame_type & GMT_IS_FANCY)) { /* Draw plain boundary and return */
1441 gmtplot_wesn_map_boundary (GMT, PSL, w, e, s, n);
1442 return;
1443 }
1444
1445 /* Here draw fancy map boundary */
1446
1447 fat_pen = gmtplot_fancy_fat_pen_width (GMT);
1448 if (GMT->current.map.frame.axis[GMT_Y].item[GMT_TICK_LOWER].active) { /* Need two-layer frame */
1449 fat_pen *= 0.5;
1450 dual = true;
1451 }
1452 thin_pen = gmtplot_fancy_thin_pen_width (GMT, fat_pen);
1453
1454 /* Draw frame checkers */
1455 /* This needs to be done with BUTT cap since checker segments are drawn as heavy lines */
1456
1457 PSL_setlinewidth (PSL, fat_pen);
1458 PSL_setlinecap (PSL, PSL_BUTT_CAP);
1459
1460 gmtplot_fancy_frame_straightlat_checkers (GMT, PSL, w, e, s, n, dual);
1461 gmtplot_fancy_frame_curvedlon_checkers (GMT, PSL, w, e, s, n, dual);
1462
1463 /* Draw the outline on top of the checkers */
1464 /* Reset line cap, etc. */
1465
1466 PSL_setlinecap (PSL, cap);
1467 PSL_setcolor (PSL, GMT->current.setting.map_frame_pen.rgb, PSL_IS_STROKE);
1468 PSL_setlinewidth (PSL, thin_pen);
1469
1470 gmtplot_fancy_frame_curved_outline (GMT, PSL, w, s, e, s, S_SIDE, dual);
1471 gmtplot_fancy_frame_straight_outline (GMT, PSL, e, s, e, n, E_SIDE, dual);
1472 gmtplot_fancy_frame_curved_outline (GMT, PSL, w, n, e, n, N_SIDE, dual);
1473 gmtplot_fancy_frame_straight_outline (GMT, PSL, w, n, w, s, W_SIDE, dual);
1474
1475 gmtplot_rounded_framecorners (GMT, PSL, w, e, s, n, dual);
1476
1477 if (GMT->current.proj.north_pole && gmt_M_is_Npole (n) && !(doubleAlmostEqual (lon_range, 180.0) || doubleAlmostEqual (lon_range, 360.0))) {
1478 /* Connect the outer straight borders with an arc using map frame pen */
1479 double radius = fat_pen * GMT->session.u2u[GMT_PT][GMT_INCH]; /* Get radius in inches */

Callers 1

gmtplot_map_boundaryFunction · 0.85

Tested by

no test coverage detected