home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 555a.lha / DrawMap_v3.1_src&libs / sources.LZH / sources / drawmap.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-14  |  8.4 KB  |  235 lines

  1. /*  File drawmap.h  */
  2.  
  3. #define MAX(a,b) ((a)>=(b) ? (a) : (b))
  4. #define ABS(a) ((a)>=0 ? (a) : (-(a)))
  5.  
  6. #define NOABORT 1<<1                   /* used in printmap() */
  7. #define U_ABORT 1<<2
  8. #define P_ABORT 1<<3
  9.  
  10. #define PDERR_NOERR 0L
  11.  
  12. #define BITVAL(x,n)  ((x>>n)&1)
  13. #define BITSETT(x,n)  (x | bitval[n])
  14. #define BITCLEAR(x,n)  (x & (~bitval[n]))
  15. #define BITSTORE(x,n,val)  ((val==0) ? (x=BITCLEAR(x,n)) : (x=BITSETT(x,n)))
  16.  
  17. #define SHADOW_DISP  4                 /* shadow displacement (pix) */
  18.  
  19. #define WC WINDOWCLOSE
  20. #define WDP WINDOWDEPTH
  21.  
  22. #define IDCMPFLAGS (CLOSEWINDOW | MOUSEBUTTONS | MENUPICK)
  23.  
  24. #define WINFLAGS1 (SMART_REFRESH | ACTIVATE | BACKDROP)
  25. #define WINFLAGS2 (BORDERLESS | REPORTMOUSE)
  26.  
  27. #define WWIDTH 640                     /* window width (pixels)       */
  28. #define WHEIGHT 400                    /* window height (pixels)      */
  29. #define VMODE (HIRES | LACE)           /* view mode                   */
  30. #define DEPTH 4                        /* 16 colors => 4 bitplanes    */
  31.  
  32. #define CENTERX (WWIDTH/2)             /* place origin at center of   */
  33. #define CENTERY (WHEIGHT/2)            /*   window                    */
  34. #define NUMPTS 760                     /* max. no. points per area    */
  35. #define MAXVAL 169600                  /* number of words in map      */
  36. #define HFACTOR (WWIDTH/360.)          /* horizontal scale (pix/deg)  */
  37. #define VFACTOR (WHEIGHT/180.)         /* vertical scale (pix/deg)    */
  38. #define M_VFACTOR (WHEIGHT/4.87)       /* vertical scale for Mercator */
  39.                                        /*   map (+/- 80 degrees lat.) */
  40. #define ASP_RAT ((640./400.)*(188./260.)) /* screen aspect ratio      */
  41.                                        /*  (max width / max hgt)      */
  42. #define VRADIUS 160                    /* vertical radius of ellipse  */
  43.                                        /*   (pixels)                  */
  44. #define HRADIUS (short)(ASP_RAT * VRADIUS+0.5) /* horiz. radius (pix) */
  45. #define ROWOFFSET (WWIDTH/8)           /* length of each screen row   */
  46.                                        /*   in bytes                  */
  47.  
  48. #define OK     0                       /* result flags */
  49. #define NOT_OK 1
  50. #define ABORT  2
  51.  
  52. #define BLUE       0L                  /* default colors */
  53. #define WHITE      1L
  54. #define LT_VIO     2L
  55. #define DK_VIO     3L
  56. #define LT_GRN     4L
  57. #define DK_GRN     5L
  58. #define LT_BL      6L
  59. #define DK_BL      7L
  60. #define LT_YEL     8L
  61. #define DK_YEL     9L
  62. #define LT_PUR    10L
  63. #define DK_PUR    11L
  64. #define LT_RED    12L
  65. #define DK_RED    13L
  66. #define BLACK     14L
  67. #define ORANGE    15L
  68.  
  69. UWORD mapcolors[] = {                  /* default color table            */
  70.    0x006b, 0x0fff, 0x0caf, 0x095f,     /* blue, white, lt vio, dk vio    */
  71.    0x00f0, 0x00a0, 0x00bf, 0x000f,     /* lt grn, dk grn, lt bl, dk bl   */
  72.    0x0ff0, 0x0cc0, 0x0f0f, 0x0b0b,     /* lt yel, dk yel, lt pur, dk pur */
  73.    0x0f44, 0x0c00, 0x0000, 0x0f90      /* lt red, dk red, black, orange  */
  74. };
  75.  
  76.                                        /* number of colors in color table */
  77. #define NUM_COLORS (sizeof(mapcolors)/sizeof(UWORD))
  78.  
  79. UWORD configcolors[NUM_COLORS];        /* color configuration */
  80.  
  81. char mapname[]      = "map.bin";       /* names of files containing    */
  82. char mapname_trig[] = "map-trig.bin";  /*   map data and configuration */
  83. char configfile[]   = "map.config";
  84. char limitsfile[]   = "map.limits.bin";
  85. char flatmapfile[]  = "map.flat.pic";
  86.  
  87. #define RE 6378.165                    /* radius of Earth (kilometers) */
  88. #define VIEW_HEIGHT 300.               /* default height for orbital   */
  89.                                        /*   view (km)                  */
  90. #define MIN_HEIGHT 10.                 /* minimum view height (km)     */
  91.  
  92. double view_height, eta, etap, facp;   /* declare global constants */
  93.  
  94. #define PI    3.141592653589793        /* define constants */
  95. #define PI2   (PI/2.)
  96. #define TWOPI (2.*PI)
  97. #define RAD   (PI/180.)
  98. #define EXPAND_SCALE_FACTOR 2.0        /* for box zoom out option */
  99.  
  100. char fontname[] = "topaz.font";        /* screen font name */
  101.  
  102. struct TextAttr mapfont = {            /* screen font */
  103.    (STRPTR) &fontname, 8, 0, 0
  104. };
  105.  
  106. struct NewScreen mapscreen = {
  107.    0,                                  /* left edge of screen     */
  108.    0,                                  /* top edge of screen      */
  109.    WWIDTH, WHEIGHT,                    /* width, height of screen */
  110.    DEPTH,                              /* 16 colors               */
  111.    1, 0,                               /* detail pen, block pen   */
  112.    VMODE,                              /* view mode               */
  113.    CUSTOMSCREEN,                       /* type of screen          */
  114.    &mapfont,                           /* screen font             */
  115.    (UBYTE *) "Drawmap v. 3.1, by Bryan Brown",  /* screen title   */
  116.    NULL,
  117.    NULL
  118. };
  119.  
  120. struct NewWindow mapWindow = {
  121.    0,                                  /* LeftEdge for window measured
  122.                                           in pixels, at the current
  123.                                           horizontal resolution, from the
  124.                                           leftmost edge of the Screen   */
  125.    0,                                  /* TopEdge for window is measured
  126.                                           in lines from the top of the
  127.                                           current Screen.               */
  128.    WWIDTH, WHEIGHT,                    /* Width, Height of this window  */
  129.    0,                                  /* DetailPen - what pen number is
  130.                                           to be used to draw the borders
  131.                                           of the window                 */
  132.    1,                                  /* BlockPen - what pen number is
  133.                                           to be used to draw system
  134.                                           generated window gadgets      */
  135.                                        /* (for DetailPen and BlockPen,
  136.                                            the value of -1 says
  137.                                            "use the default value")     */
  138.    IDCMPFLAGS,                         /* IDCMP Flags                   */
  139.    WINFLAGS1 | WINFLAGS2,              /* Window Flags                  */
  140.    NULL,                               /* FirstGadget                   */
  141.    NULL,                               /* CheckMark                     */
  142.    NULL,                               /* window title                  */
  143.    NULL,                               /* Pointer to Screen if not
  144.                                           workbench                     */
  145.    NULL,                               /* Pointer to BitMap if a
  146.                                           SUPERBITMAP window            */
  147.    10, 10,                             /* minimum width, minimum height */
  148.    WWIDTH, WHEIGHT,                    /* maximum width, maximum height */
  149.    CUSTOMSCREEN
  150. };
  151.  
  152. UWORD arrow_data[] = {                 /* mouse pointer = arrow  */
  153.    0x0000, 0x0000,
  154.  
  155.    0x8000, 0x0000,
  156.    0xc000, 0x0000,
  157.    0xe000, 0x0000,
  158.  
  159.    0xf000, 0x0000,
  160.  
  161.    0xe000, 0x0000,
  162.    0x2000, 0x0000,
  163.    0x0000, 0x0000,
  164.  
  165.    0x0000, 0x0000
  166. };
  167.  
  168. #define ARROW_X_OFFSET -1
  169. #define ARROW_Y_OFFSET  0
  170. #define ARROW_SIZE      sizeof(arrow_data)
  171.  
  172. UWORD cross_data[] = {                 /* mouse pointer = cross */
  173.    0x0000, 0x0000,
  174.  
  175.    0x0400, 0x0000,
  176.    0x0400, 0x0000,
  177.    0x0400, 0x0000,
  178.    0x0400, 0x0000,
  179.    0x0000, 0x0000,
  180.  
  181.    0xf1e0, 0x0000,
  182.  
  183.    0x0000, 0x0000,
  184.    0x0400, 0x0000,
  185.    0x0400, 0x0000,
  186.    0x0400, 0x0000,
  187.    0x0400, 0x0000,
  188.  
  189.    0x0000, 0x0000
  190. };
  191.  
  192. #define CROSS_X_OFFSET -6
  193. #define CROSS_Y_OFFSET -5
  194. #define CROSS_SIZE     (sizeof(cross_data))
  195.  
  196. UWORD waiter_data[] = {                /* mouse pointer = 'wait' */
  197.    0x0000, 0x0000,
  198.  
  199.    0x892e, 0x0000,
  200.    0xaaa4, 0x0000,
  201.    0xaba4, 0x0000,
  202.    0x52a4, 0x0000,
  203.  
  204.    0x0000, 0x0000
  205. };
  206.  
  207. #define WAITER_X_OFFSET -1
  208. #define WAITER_Y_OFFSET  0
  209. #define WAITER_SIZE      (sizeof(waiter_data))
  210.  
  211. UWORD transparent_data[] = {           /* mouse pointer = transparent */
  212.    0x0000, 0x0000,
  213.  
  214.    0x0000, 0x0000,
  215.    0x0000, 0x0000,
  216.    0x0000, 0x0000,
  217.  
  218.    0x0000, 0x0000
  219. };
  220.  
  221. #define TRANSPARENT_X_OFFSET 0
  222. #define TRANSPARENT_Y_OFFSET 0
  223. #define TRANSPARENT_SIZE     (sizeof(transparent_data))
  224.  
  225. #define NSEGS 1409                     /* number of segments */
  226.  
  227. struct Arc  {                          /* format for limits in */
  228.    short lat_min, lat_max, lam_min, lam_max;
  229.    int first, last;                    /*   each segment       */
  230. };
  231.  
  232. struct Arc *seg;
  233.  
  234. #define SEG_LIST_SIZE (unsigned)(NSEGS*sizeof(struct Arc))
  235.