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

Function gmtplot_map_griditems

src/gmt_plot.c:6419–6447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6417
6418
6419GMT_LOCAL void gmtplot_map_griditems (struct GMT_CTRL *GMT) {
6420 double w, e, s, n;
6421 struct PSL_CTRL *PSL= GMT->PSL;
6422
6423 if (GMT->current.map.frame.gridline_plotted) return; /* Already plotted */
6424 if (GMT->current.map.frame.order == GMT_BASEMAP_BEFORE && GMT->current.map.frame.basemap_flag & GMT_BASEMAP_GRID_AFTER) return; /* Wrong order */
6425 if (GMT->current.map.frame.order == GMT_BASEMAP_AFTER && !(GMT->current.map.frame.basemap_flag & GMT_BASEMAP_GRID_AFTER)) return; /* Wrong order */
6426
6427 if (GMT->common.B.active[GMT_PRIMARY] && GMT->common.B.active[GMT_SECONDARY]) {
6428 /* Make sure primary intervals are < than secondary intervals, otherwise we swap them */
6429 gmtplot_check_primary_secondary (GMT);
6430 }
6431
6432 w = GMT->common.R.wesn[XLO], e = GMT->common.R.wesn[XHI], s = GMT->common.R.wesn[YLO], n = GMT->common.R.wesn[YHI];
6433
6434 PSL_comment (PSL, "Start of gridlines - if any\n");
6435
6436 PSL_setdash (PSL, NULL, 0); /* To ensure no dashed pens are set prior */
6437
6438 if (GMT->current.proj.got_azimuths) gmt_M_uint_swap (GMT->current.map.frame.side[E_SIDE], GMT->current.map.frame.side[W_SIDE]); /* Temporary swap to trick justify machinery */
6439
6440 gmtplot_map_gridlines (GMT, PSL, w, e, s, n); /* At most only one of these three would kick in */
6441 gmtplot_map_gridcross (GMT, PSL, w, e, s, n);
6442 gmtplot_map_gridticks (GMT, PSL, w, e, s, n);
6443
6444 if (GMT->current.proj.got_azimuths) gmt_M_uint_swap (GMT->current.map.frame.side[E_SIDE], GMT->current.map.frame.side[W_SIDE]); /* Undo temporary swap */
6445
6446 GMT->current.map.frame.gridline_plotted = true; /* Since gmtplot_map_gridlines is called in gmt_map_basemap we flag if we already have done this step */
6447}
6448
6449GMT_LOCAL void gmtplot_map_tick_marks (struct GMT_CTRL *GMT) {
6450 double w, e, s, n;

Callers 1

gmt_map_basemapFunction · 0.85

Calls 6

PSL_commentFunction · 0.85
PSL_setdashFunction · 0.85
gmtplot_map_gridlinesFunction · 0.85
gmtplot_map_gridcrossFunction · 0.85
gmtplot_map_gridticksFunction · 0.85

Tested by

no test coverage detected