Skip to content

Commit

Permalink
Promote gmtinit_round_wesn to gmt_round_wesn (#5571)
Browse files Browse the repository at this point in the history
This is needed so it may be used in certain modules that sets the region differently than via -R, such as coupe.
  • Loading branch information
PaulWessel committed Jul 30, 2021
1 parent 3fe21a3 commit 09ac529
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/gmt_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -13804,7 +13804,7 @@ GMT_LOCAL bool gmtinit_is_PS_module (struct GMTAPI_CTRL *API, const char *name,
return true; /* Remaining PostScript producing modules always write PostScript */
}

GMT_LOCAL void gmtinit_round_wesn (double wesn[], bool geo) { /* Use data range to round to nearest reasonable multiples */
void gmt_round_wesn (double wesn[], bool geo) { /* Use data range to round to nearest reasonable multiples */
bool set[2] = {false, false};
unsigned int side, item;
double mag, inc, range[2] = {0.0, 0.0};
Expand Down Expand Up @@ -13886,7 +13886,7 @@ GMT_LOCAL int gmtinit_get_region_from_data (struct GMTAPI_CTRL *API, int family,
return API->error; /* Failure to read grid header */
gmt_M_memcpy (wesn, G->header->wesn, 4, double); /* Copy over the grid region */
HH = gmt_get_H_hidden (G->header);
if (!exact) gmtinit_round_wesn (wesn, HH->grdtype > 0); /* Use grid w/e/s/n to round to nearest reasonable multiples */
if (!exact) gmt_round_wesn (wesn, HH->grdtype > 0); /* Use grid w/e/s/n to round to nearest reasonable multiples */
if (GMT_Destroy_Data (API, &G) != GMT_NOERROR) return API->error; /* Failure to destroy the temporary grid structure */
}
break;
Expand Down Expand Up @@ -14017,7 +14017,7 @@ GMT_LOCAL int gmtinit_get_region_from_data (struct GMTAPI_CTRL *API, int family,
if (GMT_Destroy_Data (API, &Out) != GMT_OK)
return (API->error);
geo = gmt_M_is_geographic (API->GMT, GMT_IN);
if (!exact) gmtinit_round_wesn (wesn, geo); /* Use data range to round to nearest reasonable multiples */
if (!exact) gmt_round_wesn (wesn, geo); /* Use data range to round to nearest reasonable multiples */
/* Safety valve if w == e or s == n */
if (doubleAlmostEqualZero (wesn[XLO], wesn[XHI])) {
if (gmt_M_is_zero (wesn[XLO])) /* No info to do anything other than this */
Expand Down
1 change: 1 addition & 0 deletions src/gmt_prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ EXTERN_MSC int gmt_nc_create (struct GMT_CTRL *GMT, char *path, int mode, int *i

/* gmt_init.c: */

EXTERN_MSC void gmt_round_wesn (double wesn[], bool geo);
EXTERN_MSC int gmt_get_dim_unit (struct GMT_CTRL *GMT, char c);
EXTERN_MSC void gmt_set_undefined_axes (struct GMT_CTRL *GMT, bool conf_update);
EXTERN_MSC void gmt_set_undefined_defaults (struct GMT_CTRL *GMT, double plot_dim, bool conf_update);
Expand Down

0 comments on commit 09ac529

Please sign in to comment.