home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Science / Science.zip / gmt_os2.zip / src / gmt_project.h < prev    next >
C/C++ Source or Header  |  1995-08-09  |  7KB  |  183 lines

  1. /*--------------------------------------------------------------------
  2.  *    The GMT-system:    @(#)gmt_project.h    3.4  09 Aug 1995
  3.  *
  4.  *    Copyright (c) 1991-1995 by P. Wessel and W. H. F. Smith
  5.  *    See README file for copying and redistribution conditions.
  6.  *--------------------------------------------------------------------*/
  7. /*
  8.  * Include file for programs that use the map-projections functions.  Note
  9.  * that most programs will include this by including gmt.h
  10.  *
  11.  * Author:    Paul Wessel
  12.  * Date:    26-FEB-1990
  13.  *
  14.  */
  15.  
  16. #define LINEAR        0    /* Linear projections tagged 0-9 */
  17. #define LOG10        1
  18. #define POW        2
  19. #define MERCATOR    10    /* Cylindrical projections tagged 10-99 */
  20. #define OBLIQUE_MERC    11
  21. #define TM        12
  22. #define UTM        13
  23. #define CASSINI        14
  24. #define    CYL_EQ        15
  25. #define    CYL_EQDIST    16
  26. #define STEREO        100    /* Azimuthal projections tagged 100-999 */
  27. #define LAMB_AZ_EQ    101
  28. #define ORTHO        102
  29. #define AZ_EQDIST    103
  30. #define POLAR        110
  31. #define LAMBERT        1000    /* Conic projections tagged 1000-9999 */
  32. #define ALBERS        1001
  33. #define MOLLWEIDE    10000    /* Misc projections tagged 10000-99999 */
  34. #define HAMMER        10001
  35. #define SINUSOIDAL    10002
  36. #define WINKEL        10003
  37. #define ROBINSON    10004
  38. #define ECKERT        10005
  39.  
  40. #define MAPPING (project_info.projection > 5 || project_info.pars[4] == 1.0)    /* TRUE when map projections are used */
  41. #define CYLINDRICAL (project_info.projection >= 10 && project_info.projection < 100)
  42. #define AZIMUTHAL (project_info.projection >= 100 && project_info.projection < 1000)
  43. #define CONICAL (project_info.projection >= 1000 && project_info.projection < 10000)
  44. #define RECT_GRATICULE (project_info.projection == MERCATOR || project_info.projection == CYL_EQ || project_info.projection == CYL_EQDIST)
  45.  
  46. #define D2R (M_PI / 180.0)
  47. #define R2D (180.0 / M_PI)
  48.  
  49. struct MAP_PROJECTIONS {
  50.  
  51.     double pars[10];        /* Raw unprocessed map-projection parameters as passed on command line */
  52.     double z_pars[2];        /* Raw unprocessed z-projection parameters as passed on command line */
  53.     
  54.     /* Common projection parameters */
  55.     
  56.     int projection;            /* Gives the id number for the projection used */
  57.     
  58.     BOOLEAN x_off_supplied;        /* Used to set xorigin/yorigin for overlay/final plots */
  59.     BOOLEAN y_off_supplied;
  60.     BOOLEAN region_supplied;    /* TRUE when -R option has been given */
  61.     BOOLEAN units_pr_degree;    /* TRUE if scale is given as inch (or cm)/degree.  FALSE for 1:xxxxx */
  62.     BOOLEAN gave_map_width;        /* TRUE if map width in inch (or cm) is given instead of scale.  FALSE for 1:xxxxx */
  63.     BOOLEAN region;            /* TRUE if -R gives lon/lat boundaires, FALSE if it gives lower/left upper right corners */
  64.     BOOLEAN north_pole;        /* TRUE if projection is on northern hermisphere, FALSE on southern */
  65.     BOOLEAN edge[4];        /* TRUE if the edge is a map boundary */
  66.     BOOLEAN three_D;        /* Parameters for 3-D projections */
  67.  
  68.     double x0, y0, z0;        /* Projected values of the logical origin for the projection */
  69.     double xmin, xmax, ymin, ymax, zmin, zmax;    /* Extreme projected values */
  70.     double w, e, s, n;        /* Bounding geographical region, if applicable */
  71.     double z_bottom, z_top;        /* Bounds in z direction */
  72.     double x_scale, y_scale;    /* Scaling for meters to map-distance (typically inch) conversion */
  73.     double z_scale;            /* Scale for z projection (user-units to map-units (typically inch) */
  74.     double z_level;            /* Level at which to draw basemap [0] */
  75.     double unit;            /* Gives meters pr plot unit (0.01 or 0.0254) */
  76.     double central_meridian;    /* Central meridian for projection */
  77.     double pole;            /* +90 pr -90, depending on which pole */
  78.     
  79.     
  80.     /* Linear plot parameters */
  81.     
  82.     int xyz_projection[3];        /* For linear projection, 0 = linear, 1 = log10, 2 = pow */
  83.     BOOLEAN xyz_pos[3];        /* TRUE if x,y,z-axis increases in normal positive direction */
  84.     BOOLEAN compute_scale[3];    /* TRUE if axes lengths were set rather than scales */
  85.     double xyz_pow[3];        /* For POW projection */
  86.     double xyz_ipow[3];
  87.     
  88.     /* Lambert conformal conic parameters.  (See Snyder for details on all parameters) */
  89.     
  90.     double l_N;
  91.     double l_F;
  92.     double l_rho0;
  93.     
  94.     /* Oblique Mercator Projection (Spherical version )*/
  95.     
  96.     double o_sin_pole_lat, o_cos_pole_lat;    /* Pole of rotation */
  97.     double o_pole_lon;    /* In Radians */
  98.     double o_beta;        /* lon' = beta for central_meridian (In Radians) */
  99.     
  100.     /* TM and UTM Projections */
  101.     
  102.     double t_e2;
  103.     double t_c1, t_c2, t_c3, t_c4;
  104.     double t_ic1, t_ic2, t_ic3, t_ic4;
  105.     
  106.     /* Lambert Azimuthal Equal-Area Projection */
  107.     
  108.     double sinp;
  109.     double cosp;
  110.     
  111.     /* Stereographic Projection */
  112.     
  113.     double s_cosz1, s_sinz1;
  114.     double s_c;
  115.     double r;        /* Radius of projected sphere in plot units (inch or cm) */
  116.     BOOLEAN polar;        /* True if projection pole coincides with S or N pole */
  117.     
  118.     /* Mollweide Equal-Area Projection */
  119.     
  120.     double w_x;
  121.     double w_y;
  122.     double w_r;    /* Also used by Hammer-Aitoff and Winkel Projections */
  123.     
  124.     /* Winkel Tripel Projection */
  125.     
  126.     double r_cosphi1;    /* = cos (50.467) */
  127.     
  128.     /* Robinson Projection */
  129.     
  130.     double n_cx, n_cy;    /* = = 0.8487R, 1.3523R */
  131.     double n_phi[19], n_X[19], n_Y[19];
  132.     
  133.     /* Eckert VI Projection */
  134.     
  135.     double k_r, k_ir;
  136.     
  137.     /* Cassini Projection */
  138.     
  139.     double c_M0;
  140.     
  141.     /* Cylindrical equal-area Projection(s) */
  142.     
  143.     double y_rx, y_ry;
  144.     
  145.     /* Albers Equal-area conic parameters. */
  146.     
  147.     double a_n;
  148.     double a_C;
  149.     double a_rho0;
  150.     
  151. };
  152.  
  153. struct MAP_FRAME {        /* Various parameters for plotting of map boundaries */
  154.     double frame_int[3];    /* x,y,z */
  155.     double grid_int[3];
  156.     double anot_int[3];
  157.     char label[3][100];
  158.     char header[100];
  159.     int side[5];        /* Which sides to plot. 2 is anot/draw, 1 is draw, 0 is not */
  160.     int anot_type[3];    /* For log10 and pow anotations only */
  161.     BOOLEAN plot;        /* TRUE if frame is desired */
  162.     BOOLEAN draw_box;    /* TRUE if 3-D supporting frame is desired */
  163.     BOOLEAN check_side;    /* TRUE if lon and lat anotations should be on x and y axis only */
  164.     BOOLEAN horizontal;    /* TRUE is S/N anotations should be parallel to axes */
  165. };
  166.  
  167. struct THREE_D {
  168.     double view_azimuth, view_elevation;
  169.     double cos_az, sin_az, cos_el, sin_el;
  170.     double corner_x[4], corner_y[4];
  171.     double xmin, xmax, ymin, ymax;
  172.     double phi[3];        /* Angle each axis makes with horizontal */
  173.     double xshrink[3];    /* Shrinkage in x-dir due to projection */
  174.     double yshrink[3];    /* Same for y-dir */
  175.     double tilt[3];        /* Slant of characters due to projection */
  176.     double sign[4];        /* Used to determine direction of tickmarks etc */
  177.     int quadrant;        /* quandrant we're looking from */
  178.     int z_axis;        /* Which z-axis to draw. */
  179.     int k;            /* For drawing-axis. 0 = plot in x dir, 1 in y */
  180.     int face[3];        /* Tells if this facet has normal in pos direction */
  181.     int draw[4];        /* axes to draw */
  182. };
  183.