home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff229.lzh / DrawMap / drawmap.h < prev    next >
C/C++ Source or Header  |  1989-07-20  |  7KB  |  173 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 WC WINDOWCLOSE
  7. #define WDP WINDOWDEPTH
  8.  
  9. #define NORMALFLAGS (WC | WDP)
  10.  
  11. #define IDCMPFLAGS (CLOSEWINDOW | MOUSEBUTTONS)
  12.  
  13. #define WWIDTH 640                     /* window width (pixels)       */
  14. #define WHEIGHT 400                    /* window height (pixels)      */
  15. #define VMODE (HIRES | LACE)           /* view mode                   */
  16.  
  17. #define CENTERX WWIDTH/2               /* place origin at center of   */
  18. #define CENTERY (WHEIGHT-10)/2         /*   window                    */
  19. #define NUMPTS 2100                    /* max. no. points per area    */
  20. #define MAXVAL 17718                   /* number of words in map      */
  21. #define HFACTOR (WWIDTH/360.)          /* horizontal scale (pix/deg)  */
  22. #define VFACTOR ((WHEIGHT-10.)/180.)   /* vertical scale (pix/deg)    */
  23. #define M_VFACTOR ((WHEIGHT-10.)/4.87) /* vertical scale for Mercator */
  24.                                        /*   map (+/- 80 degrees lat.) */
  25. #define ASP_RAT ((640./400.)*(188./260.)) /* screen aspect ratio      */
  26.                                        /*  (max width / max hgt)      */
  27. #define VRADIUS 160                    /* vertical radius of ellipse  */
  28.                                        /*   (pixels)                  */
  29. #define HRADIUS (short)(ASP_RAT * VRADIUS+0.5) /* horiz. radius (pix) */
  30.  
  31. #define FILL   1                       /* fill area outlines       */
  32. #define NOFILL 0                       /* don't fill area outlines */
  33.  
  34. #define OK     1                       /* result flags */
  35. #define NOT_OK 0
  36.  
  37. #define BLUE      0L                   /* workbench colors */
  38. #define WHITE     1L
  39. #define BLACK     2L
  40. #define ORANGE    3L
  41.  
  42. UWORD mapcolors[] = {
  43.    0x006b, 0x0fff, 0x0000, 0x0f90,     /* blue, white, black, orange */
  44.    0x0f90, 0x0fff, 0x0000, 0x006b,     /* orange, white, black, blue */
  45.    0x006b, 0x0fff, 0x0000, 0x0caf,     /* blue, white, black, violet */
  46.    0x0caf, 0x0fff, 0x0000, 0x006b,     /* violet, white, black, blue */
  47.    0x006b, 0x0fff, 0x0000, 0x00f0,     /* blue, white, black, green  */
  48.    0x00f0, 0x0fff, 0x0000, 0x006b,     /* green, white, black, blue  */
  49.    0x006b, 0x0fff, 0x0000, 0x0ff0,     /* blue, white, black, yellow */
  50.    0x0ff0, 0x0fff, 0x0000, 0x006b      /* yellow, white, black, blue */
  51. };
  52.  
  53. int num_colors = sizeof(mapcolors)/2;  /* number of colors in color table */
  54.  
  55. #define MAXRIM 50                      /* max # pairs of rim points  */
  56. #define GLOBE_FILL_MIN 5               /* min # points in area to be */
  57.                                        /*   color-filled on globe    */
  58.  
  59. #define RE 6378.165                    /* radius of Earth (kilometers) */
  60. #define VIEW_HEIGHT 300.               /* height above Earth to view   */
  61.                                        /*   globe (km)                 */
  62. #define MIN_HEIGHT 10.                 /* minimum view height (km)     */
  63.  
  64. double view_height, eta, etap, facp;   /* declare global constants */
  65.  
  66. double pi = 3.141592653589793;
  67. double rad, pi2, twopi;
  68.  
  69.                                        /* region numbers for lakes */
  70.  
  71. int lakes[] = { 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  72.    145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156 };
  73.  
  74. int num_lakes = sizeof(lakes) / sizeof(int);
  75.  
  76. char fontname[] = "topaz.font";        /* screen font name */
  77.  
  78. struct TextAttr mapfont = {            /* screen font */
  79.    (STRPTR) &fontname, 8, 0, 0
  80. };
  81.  
  82. struct NewScreen mapscreen = {
  83.    0,                                  /* left edge of screen     */
  84.    0,                                  /* top edge of screen      */
  85.    WWIDTH, WHEIGHT,                    /* width, height of screen */
  86.    2,                                  /* 4 colors                */
  87.    1, 0,                               /* detail pen, block pen   */
  88.    VMODE,                              /* view mode               */
  89.    CUSTOMSCREEN,                       /* type of screen          */
  90.    &mapfont,                           /* screen font             */
  91.    "Map Screen",                       /* screen title            */
  92.    NULL,
  93.    NULL
  94. };
  95.  
  96. struct NewWindow mapWindow = {
  97.    0,                                  /* LeftEdge for window measured
  98.                                           in pixels, at the current
  99.                                           horizontal resolution, from the
  100.                                           leftmost edge of the Screen   */
  101.    0,                                  /* TopEdge for window is measured
  102.                                           in lines from the top of the
  103.                                           current Screen.               */
  104.    WWIDTH, WHEIGHT,                    /* Width, Height of this window  */ 
  105.    0,                                  /* DetailPen - what pen number is
  106.                                           to be used to draw the borders
  107.                                           of the window                 */ 
  108.    1,                                  /* BlockPen - what pen number is
  109.                                           to be used to draw system
  110.                                           generated window gadgets      */
  111.                                        /* (for DetailPen and BlockPen,
  112.                                            the value of -1 says
  113.                                            "use the default value")     */
  114.    IDCMPFLAGS,                         /* IDCMP Flags                   */
  115.    SMART_REFRESH | ACTIVATE | NORMALFLAGS | GIMMEZEROZERO | RMBTRAP |
  116.       BORDERLESS | REPORTMOUSE,
  117.                                        /* Window Flags                  */
  118.    NULL,                               /* FirstGadget                   */
  119.    NULL,                               /* CheckMark                     */
  120.    "Map Window",                       /* Window title                  */
  121.    NULL,                               /* Pointer to Screen if not
  122.                                           workbench                     */
  123.    NULL,                               /* Pointer to BitMap if a
  124.                                           SUPERBITMAP window            */
  125.    10, 10,                             /* minimum width, minimum height */
  126.    WWIDTH, WHEIGHT,                    /* maximum width, maximum height */
  127.    CUSTOMSCREEN
  128. };
  129.  
  130. UWORD arrow_data[] = {
  131.    0x0000, 0x0000,
  132.  
  133.    0xf000, 0x0000,
  134.    0xc000, 0x0000,
  135.    0xa000, 0x0000,
  136.    
  137.    0x9000, 0x0000,
  138.  
  139.    0x0800, 0x0000,
  140.    0x0400, 0x0000,
  141.    0x0200, 0x0000,
  142.    
  143.    0x0000, 0x0000
  144. };
  145.  
  146. int arrow_x_offset = -1;               /* mouse pointer = thin arrow  */
  147. int arrow_y_offset = 0;
  148. int arrow_size     = sizeof(arrow_data);
  149.  
  150. UWORD cross_data[] = {
  151.    0x0000, 0x0000,
  152.    
  153.    0x0400, 0x0000,
  154.    0x0400, 0x0000,
  155.    0x0400, 0x0000,
  156.    0x0400, 0x0000,
  157.    0x0000, 0x0000,
  158.    
  159.    0xf1e0, 0x0000,
  160.  
  161.    0x0000, 0x0000,
  162.    0x0400, 0x0000,
  163.    0x0400, 0x0000,
  164.    0x0400, 0x0000,
  165.    0x0400, 0x0000,
  166.    
  167.    0x0000, 0x0000
  168. };
  169.  
  170. int cross_x_offset = -6;               /* mouse pointer = cross */
  171. int cross_y_offset = -1;
  172. int cross_size     = sizeof(cross_data);
  173.