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 /*! 19 * \file gmt_plot.h 20 * \brief 21 */ 22 23 #ifndef GMT_PLOT_H 24 #define GMT_PLOT_H 25 26 /*! Identifier for gmt_plane_perspective. The others come from GMT_io.h */ 27 28 #define GMT_ZW 3 29 30 /* GMT symbol identifiers. In addition to those in PSL we have 31 extensions for custom symbols in psxy and psxyz and 3-D symbols 32 as well as special line symbols (fronts, decorated or quoted lines) */ 33 34 #define GMT_SYMBOL_BARX ((int)'B') 35 #define GMT_SYMBOL_BARY ((int)'b') 36 #define GMT_SYMBOL_FRONT ((int)'f') 37 #define GMT_SYMBOL_CUSTOM ((int)'k') 38 #define GMT_SYMBOL_TEXT ((int)'l') 39 #define GMT_SYMBOL_COLUMN ((int)'o') 40 #define GMT_SYMBOL_QUOTED_LINE ((int)'q') 41 #define GMT_SYMBOL_CUBE ((int)'u') 42 #define GMT_SYMBOL_ZDASH ((int)'z') 43 #define GMT_SYMBOL_DECORATED_LINE ((int)'~') 44 #define GMT_SYMBOL_VECTOR_V4 999 45 46 #define GMT_SYMBOL_MOVE ((int)'M') 47 #define GMT_SYMBOL_DRAW ((int)'D') 48 #define GMT_SYMBOL_STROKE ((int)'S') 49 #define GMT_SYMBOL_ARC ((int)'A') 50 #define GMT_SYMBOL_ROTATE ((int)'O') /* Since R stands for rounded rectangle in plot */ 51 #define GMT_SYMBOL_VARROTATE ((int)'V') 52 #define GMT_SYMBOL_AZIMROTATE ((int)'Z') 53 #define GMT_SYMBOL_TEXTURE ((int)'T') 54 #define GMT_SYMBOL_GEOVECTOR ((int)'=') 55 #define GMT_SYMBOL_VARTEXT ((int)'L') 56 #define GMT_SYMBOL_EPS ((int)'P') 57 58 #define GMT_SYMBOL_LINE 0 59 #define GMT_SYMBOL_NONE ((int)' ') 60 #define GMT_SYMBOL_NOT_SET ((int)'*') 61 62 #define GMT_DOT_SIZE 0.005 /* Size of a "dot" on a GMT PS map [in inches] */ 63 64 /*! FRONT symbols */ 65 66 enum GMT_enum_front {GMT_FRONT_FAULT = 0, 67 GMT_FRONT_ITRIANGLE, 68 GMT_FRONT_TRIANGLE, 69 GMT_FRONT_SLIP, 70 GMT_FRONT_SLIPC, 71 GMT_FRONT_CIRCLE, 72 GMT_FRONT_BOX}; 73 74 /*! Direction of FRONT symbols: */ 75 76 enum GMT_enum_frontdir {GMT_FRONT_RIGHT = -1, 77 GMT_FRONT_CENTERED, 78 GMT_FRONT_LEFT}; 79 80 /*! Type of wedge symbols: */ 81 82 enum GMT_enum_wedgetype {GMT_WEDGE_NORMAL = 0, 83 GMT_WEDGE_ARCS = 1, 84 GMT_WEDGE_RADII = 2, 85 GMT_WEDGE_SPIDER = 3}; 86 87 /*! Type of symbol base value */ 88 89 enum GMT_enum_basetype {GMT_BASE_MIN = 0, /* Bar starts at the minimum value in -R */ 90 GMT_BASE_ARG = 1, /* Base given via +b<base> */ 91 GMT_BASE_READ = 2, /* Base read from file due to +b */ 92 GMT_BASE_ORIGIN = 4}; /* For +z|Z: All values relative to given base */ 93 94 /*! A sub-symbol for symbols along a front */ 95 struct GMT_FRONTLINE { 96 double f_gap; /* Gap between front symbols in inches */ 97 double f_len; /* Length of front symbols in inches */ 98 double f_off; /* Offset of first symbol from start of front in inches */ 99 double f_angle; /* Angle of the slip vector hook [30] */ 100 bool f_exact; /* Take given positive gap exactly [Default will adjust gap to distribute evenly along length of front] */ 101 bool invisible; /* True if we don't want to draw the front line itself */ 102 int f_sense; /* Draw symbols to left (+1), centered (0), or right (-1) of line */ 103 int f_symbol; /* Which symbol to draw along the front line */ 104 int f_pen; /* -1 for no outline (+p), 0 for default outline [-1], +1 if +p<pen> was used to set separate pen for outline */ 105 struct GMT_PEN pen; /* Pen for outline of front symbol [-W] */ 106 }; 107 108 /* Vector symbols */ 109 110 struct GMT_VECT_ATTR { 111 /* Container for common attributes for plot attributes of vectors */ 112 unsigned int status; /* Bit flags for vector information (see GMT_enum_vecattr above) */ 113 unsigned int v_kind[2]; /* Type of vector heads */ 114 bool parsed_v4; /* true if we parsed old-style <vectorwidth/headlength/headwidth> attribute */ 115 float v_angle; /* Head angle */ 116 float v_norm; /* shrink when lengths are smaller than this */ 117 float v_stem; /* Min length in % of visible vector when head is large [10%] */ 118 float v_width; /* Width of vector stem in inches */ 119 float v_shape; /* Shape of vector head [MAP_VECTOR_SHAPE] */ 120 float h_length; /* Length of vector head in inches */ 121 float h_width; /* Width of vector head in inches */ 122 float pole[2]; /* Longitude and latitude of geovector pole */ 123 float scale; /* Converts inches to spherical degrees */ 124 float comp_scale; /* Converts hypot (dx, dy) to inches */ 125 float v_trim[2]; /* Offsets from begin/end point in inches */ 126 struct GMT_PEN pen; /* Pen for outline of head */ 127 struct GMT_FILL fill; /* Fill for head [USED IN PSROSE] */ 128 }; 129 130 #define GMT_MAX_SYMBOL_COLS 6 /* Maximum number of columns required for the most complicated symbol input */ 131 132 struct GMT_SYMBOL { 133 /* Voodoo: If next line is not the first member in this struct, psxy -Sl<size>/Text will have corrupt 'Text' 134 in non-debug binaries compiled with VS2010 */ 135 char string[GMT_LEN256]; /* Character code to plot (could be octal) */ 136 137 int symbol; /* Symbol id */ 138 unsigned int n_required; /* Number of additional columns necessary to decode chosen symbol */ 139 unsigned int justify; /* Justification of text item for -Sl symbol [PSL_MC = centered] */ 140 unsigned int u; /* Measure unit id (0 = cm, 1 = inch, 2 = m, 3 = point */ 141 unsigned int read_symbol_cmd; /* 1 when -S indicated we must read symbol type from file, 2 with -SK is used */ 142 bool u_set; /* true if u was set */ 143 bool par_set; /* true if all parameters were set for e,j */ 144 double factor; /* Scaling needed to unify symbol area for circle, triangles, etc. [1] */ 145 double size_x; /* Current symbol size in x */ 146 double size_y; /* Current symbol size in y */ 147 double given_size_x; /* Symbol size read from file or command line */ 148 double given_size_y; /* Symbol size read from file or command line */ 149 double gap; /* Fractional spacing between side-by-side bars when -Sb|B+s[<gap>] is given */ 150 bool read_size_cmd; /* true when -S indicated we must read symbol sizes from file */ 151 bool read_size; /* true when we must read symbol size from file for the current record */ 152 bool shade3D; /* true when we should simulate shading of 3D symbols cube and column */ 153 bool fq_parse; /* true -Sf or -Sq were given with no args on command line and must be parsed via segment headers */ 154 bool accumulate; /* true if -So|b|B takes many band z and they are increments, not total z values */ 155 bool diagonal; /* true if -Sr+s is given */ 156 bool sidebyside; /* true if -Sb|B+s[<gap>] is given */ 157 struct GMT_FONT font; /* Font to use for the -Sl symbol */ 158 unsigned int convert_angles; /* If 2, convert azimuth to angle on map, 1 special case for -JX, 0 plain case */ 159 unsigned int n_nondim; /* Number of columns that has angles or km (and not dimensions with units) */ 160 unsigned int nondim_col[GMT_MAX_SYMBOL_COLS]; /* Which columns has angles or km for this symbol */ 161 162 /* These apply to bar|column symbols */ 163 164 double base; /* From what level to draw the bar|column */ 165 bool user_unit[2]; /* If true then we must project the base via R -J to get base values, otherwise they are in c|i|p units */ 166 unsigned int base_set; /* 1 if user provided a custom base, 2 if we should read it from last column [otherwise 0: default to bottom axis] */ 167 168 /* These apply to geo-wedges */ 169 char w_unit; /* Radius unit */ 170 double w_radius; /* In spherical degrees */ 171 double w_radius_i; /* Inner radius [0] */ 172 double w_dr, w_da; /* Angular and radial increments for spider web */ 173 unsigned int w_mode; /* Distance mode */ 174 enum GMT_enum_wedgetype w_type; /* Wedge type */ 175 bool w_active; 176 bool w_get_do; /* True if we must read outer diameter */ 177 bool w_get_di; /* True if we must read inner diameter */ 178 bool w_get_a; /* True if we must read the two angles */ 179 180 /* These apply to vectors */ 181 182 struct GMT_VECT_ATTR v; /* All attributes for vector shapes etc. [see struct above] */ 183 184 struct GMT_FRONTLINE f; /* parameters needed for a front */ 185 struct GMT_CUSTOM_SYMBOL *custom; /* pointer to a custom symbol */ 186 187 struct GMT_CONTOUR G; /* For quoted lines */ 188 struct GMT_DECORATE D; /* For decorated lines */ 189 }; 190 191 #endif /* GMT_PLOT_H */ 192