1 /*-------------------------------------------------------------------- 2 * 3 * Copyright (c) 1991-2021 by the GMT Team (https://www.generic-mapping-tools.org/team.html) 4 * See LICENSE.TXT file for copying and redistribution conditions. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU Lesser General Public License as published by 8 * the Free Software Foundation; version 3 or any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * Contact info: www.generic-mapping-tools.org 16 *--------------------------------------------------------------------*/ 17 /* 18 * gmt_constants.h contains definitions of constants used through GMT. 19 * 20 * Author: Paul Wessel 21 * Date: 01-OCT-2009 22 * Version: 6 API 23 */ 24 25 /*! 26 * \file gmt_constants.h 27 * \brief Definitions of constants used through GMT. 28 */ 29 30 #ifndef GMT_CONSTANTS_H 31 #define GMT_CONSTANTS_H 32 33 /*===================================================================================== 34 * GMT API CONSTANTS DEFINITIONS 35 *===================================================================================*/ 36 37 #include "gmt_error_codes.h" /* All API error codes are defined here */ 38 39 /*-------------------------------------------------------------------- 40 * GMT CONSTANTS MACRO DEFINITIONS 41 *--------------------------------------------------------------------*/ 42 43 #ifndef TWO_PI 44 #define TWO_PI 6.28318530717958647692 45 #endif 46 #ifndef M_PI 47 #define M_PI 3.14159265358979323846 48 #endif 49 #ifndef M_PI_2 50 #define M_PI_2 1.57079632679489661923 51 #endif 52 #ifndef M_PI_4 53 #define M_PI_4 0.78539816339744830962 54 #endif 55 #ifndef M_E 56 #define M_E 2.7182818284590452354 57 #endif 58 #ifndef M_SQRT2 59 #define M_SQRT2 1.41421356237309504880 60 #endif 61 #ifndef M_LN2_INV 62 #define M_LN2_INV (1.0 / 0.69314718055994530942) 63 #endif 64 #ifndef M_EULER 65 #define M_EULER 0.577215664901532860606512 /* Euler's constant (gamma) */ 66 #endif 67 #ifndef M_PHI 68 #define M_PHI 1.618033988749894848204587 /* Golden ratio (phi) */ 69 #endif 70 #define MAD_NORMALIZE 1.4826 /* 1/N^{-1}(0.75), where z = \N^{-1}(p) is the inverse cumulative normal distribution */ 71 72 #define GMT_CONV15_LIMIT 1.0e-15 /* Very tight convergence limit or "close to zero" limit */ 73 #define GMT_CONV12_LIMIT 1.0e-12 /* Tight limit for gaps/overlaps in CPT z-values */ 74 #define GMT_CONV8_LIMIT 1.0e-8 /* Fairly tight convergence limit or "close to zero" limit */ 75 #define GMT_CONV6_LIMIT 1.0e-6 /* 1 ppm */ 76 #define GMT_CONV5_LIMIT 1.0e-5 /* 10 ppm */ 77 #define GMT_CONV4_LIMIT 1.0e-4 /* Less tight convergence limit or "close to zero" limit */ 78 79 #define GMT_ASCII_ES 27 /* ASCII code for escape (used to prevent +? strings in plain text from being seen as modifiers) */ 80 #define GMT_ASCII_GS 29 /* ASCII code for group separator (temporarily replacing tabs) */ 81 #define GMT_ASCII_RS 30 /* ASCII code for record separator (temporarily replacing spaces in filenames) */ 82 #define GMT_ASCII_US 31 /* ASCII code for unit separator (temporarily replacing spaces in quoted text) */ 83 84 #define GMT_RENAME_FILE 0 85 #define GMT_COPY_FILE 1 86 87 #define GMT_CONTROLLER 0 /* func_level of controlling process (gmt.c or external API) */ 88 #define GMT_TOP_MODULE 1 /* func_level of top-level module being called */ 89 90 #define GMT_PAPER_DIM 32767 /* Upper limit on PostScript paper size under modern mode, in points (~11.6 meters) */ 91 #define GMT_PAPER_MARGIN_AUTO 5 /* Default paper margin under modern mode, in inches (12.7 centimeter) for auto-size mode */ 92 #define GMT_PAPER_MARGIN_FIXED 1 /* Default paper margin under modern mode, in inches (2.54 centimeter) for fixed-size mode */ 93 94 #define GMT_JPEG_DEF_QUALITY 90 /* Default JPG quality value for psconvert -Tj */ 95 96 /*! Constants for use with calls to gmt_solve_svd (used in greenspline and geodesy/gpsgridder) */ 97 enum GMT_enum_svd { 98 GMT_SVD_EIGEN_RATIO_CUTOFF = 0, /* Only use eigenvalues whose ratio to the first exceeds a cutoff [0 = all] */ 99 GMT_SVD_EIGEN_NUMBER_CUTOFF = 1, /* Only use the first N largest eigenvalues */ 100 GMT_SVD_EIGEN_PERCENT_CUTOFF = 2, /* Only use a percentage of the (sorted) eigenvalues */ 101 GMT_SVD_EIGEN_VARIANCE_CUTOFF = 3, /* Find N eigenvalues that equals given percentage of variance explained */ 102 GMT_SVD_NO_HISTORY = 0, /* Only obtain final solution for selected eigenvalues */ 103 GMT_SVD_INCREMENTAL = 1, /* Evaluate incremental solution due to next added eigenvalue */ 104 GMT_SVD_CUMULATIVE = 2 /* Evaluate cumulative solution due to next added eigenvalue */ 105 }; 106 107 /*! whether to ignore/read/write history file gmt.history */ 108 enum GMT_enum_history { 109 /*! 0 */ GMT_HISTORY_OFF = 0, 110 /*! 1 */ GMT_HISTORY_READ, 111 /*! 2 */ GMT_HISTORY_WRITE 112 }; 113 114 /* Specific feature geometries as obtained from OGR */ 115 /* Note: As far as registering or reading data, GMT only needs to know if data type is POINT, LINE, or POLY */ 116 117 enum GMT_enum_ogr { 118 GMT_IS_LINESTRING = 2U, 119 GMT_IS_POLYGON = 4U, 120 GMT_IS_MULTI = 64U, /* Flag for multi-versions of geometry */ 121 GMT_IS_MULTIPOINT = 65U, /* 1 plus 64 for multi */ 122 GMT_IS_MULTILINESTRING = 66U, /* 2 plus 64 for multi */ 123 GMT_IS_MULTIPOLYGON = 68U}; /* 4 plus 64 for multi */ 124 125 /*! Various allocation-length parameters */ 126 enum GMT_enum_length { 127 GMT_DIM_SIZE = 4U, /* Length of dim array used in Read|Create Data */ 128 GMT_TINY_CHUNK = 8U, 129 GMT_SMALL_CHUNK = 64U, 130 GMT_CHUNK = 2048U, 131 GMT_BIG_CHUNK = 65536U, 132 GMT_LEN8 = 8U, 133 GMT_LEN16 = 16U, /* All strings used to format date/clock output must be this length */ 134 GMT_LEN32 = 32U, /* Small length of texts */ 135 GMT_LEN64 = 64U, /* Intermediate length of texts */ 136 GMT_LEN128 = 128U, /* Double of 64 */ 137 GMT_LEN256 = 256U, /* Max size of some text items */ 138 GMT_LEN512 = 512U, /* Max size of other text items */ 139 GMT_LEN1024 = 1024U, /* For file names (anticipating web fnames) */ 140 GMT_MAX_RANGES = 64U, /* Limit on number of row ranges given in -q */ 141 GMT_MAX_COLUMNS = 4096U, /* Limit on number of columns in data tables (not grids) */ 142 GMT_BUFSIZ = 4096U, /* Size of char record for i/o */ 143 GMT_MSGSIZ = 16384U, /* Size of char record for messages and report */ 144 GMT_MIN_MEMINC = 1U, /* E.g., 16 kb of 8-byte doubles */ 145 GMT_MAX_MEMINC = 67108864U}; /* E.g., 512 Mb of 8-byte doubles */ 146 147 /*! The four plot length units [m just used internally] */ 148 enum GMT_enum_unit { 149 GMT_CM = 0, 150 GMT_INCH, 151 GMT_M, 152 GMT_PT}; 153 154 /*! Flags for 1-D array arg parsing */ 155 enum GMT_enum_array { 156 GMT_ARRAY_RANGE = 1, 157 GMT_ARRAY_TIME = 2, 158 GMT_ARRAY_DIST = 4, 159 GMT_ARRAY_NOINC = 8, 160 GMT_ARRAY_SCALAR = 16, 161 GMT_ARRAY_NOMINMAX = 32, 162 GMT_ARRAY_ROUND = 64, 163 GMT_ARRAY_UNIQUE = 128}; 164 165 /*! Handling of swap/no swap in i/o */ 166 enum GMT_swap_direction { 167 k_swap_none = 0, 168 k_swap_in, 169 k_swap_out}; 170 171 /*! Scripting languages */ 172 enum GMT_enum_script {GMT_BASH_MODE = 0, /* Write Bash script */ 173 GMT_CSH_MODE, /* Write C-shell script */ 174 GMT_DOS_MODE}; /* Write DOS script */ 175 176 /*! Various mode for basemap order */ 177 enum GMT_enum_basemap { 178 GMT_BASEMAP_BEFORE = 0, 179 GMT_BASEMAP_AFTER = 1, 180 GMT_BASEMAP_FRAME_BEFORE = 0, 181 GMT_BASEMAP_FRAME_AFTER = 1, 182 GMT_BASEMAP_GRID_BEFORE = 0, 183 GMT_BASEMAP_GRID_AFTER = 2, 184 GMT_BASEMAP_ANNOT_BEFORE = 0, 185 GMT_BASEMAP_ANNOT_AFTER = 4}; 186 187 /*! Handling of periodic data */ 188 enum GMT_time_period { 189 GMT_CYCLE_SEC = 1, 190 GMT_CYCLE_MIN, 191 GMT_CYCLE_HOUR, 192 GMT_CYCLE_DAY, 193 GMT_CYCLE_WEEK, 194 GMT_CYCLE_YEAR, 195 GMT_CYCLE_ANNUAL, 196 GMT_CYCLE_CUSTOM}; 197 198 /* Since -I is not a global option but we almost use it as such, we define the long-option for it here. 199 * Modules that need it in their module_kw[] array can just add it to their list. */ 200 #define GMT_INCREMENT_KW { '/', 'I', "increment", "", "", "e,n", "exact,number" } 201 202 #define GMT_VERBOSE_CODES "q ewticd" /* List of valid codes to -V (the blank is for NOTICE which is not user selectable */ 203 #define GMT_DIM_UNITS "cip" /* Plot dimensions in cm, inch, or point */ 204 #define GMT_LEN_UNITS2 "efkMnu" /* Distances in meter, foot, survey foot, km, Mile, nautical mile */ 205 #define GMT_LEN_UNITS "dmsefkMnu" /* Distances in arc-{degree,minute,second} or meter, foot, km, Mile, nautical mile, survey foot */ 206 #define GMT_ARC_UNITS "dms" /* Distances in arc-{degree,minute,second}t */ 207 #define GMT_TIME_UNITS "yowdhms" /* Time increments in year, month, week, day, hour, min, sec */ 208 #define GMT_TIME_FIX_UNITS "wdhms" /* Fixed time increment units */ 209 #define GMT_TIME_VAR_UNITS "yo" /* Variable time increments in year or month*/ 210 #define GMT_WESN_UNITS "WESN" /* Sign-letters for geographic coordinates */ 211 #define GMT_DIM_UNITS_DISPLAY "c|i|p" /* Same, used to display as options */ 212 #define GMT_LEN_UNITS_DISPLAY "d|m|s|e|f|k|M|n|u" /* Same, used to display as options */ 213 #define GMT_LEN_UNITS2_DISPLAY "e|f|k|M|n|u" /* Same, used to display as options */ 214 #define GMT_TIME_UNITS_DISPLAY "y|o|w|d|h|m|s" /* Same, used to display as options */ 215 #define GMT_TIME_FIX_UNITS_DISPLAY "w|d|h|m|s" /* Same, used to display as options */ 216 #define GMT_DEG2SEC_F 3600.0 217 #define GMT_DEG2SEC_I 3600 218 #define GMT_SEC2DEG (1.0 / GMT_DEG2SEC_F) 219 #define GMT_DEG2MIN_F 60.0 220 #define GMT_DEG2MIN_I 60 221 #define GMT_MIN2DEG (1.0 / GMT_DEG2MIN_F) 222 #define GMT_MIN2SEC_F 60.0 223 #define GMT_MIN2SEC_I 60 224 #define GMT_SEC2MIN (1.0 / GMT_MIN2SEC_F) 225 #define GMT_DAY2HR_F 24.0 226 #define GMT_DAY2HR_I 24 227 #define GMT_HR2DAY (1.0 / GMT_DAY2HR_F) 228 #define GMT_WEEK2DAY_F 7.0 229 #define GMT_WEEK2DAY_I 7 230 #define GMT_WEEK2SEC_F 604800.0 231 #define GMT_WEEK2SEC_I 604800 232 #define GMT_SEC2WEEK (1.0 / GMT_WEEK2SEC_F) 233 #define GMT_DAY2WEEK (1.0 / GMT_WEEK2DAY_F) 234 #define GMT_DAY2MIN_F 1440.0 235 #define GMT_DAY2MIN_I 1440 236 #define GMT_MIN2DAY (1.0 / GMT_DAY2MIN_F) 237 #define GMT_DAY2SEC_F 86400.0 238 #define GMT_DAY2SEC_I 86400 239 #define GMT_SEC2DAY (1.0 / GMT_DAY2SEC_F) 240 #define GMT_HR2SEC_F 3600.0 241 #define GMT_HR2SEC_I 3600 242 #define GMT_SEC2HR (1.0 / GMT_HR2SEC_F) 243 #define GMT_HR2MIN_F 60.0 244 #define GMT_HR2MIN_I 60 245 #define GMT_MIN2HR (1.0 / GMT_HR2MIN_F) 246 247 #define GMT_YR2SEC_F (365.2425 * 86400.0) 248 #define GMT_MON2SEC_F (365.2425 * 86400.0 / 12.0) 249 250 #define GMT_LET_HEIGHT 0.728 /* Height of an "N" compared to point size */ 251 #define GMT_LET_WIDTH 0.564 /* Width of an "N" compared to point size */ 252 #define GMT_DEC_WIDTH 0.54 /* Width of a decimal number compared to point size */ 253 #define GMT_PER_WIDTH 0.30 /* Width of a decimal point compared to point size */ 254 255 #define GMT_PEN_LEN 128 256 #define GMT_PENWIDTH 0.25 /* Default pen width in points */ 257 #define GMT_TEXT_CLEARANCE 15 /* Clearance around text in textboxes, in percent */ 258 #define GMT_TEXT_OFFSET 20 /* Offset of text from refpoint, in percent */ 259 260 #define GMT_N_MAX_MODEL 20 /* No more than 20 basis functions in a trend model */ 261 262 #define GMT_PAIR_COORD 0 /* Tell gmt_get_pair to get both x and y as coordinates */ 263 #define GMT_PAIR_DIM_EXACT 1 /* Tell gmt_get_pair to get BOTH x and y as separate dimensions */ 264 #define GMT_PAIR_DIM_DUP 2 /* Tell gmt_get_pair to get both x and y as dimensions, and if only x then set y = x */ 265 #define GMT_PAIR_DIM_NODUP 3 /* Tell gmt_get_pair to get both x and y as dimensions, and if only x then leave y alone */ 266 267 #define GMT_GRID_LAYOUT "TRS" /* Standard GMT scanline single-item grid */ 268 #define GMT_IMAGE_LAYOUT "TRBa" /* Standard GMT scanline band-interleaved image */ 269 270 #define GMT_CPT_CONTINUOUS 8 /* Final CPT should be continuous */ 271 #define GMT_CPT_TEMPORARY 1024 /* CPT was built from list of colors, e.g., red,green,255,blue,... */ 272 #define GMT_CPT_C_REVERSE 1 /* Reverse CPT colors */ 273 #define GMT_CPT_Z_REVERSE 2 /* Reverse CPT z-values */ 274 #define GMT_CPT_L_ANNOT 1 /* Annotate lower slice boundary */ 275 #define GMT_CPT_U_ANNOT 2 /* Annotate upper slice boundary */ 276 #define GMT_CPT_B_ANNOT 3 /* Annotate lower and upper slice boundary */ 277 #define GMT_CPT_CATEGORICAL_VAL 1 /* Categorical CPT with numerical value */ 278 #define GMT_CPT_CATEGORICAL_KEY 2 /* Categorical CPT with text key */ 279 #define GMT_COLOR_AUTO_TABLE 1 /* Flag in rgb for auto-color changing per table */ 280 #define GMT_COLOR_AUTO_SEGMENT 2 /* Flag in rgb for auto-color changing per segment */ 281 #define GMT_CPT_INDEX_LBL 0 /* Index into hidden alloc_mode_text[] for labels */ 282 #define GMT_CPT_INDEX_KEY 1 /* Index into hidden alloc_mode_text[] for keys */ 283 284 /* Ticked contour settings */ 285 #define GMT_TICKED_SPACING 15.0 /* Spacing between ticked contour ticks (in points) */ 286 #define GMT_TICKED_LENGTH 3.0 /* Length of ticked contour ticks (in points) */ 287 288 /* Default CPT if nothing specified or overruled by remote dataset preferences */ 289 #define GMT_DEFAULT_CPT_NAME "turbo" 290 /* Default color list (or cpt) for automatic, sequential color choices */ 291 #define GMT_DEFAULT_COLOR_SET "#0072BD,#D95319,#EDB120,#7E2F8E,#77AC30,#4DBEEE,#A2142F" 292 293 /* CPT extension is pretty fixed */ 294 #define GMT_CPT_EXTENSION ".cpt" 295 #define GMT_CPT_EXTENSION_LEN 4U 296 297 #define GMT_IS_ROMAN_LCASE 1 /* For converting Arabic numerals to Roman */ 298 #define GMT_IS_ROMAN_UCASE 2 299 300 /* Settings for the MAP_FRAME_TYPE = graph */ 301 #define GMT_GRAPH_EXTENSION 7.5 /* In percent */ 302 #define GMT_GRAPH_EXTENSION_UNIT '%' /* In percent */ 303 304 /* Modes for subplot status */ 305 #define GMT_SUBPLOT_ACTIVE 1 306 #define GMT_PANEL_NOTSET 2 307 308 /* Fraction of increment to force outward region expansion */ 309 #define GMT_REGION_INCFACTOR 0.25 310 311 /* Allowable refpoint codes */ 312 #define GMT_REFPOINT_CODES "gjJnx" 313 314 /* Modifiers for contour -A option */ 315 #define GMT_CONTSPEC_MODS "acdefghijklLnNoprstuvwxX=" 316 317 /* Valid modifiers for various input files */ 318 319 /* Valid modifiers for -Tmin/max/inc array creator */ 320 #define GMT_ARRAY_MODIFIERS "abeilntu" 321 322 /* Modifiers for grid files: 323 * +d<divisor> divides all grid values by this divisor 324 * +o<offset> adds this offset to all grid values 325 * +n<nodata> sets what the no-data value is 326 * +s<scl> scales all grid values by this scale 327 * +u<unit> converts Cartesian x/y coordinates from given unit to meters 328 * +U<unit> converts Cartesian x/y coordinates from meter to given unit 329 */ 330 #define GMT_GRIDFILE_MODIFIERS "donsuU" 331 332 /* Modifiers for CPT files: 333 * +h[<hinge>] to override soft-hinge value in CPT 334 * +i<dz> is used to round auto-determined min/max range to a multiple of dz. 335 * +u<unit> converts z-values from given unit to meters 336 * +U<unit> converts z-values from meter to given unit 337 */ 338 #define GMT_CPTFILE_MODIFIERS "hiuU" 339 340 /* Valid options to psconvert from figure and begin */ 341 #define GMT_PSCONVERT_LIST "ACDEHIMNQS" 342 343 /* Valid frame setting modifiers */ 344 #define GMT_FRAME_MODIFIERS "bginotwxyz" 345 /* Valid axis setting modifiers */ 346 #define GMT_AXIS_MODIFIERS "aefLlpsSu" 347 348 /* Settings for usage message indents and break/continue characters */ 349 350 #define GMT_LINE_BREAK "\xe2\x8f\x8e" /* Glyph for return symbol in UTF-8 */ 351 #define GMT_LINE_CONT "\xe2\x80\xa6" /* Ellipsis for continue symbol in UTF-8 */ 352 #define GMT_LINE_BULLET "\xe2\x80\xa2" /* Bullet glyph */ 353 354 /*! Codes for grdtrack */ 355 enum GMT_enum_tracklayout { 356 GMT_LEFT_RIGHT = 1, 357 GMT_EW_SN = 2, 358 GMT_LEFT_ONLY = 4, 359 GMT_RIGHT_ONLY = 8, 360 GMT_ALTERNATE = 16, 361 GMT_FIXED_AZIM = 32}; 362 363 /*! Codes for first segment header */ 364 enum GMT_enum_firstseg { 365 GMT_FIRST_SEGHEADER_MAYBE = 0, 366 GMT_FIRST_SEGHEADER_ALWAYS, 367 GMT_FIRST_SEGHEADER_NEVER}; 368 369 /*! Return codes from gmt_inonout */ 370 enum GMT_enum_inside { 371 GMT_OUTSIDE = 0, 372 GMT_ONEDGE, 373 GMT_INSIDE}; 374 375 /*! Return codes from gmt_polygon_orientation */ 376 enum GMT_enum_polorient { 377 GMT_POL_IS_CCW = 0, 378 GMT_POL_IS_CW = 1}; 379 380 /*! Codes for -q selections */ 381 enum GMT_enum_skiprows { 382 GMT_RANGE_ROW_IN = 1, 383 GMT_RANGE_DATA_IN = 2, 384 GMT_RANGE_ROW_OUT = 3, 385 GMT_RANGE_DATA_OUT = 4}; 386 387 /*! Return codes from parsing region modifiers +r,+R,+e */ 388 enum GMT_enum_region { 389 GMT_REGION_ADD = 1, 390 GMT_REGION_ROUND, 391 GMT_REGION_ROUND_EXTEND}; 392 393 /*! Return codes from gmt_get_refpoint */ 394 enum GMT_enum_refpoint { 395 GMT_REFPOINT_NOTSET = -1, /* -D */ 396 GMT_REFPOINT_MAP, /* -Dg */ 397 GMT_REFPOINT_JUST, /* -Dj */ 398 GMT_REFPOINT_JUST_FLIP, /* -DJ */ 399 GMT_REFPOINT_NORM, /* -Dn */ 400 GMT_REFPOINT_PLOT}; /* -Dx */ 401 402 /* Various constants for map roses */ 403 enum GMT_enum_rose { 404 GMT_ROSE_DIR_PLAIN = 0, /* Direction map rose [plain] */ 405 GMT_ROSE_DIR_FANCY = 1, /* Direction map rose [fancy] */ 406 GMT_ROSE_MAG = 2, /* Magnetic map rose */ 407 GMT_ROSE_PRIMARY = 0, /* Primary [inner] annotation ring for magnetic rose */ 408 GMT_ROSE_SECONDARY = 1}; /* Secondary [outer] annotation ring for magnetic rose */ 409 410 /*! Various types of trend model */ 411 enum GMT_enum_model { 412 GMT_POLYNOMIAL = 0, GMT_CHEBYSHEV, GMT_COSINE, GMT_SINE, GMT_FOURIER}; 413 414 /*! Various array indices of fonts and pens */ 415 enum GMT_enum_index { 416 GMT_PRIMARY = 0, GMT_SECONDARY = 1}; 417 418 /*! Various mode for auto-download */ 419 enum GMT_enum_download { 420 GMT_NO_DOWNLOAD = 0, GMT_YES_DOWNLOAD = 1}; 421 422 /*! Various mode for auto-legend pens */ 423 enum GMT_enum_autolegend { 424 GMT_LEGEND_PEN_D = 0, GMT_LEGEND_PEN_V = 1, GMT_LEGEND_PEN_P = 2, 425 GMT_LEGEND_DRAW_D = 1, GMT_LEGEND_DRAW_V = 2, GMT_LEGEND_LABEL_FIXED = 0, 426 GMT_LEGEND_LABEL_FORMAT = 1, GMT_LEGEND_LABEL_LIST = 2, GMT_LEGEND_LABEL_HEADER = 3}; 427 428 /*! Various mode for label positioning */ 429 enum GMT_enum_maplabel { 430 GMT_LABEL_ANNOT = 0, GMT_LABEL_AXIS = 1}; 431 432 /*! Various mode for custom symbols */ 433 enum GMT_enum_customsymb { 434 GMT_CUSTOM_DEF = 1, 435 GMT_CUSTOM_EPS = 2}; 436 437 //#define GMT_LEGEND_DX1_MUL 1.0 /* Default offset from margin to center of symbol if given as '-' times max symbol size */ 438 //#define GMT_LEGEND_DX2_MUL 2.0 /* Default offset from margin to start of label if given as '-' times max symbol size */ 439 #define GMT_LEGEND_DX1_MUL 0.5 /* Default offset from margin to center of symbol if given as '-' times max symbol size */ 440 #define GMT_LEGEND_DX2_MUL 1.5 /* Default offset from margin to start of label if given as '-' times max symbol size */ 441 442 /*! Various mode for axes */ 443 enum GMT_enum_oblique { 444 GMT_OBL_ANNOT_LON_X_LAT_Y = 0, 445 GMT_OBL_ANNOT_ANYWHERE = 1, 446 GMT_OBL_ANNOT_LON_HORIZONTAL = 2, 447 GMT_OBL_ANNOT_LAT_HORIZONTAL = 4, 448 GMT_OBL_ANNOT_EXTEND_TICKS = 8, 449 GMT_OBL_ANNOT_NORMAL_TICKS = 16, 450 GMT_OBL_ANNOT_LAT_PARALLEL = 32, 451 GMT_OBL_ANNOT_FLAG_LIMIT = 64}; 452 453 /*! Various mode for axes */ 454 enum GMT_enum_axes { 455 GMT_AXIS_NONE = 0, 456 GMT_AXIS_DRAW = 1, 457 GMT_AXIS_TICK = 2, 458 GMT_AXIS_BARB = 3, 459 GMT_AXIS_ANNOT = 4, 460 GMT_AXIS_ALL = 7}; 461 462 /*! Various options for FFT calculations [Default is 0] */ 463 enum FFT_implementations { 464 k_fft_auto = 0, /* Automatically select best FFT algorithm */ 465 k_fft_accelerate, /* Select Accelerate Framework vDSP FFT [OS X only] */ 466 k_fft_fftw, /* Select FFTW */ 467 k_fft_kiss, /* Select Kiss FFT (always available) */ 468 k_fft_brenner, /* Select Brenner FFT (Legacy*/ 469 k_n_fft_algorithms /* Number of FFT implementations available in GMT */ 470 }; 471 472 /*! Selections for run mode */ 473 enum GMT_enum_runmode { 474 GMT_CLASSIC = 0, /* Select Classic GMT behavior with -O -K -R -J */ 475 GMT_MODERN}; /* Select Modern behavior where -O -K are disabled and -R -J optional if possible */ 476 477 /*! Selections for workflow mode */ 478 enum GMT_enum_workflowmode { 479 GMT_USE_WORKFLOW = 0, /* Default is to use current workflow if initiated and ignore if otherwise */ 480 GMT_BEGIN_WORKFLOW = 1, /* Initiate a new workflow via gmt begin */ 481 GMT_END_WORKFLOW = 2, /* Terminate current workflow via gmt begin */ 482 GMT_CLEAN_WORKFLOW = 4}; /* If given with BEGIN we ignore any gmt.conf files */ 483 484 /*! Selections for pen/fill color replacements in custom symbol macros */ 485 enum GMT_enum_colorswap { 486 GMT_USE_FILL_RGB = 1, /* Take pen color from that of the current fill */ 487 GMT_USE_PEN_RGB = 2}; /* Take fill color from that of the current pen */ 488 489 /*! Index for fill/stroke transparency value */ 490 enum GMT_enum_transp { 491 GMT_FILL_TRANSP = 0, /* transp[GMT_FILL_TRANSP] is used for filling */ 492 GMT_PEN_TRANSP = 1, /* transp[GMT_PEN_TRANSP] is used for stroking */ 493 GMT_SET_FILL_TRANSP = 1, /* Bit-flag for fill transparency */ 494 GMT_SET_PEN_TRANSP = 2, /* Bit-flag for stroke transparency */ 495 GMT_SET_ALL_TRANSP = 3}; /* Bit-flag for both transparencies */ 496 497 /*! Various algorithms for triangulations */ 498 enum GMT_enum_tri { 499 GMT_TRIANGLE_WATSON = 0, /* Select Watson's algorithm */ 500 GMT_TRIANGLE_SHEWCHUK}; /* Select Shewchuk's algorithm */ 501 502 /*! Various 1-D interpolation modes */ 503 enum GMT_enum_spline { 504 GMT_SPLINE_LINEAR = 0, /* Linear spline */ 505 GMT_SPLINE_AKIMA, /* Akima spline */ 506 GMT_SPLINE_CUBIC, /* Cubic spline */ 507 GMT_SPLINE_SMOOTH, /* Smooth cubic spline */ 508 GMT_SPLINE_NN, /* Nearest neighbor */ 509 GMT_SPLINE_NONE}; /* No spline set */ 510 511 /*! Various 1-D interpolation derivatives */ 512 enum GMT_enum_derivative { 513 GMT_SPLINE_SLOPE = 10, /* Spline 1st derivative*/ 514 GMT_SPLINE_CURVATURE = 20}; /* Spline 2nd derivative */ 515 516 enum GMT_enum_extrap { 517 GMT_EXTRAPOLATE_NONE = 0, /* No extrapolation; set to NaN outside bounds */ 518 GMT_EXTRAPOLATE_SPLINE, /* Let spline extrapolate beyond bounds */ 519 GMT_EXTRAPOLATE_CONSTANT}; /* Set extrapolation beyond bound to specific constant */ 520 521 enum GMT_enum_cross { 522 GMT_CROSS_NORMAL = 0, /* Regular grid cross */ 523 GMT_CROSS_ASYMM, /* Asymmetrical tick away from Equator/Greenwich */ 524 GMT_CROSS_SYMM}; /* Symmetric grid ticks */ 525 526 /*! Timer reporting modes */ 527 enum GMT_enum_tictoc { 528 GMT_NO_TIMER = 0, /* No timer reported */ 529 GMT_ABS_TIMER, /* Report absolute time */ 530 GMT_ELAPSED_TIMER}; /* Report elapsed time since start of session */ 531 532 /*! Various line/grid/image interpolation modes */ 533 enum GMT_enum_track { 534 GMT_TRACK_FILL = 0, /* Normal fix_up_path behavior: Keep all (x,y) points but add intermediate if gap > cutoff */ 535 GMT_TRACK_FILL_M, /* Fill in, but navigate via meridians (y), then parallels (x) */ 536 GMT_TRACK_FILL_P, /* Fill in, but navigate via parallels (x), then meridians (y) */ 537 GMT_TRACK_SAMPLE_FIX, /* Resample the track at equidistant points; old points may be lost. Use given spacing */ 538 GMT_TRACK_SAMPLE_ADJ}; /* Resample the track at equidistant points; old points may be lost. Adjust spacing to fit length of track exactly */ 539 540 enum GMT_enum_bcr { 541 BCR_NEARNEIGHBOR = 0, /* Nearest neighbor algorithm */ 542 BCR_BILINEAR, /* Bilinear spline */ 543 BCR_BSPLINE, /* B-spline */ 544 BCR_BICUBIC}; /* Bicubic spline */ 545 546 enum GMT_segmentation { 547 SEGM_CONTINUOUS = 0, /* The segmentation method */ 548 SEGM_VECTOR, 549 SEGM_NETWORK, 550 SEGM_REFPOINT, 551 SEGM_SEGMENT = 0, /* The segmentation method */ 552 SEGM_TABLE, 553 SEGM_DATASET, 554 SEGM_RECORD, 555 SEGM_ORIGIN}; /* External reference point */ 556 557 /*! Various grid/image boundary conditions */ 558 enum GMT_enum_bc { 559 GMT_BC_IS_NOTSET = 0, /* BC not yet set */ 560 GMT_BC_IS_NATURAL, /* Use natural BC */ 561 GMT_BC_IS_PERIODIC, /* Use periodic BC */ 562 GMT_BC_IS_GEO, /* Geographic BC condition at N or S pole */ 563 GMT_BC_IS_DATA}; /* Fill in BC with actual data */ 564 565 enum GMT_enum_anchors { /* Various anchor strings */ 566 GMT_ANCHOR_LOGO = 0, /* Anchor for logo */ 567 GMT_ANCHOR_IMAGE, /* Anchor for image */ 568 GMT_ANCHOR_LEGEND, /* Anchor for legend */ 569 GMT_ANCHOR_COLORBAR, /* Anchor for colorbar */ 570 GMT_ANCHOR_INSET, /* Anchor for inset */ 571 GMT_ANCHOR_MAPSCALE, /* Anchor for map scale */ 572 GMT_ANCHOR_MAPROSE, /* Anchor for map rose */ 573 GMT_ANCHOR_VSCALE, /* Anchor for vertical scale */ 574 GMT_ANCHOR_NTYPES}; /* Number of such types */ 575 576 enum GMT_enum_scales { /* Various scale issues */ 577 GMT_SCALE_MAP = 1, 578 GMT_SCALE_FREE = 2}; 579 580 enum GMT_enum_radius { /* Various "average" radii for an ellipsoid with axes a,a,b */ 581 GMT_RADIUS_MEAN = 0, /* Mean radius IUGG R_1 = (2*a+b)/3 = a (1 - f/3) */ 582 GMT_RADIUS_AUTHALIC, /* Authalic radius 4*pi*r^2 = surface area of ellipsoid, R_2 = sqrt (0.5a^2 + 0.5b^2 (tanh^-1 e)/e) */ 583 GMT_RADIUS_VOLUMETRIC, /* Volumetric radius 3/4*pi*r^3 = volume of ellipsoid, R_3 = (a*a*b)^(1/3) */ 584 GMT_RADIUS_MERIDIONAL, /* Meridional radius, M_r = [(a^3/2 + b^3/2)/2]^2/3 */ 585 GMT_RADIUS_QUADRATIC}; /* Quadratic radius, Q_r = 1/2 sqrt (3a^2 + b^2) */ 586 587 enum GMT_enum_latswap {GMT_LATSWAP_NONE = -1, /* Deactivate latswapping */ 588 GMT_LATSWAP_G2A = 0, /* input = geodetic; output = authalic */ 589 GMT_LATSWAP_A2G, /* input = authalic; output = geodetic */ 590 GMT_LATSWAP_G2C, /* input = geodetic; output = conformal */ 591 GMT_LATSWAP_C2G, /* input = conformal; output = geodetic */ 592 GMT_LATSWAP_G2M, /* input = geodetic; output = meridional */ 593 GMT_LATSWAP_M2G, /* input = meridional; output = geodetic */ 594 GMT_LATSWAP_G2O, /* input = geodetic; output = geocentric */ 595 GMT_LATSWAP_O2G, /* input = geocentric; output = geodetic */ 596 GMT_LATSWAP_G2P, /* input = geodetic; output = parametric */ 597 GMT_LATSWAP_P2G, /* input = parametric; output = geodetic */ 598 GMT_LATSWAP_O2P, /* input = geocentric; output = parametric */ 599 GMT_LATSWAP_P2O, /* input = parametric; output = geocentric */ 600 GMT_LATSWAP_N}; /* number of defined swaps */ 601 602 enum GMT_enum_geodesic { /* Various geodesic algorithms */ 603 GMT_GEODESIC_VINCENTY = 0, /* Best possible, currently Vincenty */ 604 GMT_GEODESIC_ANDOYER, /* Faster approximation, currently Andoyer */ 605 GMT_GEODESIC_RUDOE}; /* For legacy GMT4 calculations */ 606 607 #define METERS_IN_A_FOOT 0.3048 /* 2.54 * 12 / 100 */ 608 #define METERS_IN_A_SURVEY_FOOT (1200.0/3937.0) /* ~0.3048006096 m */ 609 #define METERS_IN_A_KM 1000.0 610 #define METERS_IN_A_MILE 1609.433 /* meters in statute mile */ 611 #define METERS_IN_A_NAUTICAL_MILE 1852.0 /* meters in a nautical mile */ 612 #define GMT_MAP_DIST_UNIT 'e' /* Default distance is the meter */ 613 614 enum GMT_enum_coord {GMT_GEOGRAPHIC = 0, /* Means coordinates are lon,lat : compute spherical distances */ 615 GMT_CARTESIAN, /* Means coordinates are Cartesian x,y : compute Cartesian distances */ 616 GMT_GEO2CART, /* Means coordinates are lon,lat but must be mapped to (x,y) : compute Cartesian distances */ 617 GMT_CART2GEO}; /* Means coordinates are lon,lat but must be mapped to (x,y) : compute Cartesian distances */ 618 619 enum GMT_enum_dist {GMT_MAP_DIST = 0, /* Distance in the map */ 620 GMT_CONT_DIST, /* Distance along a contour or line in dist units */ 621 GMT_LABEL_DIST}; /* Distance along a contour or line in dist label units */ 622 623 enum GMT_enum_inonout {GMT_IOO_UNKNOWN = 0, /* Decide based on range and type */ 624 GMT_IOO_CARTESIAN, /* Use Cartesian inside function */ 625 GMT_IOO_SPHERICAL}; /* Use spherical inside function */ 626 627 enum GMT_enum_path {GMT_RESAMPLE_PATH = 0, /* Default: Resample geographic paths based in a max gap allowed (path_step) */ 628 GMT_LEAVE_PATH}; /* Options like -A can turn off this resampling, where available */ 629 630 enum GMT_enum_stairpath {GMT_STAIRS_OFF = 0, /* Default: No stairclimbing */ 631 GMT_STAIRS_Y, /* Move vertically (meridian) to next point along y, then horizontally along x */ 632 GMT_STAIRS_X}; /* Move horizontally (parallel) to next point along x, then vertically along y */ 633 634 enum GMT_enum_cdist {GMT_CARTESIAN_DIST = 0, /* Cartesian 2-D x,y data, r = hypot */ 635 GMT_CARTESIAN_DIST_PERIODIC, /* Cartesian 2-D x,y data,but with periodic BCs */ 636 GMT_CARTESIAN_DIST2, /* Cartesian 2-D x,y data, return r^2 to avoid hypot */ 637 GMT_CARTESIAN_DIST_PROJ, /* Project lon,lat to Cartesian 2-D x,y data, then get distance */ 638 GMT_CARTESIAN_DIST_PROJ2, /* Same as --"-- but return r^2 to avoid hypot calls */ 639 GMT_CARTESIAN_DIST_PROJ_INV}; /* Project Cartesian 2-D x,y data to lon,lat, then get distance */ 640 enum GMT_enum_mdist { 641 GMT_NO_MODE = 0, 642 GMT_FLATEARTH, /* Compute Flat Earth distances */ 643 GMT_GREATCIRCLE, /* Compute great circle distances */ 644 GMT_GEODESIC, /* Compute geodesic distances */ 645 GMT_LOXODROME}; /* Compute loxodrome distances (otherwise same as great circle machinery) */ 646 enum GMT_enum_sph {GMT_DIST_M = 10, /* 2-D lon, lat data, convert distance to meter */ 647 GMT_DIST_DEG = 20, /* 2-D lon, lat data, convert distance to spherical degree */ 648 GMT_DIST_COS = 30}; /* 2-D lon, lat data, convert distance to cos of spherical degree */ 649 650 enum enum_item {MOVIE_ITEM_IS_LABEL = 0, /* Item is a frame counter or time label in movie */ 651 MOVIE_ITEM_IS_PROG_INDICATOR}; /* Item is a progress indicator symbol in movie */ 652 653 /* Help us with big and little endianness */ 654 #ifdef WORDS_BIGENDIAN 655 #define GMT_BIGENDIAN true 656 #define GMT_ENDIAN 'B' 657 #else 658 #define GMT_BIGENDIAN false 659 #define GMT_ENDIAN 'L' 660 #endif 661 662 /* Constants used for automatic data download via curl */ 663 enum GMT_enum_curl {GMT_REGULAR_FILE = 0, /* Regular file the may or may not exist */ 664 GMT_CACHE_FILE = 1, /* Temporary GMT test data file destined for the cache */ 665 GMT_DATA_FILE = 2, /* Official GMT data file destined for the user's user dir */ 666 GMT_URL_FILE = 3, /* Data given by an URL destined for the cache */ 667 GMT_URL_QUERY = 4, /* Data given by an URL CGI command destined for the cache */ 668 GMT_AUTO_DIR = 0, /* Use the directory given per internal rules */ 669 GMT_CACHE_DIR = 1, /* Use the cache directory */ 670 GMT_DATA_DIR = 2, /* Use the data directory */ 671 GMT_LOCAL_DIR = 3, /* Use the local (current) directory */ 672 GMT_REMOTE_DIR = 4}; /* File is on the remote server */ 673 674 #endif /* GMT_CONSTANTS_H */ 675