home *** CD-ROM | disk | FTP | other *** search
- /* grid - Display the lat/long lines for the Alaska demo.
-
- Copyright 1986 John B. Allison */
-
- struct { /* To draw latitude lines in Mercator projection */
- float mercaty; /* the Mercator y value of this latitude */
- char *degree; /* this latitude in degrees */
- } lat1[] = {
- 1.125, " 54",
- 1.185, " 56",
- 1.250, " 58",
- 1.317, " 60",
- 1.389, " 62",
- 1.466, " 64",
- 1.548, " 66",
- 1.637, " 68",
- 1.788, " 70"
- };
-
- grid(){
-
- #define LEFT -200 /* left limit of screen */
- #define RIGHT -115 /* right limit of screen */
- #define INC 5 /* increment of lines across screen */
-
- float x, y, ytop, ybot, xsidetext, ybottext, nx, ny;
- int i, height, width, path = 0, mode = 0;
- char tstring[10];
-
-
-
-
- /* Map normalized co-ordinate near bottom right of screen to
- world co-ordinates for locating text. */
-
- nx = ny = 0.9;
- mapntow(&nx, &ny, &xsidetext, &ybottext);
-
- height = width = 1;
- settext(&height, &width, &path, &mode);
-
- /* draw lines of longitude */
-
- ytop = 1.85;
- ybot = 1.1;
-
- for(i = LEFT; i <= RIGHT; i += INC){
- x = i;
- movabs(&x, &ytop);
- lnabs(&x, &ybot);
-
- sprintf(tstring, "%d", i);
- movtcurabs(&x, &ybottext);
- text(tstring);
- }
-
- /* draw lines of latitude. */
-
- for(i = 0; i <= 9; i++){
- y = lat1[i].mercaty;
- x = LEFT;
- movabs(&x, &y);
- x = RIGHT;
- lnabs(&x, &y);
-
- movtcurabs(&xsidetext, &y);
- text(lat1[i].degree);
- }
- }