/* File drawmap.h */ #define MAX(a,b) ((a)>=(b) ? (a) : (b)) #define ABS(a) ((a)>=0 ? (a) : (-(a))) #define WC WINDOWCLOSE #define WDP WINDOWDEPTH #define NORMALFLAGS (WC | WDP) #define IDCMPFLAGS (CLOSEWINDOW | MOUSEBUTTONS) #define WWIDTH 640 /* window width (pixels) */ #define WHEIGHT 400 /* window height (pixels) */ #define VMODE (HIRES | LACE) /* view mode */ #define CENTERX WWIDTH/2 /* place origin at center of */ #define CENTERY (WHEIGHT-10)/2 /* window */ #define NUMPTS 2100 /* max. no. points per area */ #define MAXVAL 17718 /* number of words in map */ #define HFACTOR (WWIDTH/360.) /* horizontal scale (pix/deg) */ #define VFACTOR ((WHEIGHT-10.)/180.) /* vertical scale (pix/deg) */ #define M_VFACTOR ((WHEIGHT-10.)/4.87) /* vertical scale for Mercator */ /* map (+/- 80 degrees lat.) */ #define ASP_RAT ((640./400.)*(188./260.)) /* screen aspect ratio */ /* (max width / max hgt) */ #define VRADIUS 160 /* vertical radius of ellipse */ /* (pixels) */ #define HRADIUS (short)(ASP_RAT * VRADIUS+0.5) /* horiz. radius (pix) */ #define FILL 1 /* fill area outlines */ #define NOFILL 0 /* don't fill area outlines */ #define OK 1 /* result flags */ #define NOT_OK 0 #define BLUE 0L /* workbench colors */ #define WHITE 1L #define BLACK 2L #define ORANGE 3L UWORD mapcolors[] = { 0x006b, 0x0fff, 0x0000, 0x0f90, /* blue, white, black, orange */ 0x0f90, 0x0fff, 0x0000, 0x006b, /* orange, white, black, blue */ 0x006b, 0x0fff, 0x0000, 0x0caf, /* blue, white, black, violet */ 0x0caf, 0x0fff, 0x0000, 0x006b, /* violet, white, black, blue */ 0x006b, 0x0fff, 0x0000, 0x00f0, /* blue, white, black, green */ 0x00f0, 0x0fff, 0x0000, 0x006b, /* green, white, black, blue */ 0x006b, 0x0fff, 0x0000, 0x0ff0, /* blue, white, black, yellow */ 0x0ff0, 0x0fff, 0x0000, 0x006b /* yellow, white, black, blue */ }; int num_colors = sizeof(mapcolors)/2; /* number of colors in color table */ #define MAXRIM 50 /* max # pairs of rim points */ #define GLOBE_FILL_MIN 5 /* min # points in area to be */ /* color-filled on globe */ #define RE 6378.165 /* radius of Earth (kilometers) */ #define VIEW_HEIGHT 300. /* height above Earth to view */ /* globe (km) */ #define MIN_HEIGHT 10. /* minimum view height (km) */ double view_height, eta, etap, facp; /* declare global constants */ double pi = 3.141592653589793; double rad, pi2, twopi; /* region numbers for lakes */ int lakes[] = { 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156 }; int num_lakes = sizeof(lakes) / sizeof(int); char fontname[] = "topaz.font"; /* screen font name */ struct TextAttr mapfont = { /* screen font */ (STRPTR) &fontname, 8, 0, 0 }; struct NewScreen mapscreen = { 0, /* left edge of screen */ 0, /* top edge of screen */ WWIDTH, WHEIGHT, /* width, height of screen */ 2, /* 4 colors */ 1, 0, /* detail pen, block pen */ VMODE, /* view mode */ CUSTOMSCREEN, /* type of screen */ &mapfont, /* screen font */ "Map Screen", /* screen title */ NULL, NULL }; struct NewWindow mapWindow = { 0, /* LeftEdge for window measured in pixels, at the current horizontal resolution, from the leftmost edge of the Screen */ 0, /* TopEdge for window is measured in lines from the top of the current Screen. */ WWIDTH, WHEIGHT, /* Width, Height of this window */ 0, /* DetailPen - what pen number is to be used to draw the borders of the window */ 1, /* BlockPen - what pen number is to be used to draw system generated window gadgets */ /* (for DetailPen and BlockPen, the value of -1 says "use the default value") */ IDCMPFLAGS, /* IDCMP Flags */ SMART_REFRESH | ACTIVATE | NORMALFLAGS | GIMMEZEROZERO | RMBTRAP | BORDERLESS | REPORTMOUSE, /* Window Flags */ NULL, /* FirstGadget */ NULL, /* CheckMark */ "Map Window", /* Window title */ NULL, /* Pointer to Screen if not workbench */ NULL, /* Pointer to BitMap if a SUPERBITMAP window */ 10, 10, /* minimum width, minimum height */ WWIDTH, WHEIGHT, /* maximum width, maximum height */ CUSTOMSCREEN }; UWORD arrow_data[] = { 0x0000, 0x0000, 0xf000, 0x0000, 0xc000, 0x0000, 0xa000, 0x0000, 0x9000, 0x0000, 0x0800, 0x0000, 0x0400, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000 }; int arrow_x_offset = -1; /* mouse pointer = thin arrow */ int arrow_y_offset = 0; int arrow_size = sizeof(arrow_data); UWORD cross_data[] = { 0x0000, 0x0000, 0x0400, 0x0000, 0x0400, 0x0000, 0x0400, 0x0000, 0x0400, 0x0000, 0x0000, 0x0000, 0xf1e0, 0x0000, 0x0000, 0x0000, 0x0400, 0x0000, 0x0400, 0x0000, 0x0400, 0x0000, 0x0400, 0x0000, 0x0000, 0x0000 }; int cross_x_offset = -6; /* mouse pointer = cross */ int cross_y_offset = -1; int cross_size = sizeof(cross_data);