home *** CD-ROM | disk | FTP | other *** search
- program adrg_main;
- {Program to extract a portion of the ADRG data from the CD-ROM and display
- it on an EGA monitor. After displaying the tiles, it will save the image
- on an output file specified by the user. Written in Turbo Pascal 5.0 on
- a Zenith 248 with MS-DOS 3.21, BIOS 3.37. The portion of the map to be
- displayed is selected by entering geographic coords. The CD-ROM drive
- name is picked from the environment variable CDROMDSK
- (before running the program, at the DOS prompt, type the following:
- set CDROMDSK=letter_of_your_cd_rom_drive ). This program will work for
- ADRG production discs. May not work for ADRG prototype discs. The 24
- bits/pixel ADRG is reduced to 4 bits/pixel equivalent using a minimum
- distance algorithm. The 16 colors were predetermined from a Peano curve
- algorithm on an earlier prototype and adjusted (very roughly) by visual
- means.
-
- Juan A. Perez, U. S. Army Engineer Topographic Laboratories
- Digital Concepts and Analysis Center, Ft. Belvoir, VA 22060-5546
- (202) 355-2864, AV 345-2864, 22 March 1990}
-
- uses Crt,Graph,Dos;
- {$M 53248,0,655360} {went overboard on the variables, so increased
- the stack size}
- const
- screenrow = 349; {349 for EGA, 479 for VGA}
- screencol = 639; {639 for both EGA/VGA}
- dtilerow = 3; {no. of rows of tiles that fit on the screen }
- {use 3 for EGA , or 4 for VGA}
- dtilecol = 5; {no. of colums of tiles that fit on the screen , use 5 }
-
- var
- file_name, user_file : string;
- no_of_cols_tiles : integer;
- ch : char;
- start_tile, x_c, y_c,
- nstartrow, nstartcol : longint;
- center_lat, center_lon,
- dd_clat,dd_clon,asz, bs, lat0, lon0 : real;
-
- {$I proxtrct.pas}
- {$I pcolors.pas} { temporary solution of the different color tables for }
- {$I savescrn.pas} { different prototypes }
- {$I dispcord.pas}
- {$I pdmstodd.pas}
- {$I lltopix.pas }
-
- begin
- { reads the "header" files from the CD-ROM looking for
- very important info. that will be used to display the tiles.
- Follows DMA's ADRG Specifications, First Edition
- dated April 1989 (PS/2DJ/100). }
-
- proxtrct(file_name, no_of_cols_tiles, start_tile, nstartrow, nstartcol,
- center_lat, center_lon, asz, bs, lat0, lon0);
-
- { Prompt user for output file name }
- writeln(' Enter output file name ');
- write (' (where image will be saved for future display) : ');
- readln(user_file);
-
- { reads each tile of 128X128 pixels *3 (R-G-B), from the CD-ROM, then calls
- the procedure that returns the cluster number closer to the R-G-B values
- and assigns a color to the pixel. Displays the tiles, pixel by pixel. }
-
- { the color table changes depending on the map, this one works ~OK for the
- TLMs maps from Germany }
- procolor(file_name, dtilerow, dtilecol, no_of_cols_tiles, start_tile);
-
- { display the latitude and longitude of the point the user selected }
- pdmstodd(center_lat,dd_clat);
- pdmstodd(center_lon,dd_clon);
- disp_latlon(dd_clat,dd_clon);
-
- { put a marker at that location }
- latlon_to_xyscreen(dd_clat, dd_clon, nstartrow, nstartcol, asz,bs,x_c, y_c);
- setlinestyle(0,0,1);
- setcolor(15);
- Line(x_c - 7, y_c, x_c + 7, y_c);
- Line(x_c - 7, y_c-1, x_c + 7, y_c-1);
- Line(x_c, y_c + 6, x_c, y_c - 6);
- Line(x_c-1, y_c + 6, x_c-1, y_c - 6);
-
- { When the EGA screen is full, collects the color values off the screen and
- save them in an output file. }
- savescrn(user_file, screenrow, screencol);
- setcolor(14);
- outtextxy(430,342,' -> Hit a key to Continue' );
-
- ch := ReadKey; {holds the image until the user hits a key}
- closegraph;
- end.