Skip to content

Commit

Permalink
Merge branch 'master' into psconvert-no-file-dup
Browse files Browse the repository at this point in the history
  • Loading branch information
joa-quim committed Nov 22, 2024
2 parents 7e2a38d + 373034f commit 077dbb2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/gmt_notposix.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@

#ifndef NAN
# ifdef _MSC_VER
static const double _NAN = (-(float)(((float)(1e+300 * 1e+300)) * 0.0F));
# define NAN _NAN
# include <ymath.h>
# define NAN _Nan._Double
# else /* _MSC_VER */
static const double _NAN = (HUGE_VAL-HUGE_VAL);
# define NAN _NAN
Expand Down
35 changes: 29 additions & 6 deletions src/gmtlogo.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@
#define THIS_MODULE_NEEDS "jr"
#define THIS_MODULE_OPTIONS "->KJOPRUVXYtxy" GMT_OPT("c")

#define GMT_N_LETTERS 116
static float gmt_letters[GMT_N_LETTERS][2] = { /* The G, M, T polygons */
{ NAN, NAN },

#define GMT_N_LETTERS_G 92
#define GMT_N_LETTERS_M 13
#define GMT_N_LETTERS_T 8
#define GMT_N_LETTERS (GMT_N_LETTERS_G + GMT_N_LETTERS_M + GMT_N_LETTERS_T + 3)

static float gmt_letters_g[GMT_N_LETTERS_G][2] = { /* The G polygons */
{ -59.5, -41.8 },
{ -59.5, 2.2 },
{ -105, 2.2 },
Expand Down Expand Up @@ -128,7 +132,8 @@ static float gmt_letters[GMT_N_LETTERS][2] = { /* The G, M, T polygons */
{ -72.7, -32 },
{ -71.96, -30.8 },
{ -68.04, -41.8 },
{ NAN, NAN },
};
static float gmt_letters_m[GMT_N_LETTERS_M][2] = { /* The M polygons */
{ -37.8, -41.8 },
{ -23.8, -41.8 },
{ -23.8, 27.39 },
Expand All @@ -142,7 +147,8 @@ static float gmt_letters[GMT_N_LETTERS][2] = { /* The G, M, T polygons */
{ 12.46, -29.7 },
{ -17.22, 40.48 },
{ -37.8, 40.48 },
{ NAN, NAN },
};
static float gmt_letters_t[GMT_N_LETTERS_T][2] = { /* The T polygons */
{ 124.46, -41.8 },
{ 124.46, 30.47 },
{ 160.02, 30.47 },
Expand Down Expand Up @@ -329,12 +335,13 @@ static int parse (struct GMT_CTRL *GMT, struct GMTLOGO_CTRL *Ctrl, struct GMT_OP

EXTERN_MSC int GMT_gmtlogo (void *V_API, int mode, void *args) {
/* High-level function that implements the gmtlogo task */
int error, fmode;
int error, fmode, idx = 0;

uint64_t par[4] = {0, 0, 0, 0};

double wesn[4] = {0.0, 0.0, 0.0, 0.0}; /* Dimensions in inches */
double scale, y, dim[2];
float gmt_letters[GMT_N_LETTERS][2];

char cmd[GMT_LEN256] = {""}, pars[GMT_LEN128] = {""}, file[GMT_VF_LEN] = {""};

Expand Down Expand Up @@ -439,6 +446,22 @@ EXTERN_MSC int GMT_gmtlogo (void *V_API, int mode, void *args) {

/* Plot the GMT letters as shadows, then full size, using GMT_psxy */

/* Copy the polygons into the gmt_letters array, with NAN records as segment separators */
gmt_letters[idx][0] = NAN;
gmt_letters[idx][1] = NAN;
idx += 1;
memcpy(gmt_letters + idx, gmt_letters_g, sizeof(gmt_letters_g));
idx += GMT_N_LETTERS_G;
gmt_letters[idx][0] = NAN;
gmt_letters[idx][1] = NAN;
idx += 1;
memcpy(gmt_letters + idx, gmt_letters_m, sizeof(gmt_letters_m));
idx += GMT_N_LETTERS_M;
gmt_letters[idx][0] = NAN;
gmt_letters[idx][1] = NAN;
idx += 1;
memcpy(gmt_letters + idx, gmt_letters_t, sizeof(gmt_letters_t));

/* Allocate a matrix container for holding the GMT-matrix coordinates */
par[0] = 2; par[1] = GMT_N_LETTERS;
if ((M = GMT_Create_Data (API, GMT_IS_DATASET|GMT_VIA_MATRIX, GMT_IS_POLY, GMT_CONTAINER_ONLY, par, NULL, NULL, 0, GMT_IS_ROW_FORMAT, NULL)) == NULL)
Expand Down
4 changes: 2 additions & 2 deletions src/segy/segy2grd.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ static int parse (struct GMT_CTRL *GMT, struct SEGY2GRD_CTRL *Ctrl, struct GMT_O
break;
case 'L':
n_errors += gmt_M_repeated_module_option (API, Ctrl->L.active);
n_errors += gmt_get_required_int (GMT, &opt->arg[1], opt->option, 0, &Ctrl->L.value);
n_errors += gmt_get_required_int (GMT, opt->arg, opt->option, 0, &Ctrl->L.value);
break;
case 'M':
n_errors += gmt_M_repeated_module_option (API, Ctrl->M.active);
n_errors += gmt_get_required_uint (GMT, &opt->arg[1], opt->option, 0, &Ctrl->M.value);
n_errors += gmt_get_required_uint (GMT, opt->arg, opt->option, 0, &Ctrl->M.value);
break;
case 'N': /* Deprecated 7.29.2021 PW, use -di */
if (gmt_M_compat_check (GMT, 6)) { /* Honor old -N<value> option */
Expand Down

0 comments on commit 077dbb2

Please sign in to comment.