From 2ca2ed05a796dc9d8c567413c54d76521a7df9e7 Mon Sep 17 00:00:00 2001 From: Paul Wessel Date: Fri, 17 Jul 2020 19:11:22 -1000 Subject: [PATCH] if -R -J is given with -T then we must deal with them (#3675) * if -R -J is given with -T then we must deal with them The inisital PR only called map_setup if RJ was required but in fact we must call map_setup if -R -J is given. * Update gmt_init.c --- src/gmt_init.c | 6 ++++-- src/psxy.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gmt_init.c b/src/gmt_init.c index af190eb6591..ce58a0e0855 100644 --- a/src/gmt_init.c +++ b/src/gmt_init.c @@ -13675,8 +13675,10 @@ struct GMT_CTRL *gmt_init_module (struct GMTAPI_CTRL *API, const char *lib_name, } if (options && strstr (mod_name, "mapproject") && (opt = GMT_Find_Option (API, 'W', *options))) /* Must turn on JR */ required = "JR"; - if (options && !strcmp (mod_name, "psxy") && (opt = GMT_Find_Option (API, 'T', *options)) && (opt = GMT_Find_Option (API, 'B', *options)) == NULL) /* Can turn off JR if -T and no -B */ - required = ""; + if (options && !strcmp (mod_name, "psxy") && (opt = GMT_Find_Option (API, 'T', *options)) && (opt = GMT_Find_Option (API, 'B', *options)) == NULL) { /* Can turn off JR if -T and no -B as long as -X -Y do not contain c */ + if (!(((opt = GMT_Find_Option (API, 'X', *options)) && opt->arg[0] == 'c') || ((opt = GMT_Find_Option (API, 'Y', *options)) && opt->arg[0] == 'c'))) + required = ""; + } if (options && strstr (mod_name, "grdflexure") && (opt = GMT_Find_Option (API, 'Q', *options))) /* Must turn of g */ required = ""; diff --git a/src/psxy.c b/src/psxy.c index 9cb49568475..e6eeb1acd86 100644 --- a/src/psxy.c +++ b/src/psxy.c @@ -1060,7 +1060,7 @@ EXTERN_MSC int GMT_psxy (void *V_API, int mode, void *args) { Return (GMT_RUNTIME_ERROR); GMT_Report (API, GMT_MSG_DEBUG, "Operation will require %d input columns [n_cols_start = %d]\n", n_needed, n_cols_start); - if (!Ctrl->no_RJ_needed && gmt_M_err_pass (GMT, gmt_map_setup (GMT, GMT->common.R.wesn), "")) + if (GMT->common.R.active[RSET] && GMT->common.J.active && gmt_M_err_pass (GMT, gmt_map_setup (GMT, GMT->common.R.wesn), "")) Return (GMT_PROJECTION_ERROR); if (S.u_set) { /* When -Sc is given we temporarily reset the system unit to these units so conversions will work */ save_u = GMT->current.setting.proj_length_unit;